{"action":"created","issue":{"url":"https://api.github.com/repos/chef/chef-provisioning-aws/issues/121","labels_url":"https://api.github.com/repos/chef/chef-provisioning-aws/issues/121/labels{/name}","comments_url":"https://api.github.com/repos/chef/chef-provisioning-aws/issues/121/comments","events_url":"https://api.github.com/repos/chef/chef-provisioning-aws/issues/121/events","html_url":"https://github.com/chef/chef-provisioning-aws/issues/121","id":59790478,"number":121,"title":"aws_security_group out of sync","user":{"login":"john-casey","id":1769761,"avatar_url":"https://avatars.githubusercontent.com/u/1769761?v=3","gravatar_id":"","url":"https://api.github.com/users/john-casey","html_url":"https://github.com/john-casey","followers_url":"https://api.github.com/users/john-casey/followers","following_url":"https://api.github.com/users/john-casey/following{/other_user}","gists_url":"https://api.github.com/users/john-casey/gists{/gist_id}","starred_url":"https://api.github.com/users/john-casey/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/john-casey/subscriptions","organizations_url":"https://api.github.com/users/john-casey/orgs","repos_url":"https://api.github.com/users/john-casey/repos","events_url":"https://api.github.com/users/john-casey/events{/privacy}","received_events_url":"https://api.github.com/users/john-casey/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-03-04T12:20:43Z","updated_at":"2015-03-18T00:56:04Z","closed_at":"2015-03-18T00:56:04Z","body":"There is no way to recover from the situation where security group that is provisioned using aws_security_group, then it later gets deleted on the AWS console. If you run the recipe to converge, it complains about that the AWS key is not found.\r\n```\r\n    - create elastichef-dev-key on aws from local key at elastichef-dev-key.pem\r\n  * aws_security_group[elastichef-app-sg] action create[2015-03-04T07:18:09-05:00] INFO: Processing aws_security_group[elastichef-app-sg] action create (elastichef::create line 56)\r\n\r\n    \r\n    ================================================================================\r\n    Error executing action `create` on resource 'aws_security_group[elastichef-app-sg]'\r\n    ================================================================================\r\n    \r\n    AWS::EC2::Errors::InvalidGroup::NotFound\r\n    ----------------------------------------\r\n    The security group 'sg-a1d408cc' does not exist\r\n    \r\n    Resource Declaration:\r\n    ---------------------\r\n    # In /home/john/.chef/local-mode-cache/cache/cookbooks/elastichef/recipes/create.rb\r\n    \r\n     56: aws_security_group \"#{application}-app-sg\" do\r\n     57:   description \"#{application} app servers\" \r\n     58:   inbound_rules [\r\n     59:     {:ports =>   22, :protocol => :tcp, :sources => ['0.0.0.0/0'] },\r\n     60:     {:ports =>   80, :protocol => :tcp, :sources => ['0.0.0.0/0'] }\r\n     61:   ]\r\n     62: end\r\n     63: aws_security_group \"#{application}-db-sg\"  do\r\n    \r\n    Compiled Resource:\r\n    ------------------\r\n    # Declared in /home/john/.chef/local-mode-cache/cache/cookbooks/elastichef/recipes/create.rb:56:in `from_file'\r\n    \r\n    aws_security_group(\"elastichef-app-sg\") do\r\n      action :create\r\n      retries 0\r\n      retry_delay 2\r\n      default_guard_interpreter :default\r\n      id \"elastichef-app-sg\"\r\n      security_group_id \"sg-a1d408cc\"\r\n      declared_type :aws_security_group\r\n      cookbook_name \"elastichef\"\r\n      recipe_name \"create\"\r\n      description \"elastichef app servers\"\r\n      inbound_rules [{:ports=>22, :protocol=>:tcp, :sources=>[\"0.0.0.0/0\"]}, {:ports=>80, :protocol=>:tcp, :sources=>[\"0.0.0.0/0\"]}]\r\n    end\r\n```\r\n\r\nIf you try to delete the key, aws_security_group tells you that the key does not exist:\r\n\r\n```\r\n  * aws_security_group[elastichef-app-sg] action delete[2015-03-04T07:06:42-05:00] INFO: Processing aws_security_group[elastichef-app-sg] action delete (elastichef::destroy line 70)\r\n    ================================================================================\r\n    Error executing action `delete` on resource 'aws_security_group[elastichef-app-sg]'\r\n    ================================================================================\r\n    \r\n    AWS::EC2::Errors::InvalidGroup::NotFound\r\n    ----------------------------------------\r\n    The security group 'sg-a1d408cc' does not exist\r\n    \r\n    Resource Declaration:\r\n    ---------------------\r\n    # In /home/john/.chef/local-mode-cache/cache/cookbooks/elastichef/recipes/destroy.rb\r\n    \r\n     70:           aws_security_group security_group do\r\n     71:             action :delete\r\n     72:           end\r\n     73:         rescue Exception => msg\r\n    \r\n    Compiled Resource:\r\n    ------------------\r\n    # Declared in /home/john/.chef/local-mode-cache/cache/cookbooks/elastichef/recipes/destroy.rb:70:in `block (3 levels) in from_file'\r\n    \r\n    aws_security_group(\"elastichef-app-sg\") do\r\n      action [:delete]\r\n      retries 0\r\n      retry_delay 2\r\n      default_guard_interpreter :default\r\n      id \"elastichef-app-sg\"\r\n      security_group_id \"sg-a1d408cc\"\r\n      declared_type :aws_security_group\r\n      cookbook_name \"elastichef\"\r\n      recipe_name \"destroy\"\r\n    end\r\n```"},"comment":{"url":"https://api.github.com/repos/chef/chef-provisioning-aws/issues/comments/82661292","html_url":"https://github.com/chef/chef-provisioning-aws/issues/121#issuecomment-82661292","issue_url":"https://api.github.com/repos/chef/chef-provisioning-aws/issues/121","id":82661292,"user":{"login":"jkeiser","id":654882,"avatar_url":"https://avatars.githubusercontent.com/u/654882?v=3","gravatar_id":"","url":"https://api.github.com/users/jkeiser","html_url":"https://github.com/jkeiser","followers_url":"https://api.github.com/users/jkeiser/followers","following_url":"https://api.github.com/users/jkeiser/following{/other_user}","gists_url":"https://api.github.com/users/jkeiser/gists{/gist_id}","starred_url":"https://api.github.com/users/jkeiser/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jkeiser/subscriptions","organizations_url":"https://api.github.com/users/jkeiser/orgs","repos_url":"https://api.github.com/users/jkeiser/repos","events_url":"https://api.github.com/users/jkeiser/events{/privacy}","received_events_url":"https://api.github.com/users/jkeiser/received_events","type":"User","site_admin":false},"created_at":"2015-03-18T00:56:04Z","updated_at":"2015-03-18T00:56:04Z","body":"Fixed in master!"}}