{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/1203","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/1203/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/1203/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/1203/events","html_url":"https://github.com/hashicorp/terraform/issues/1203","id":61565221,"number":1203,"title":"destroy failing in AWS","user":{"login":"jaxxstorm","id":1622940,"avatar_url":"https://avatars.githubusercontent.com/u/1622940?v=3","gravatar_id":"","url":"https://api.github.com/users/jaxxstorm","html_url":"https://github.com/jaxxstorm","followers_url":"https://api.github.com/users/jaxxstorm/followers","following_url":"https://api.github.com/users/jaxxstorm/following{/other_user}","gists_url":"https://api.github.com/users/jaxxstorm/gists{/gist_id}","starred_url":"https://api.github.com/users/jaxxstorm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jaxxstorm/subscriptions","organizations_url":"https://api.github.com/users/jaxxstorm/orgs","repos_url":"https://api.github.com/users/jaxxstorm/repos","events_url":"https://api.github.com/users/jaxxstorm/events{/privacy}","received_events_url":"https://api.github.com/users/jaxxstorm/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-03-14T11:15:28Z","updated_at":"2015-03-16T17:28:14Z","closed_at":"2015-03-14T15:11:46Z","body":"Looks like the latest build still having some issues with destroys:\r\n\r\n```\r\nDo you really want to destroy?\r\n  Terraform will delete all your managed infrastructure.\r\n  There is no undo. Only 'yes' will be accepted to confirm.\r\n\r\n  Enter a value: yes\r\n\r\nmodule.ap_vpc.aws_vpc.vpc: Refreshing state... (ID: vpc-f0ae0895)\r\nmodule.ap_subnets.aws_subnet.dmz_subnet: Refreshing state... (ID: subnet-22bb2947)\r\nmodule.ap_subnets.aws_subnet.console01_subnet: Refreshing state... (ID: subnet-2dbb2948)\r\nmodule.ap_subnets.aws_subnet.web01_subnet: Refreshing state... (ID: subnet-26bb2943)\r\nmodule.ap_subnets.aws_subnet.storage01_subnet: Refreshing state... (ID: subnet-21bb2944)\r\nmodule.ap_subnets.aws_subnet.db01_subnet: Refreshing state... (ID: subnet-20bb2945)\r\nmodule.ap_subnets.aws_subnet.infra_subnet: Refreshing state... (ID: subnet-23bb2946)\r\nmodule.ap_subnets.aws_subnet.app01_subnet: Refreshing state... (ID: subnet-2cbb2949)\r\nmodule.ap_securitygroups.aws_security_group.nat: Refreshing state... (ID: sg-75d6af10)\r\nmodule.ap_securitygroups.aws_security_group.infra: Refreshing state... (ID: sg-6ad6af0f)\r\nmodule.ap_securitygroups.aws_security_group.console01: Refreshing state... (ID: sg-74d6af11)\r\nmodule.ap_securitygroups.aws_security_group.storage01: Refreshing state... (ID: sg-6bd6af0e)\r\nmodule.ap_securitygroups.aws_security_group.db01: Refreshing state... (ID: sg-69d6af0c)\r\nmodule.ap_securitygroups.aws_security_group.app01: Refreshing state... (ID: sg-77d6af12)\r\nmodule.ap_securitygroups.aws_security_group.web01: Refreshing state... (ID: sg-68d6af0d)\r\nmodule.ap_kms.aws_instance.kms: Refreshing state... (ID: i-db8fe73f)\r\nmodule.ap_bigip.aws_instance.bigip: Refreshing state... (ID: i-ad8fe749)\r\nmodule.ap_smtp.aws_instance.smtp: Refreshing state... (ID: i-ae8fe74a)\r\nmodule.ap_nexus.aws_instance.nexus: Refreshing state... (ID: i-a98fe74d)\r\nmodule.ap_dnsslave.aws_instance.dnsslave: Refreshing state... (ID: i-a88fe74c)\r\nmodule.ap_build.aws_instance.build: Refreshing state... (ID: i-cd8fe729)\r\nmodule.ap_puppet.aws_instance.puppet: Refreshing state... (ID: i-af8fe74b)\r\nmodule.ap_nat.aws_instance.nat: Refreshing state... (ID: i-da8fe73e)\r\nmodule.ap_nat.aws_internet_gateway.gw: Refreshing state... (ID: igw-a128e9c4)\r\nmodule.ap_nat.aws_route_table.internet: Refreshing state... (ID: rtb-0cbb0c69)\r\nmodule.ap_nat.aws_route_table_association.internet: Refreshing state... (ID: rtbassoc-1e8b307b)\r\nmodule.ap_nat.aws_eip.nat: Refreshing state... (ID: eipalloc-55e91430)\r\nmodule.ap_opsrouting.aws_route_table.ops: Refreshing state... (ID: rtb-0bbb0c6e)\r\nmodule.ap_opsrouting.aws_main_route_table_association.ops: Refreshing state... (ID: rtbassoc-ed8b3088)\r\naws_vpc.vpc: Destroying...\r\naws_vpc.vpc: Error: 1 error(s) occurred:\r\n\r\n* Error deleting VPC: The vpc 'vpc-f0ae0895' has dependencies and cannot be deleted.\r\naws_security_group.infra: Destroying...\r\naws_security_group.storage01: Destroying...\r\naws_security_group.app01: Destroying...\r\naws_security_group.web01: Destroying...\r\naws_security_group.db01: Destroying...\r\naws_security_group.nat: Destroying...\r\naws_security_group.console01: Destroying...\r\naws_security_group.app01: Destruction complete\r\naws_security_group.web01: Destruction complete\r\naws_security_group.db01: Destruction complete\r\naws_security_group.storage01: Destruction complete\r\naws_security_group.infra: Error: 1 error(s) occurred:\r\n\r\n* resource sg-6ad6af0f has a dependent object\r\naws_security_group.nat: Error: 1 error(s) occurred:\r\n\r\n* resource sg-75d6af10 has a dependent object\r\naws_security_group.console01: Error: 1 error(s) occurred:\r\n\r\n* resource sg-74d6af11 has a dependent object\r\naws_main_route_table_association.ops: Destroying...\r\naws_main_route_table_association.ops: Destruction complete\r\naws_route_table.ops: Destroying...\r\naws_route_table.ops: Destruction complete\r\nError applying plan:\r\n\r\n2 error(s) occurred:\r\n\r\n* 1 error(s) occurred:\r\n\r\n* 1 error(s) occurred:\r\n\r\n* 1 error(s) occurred:\r\n\r\n* Error deleting VPC: The vpc 'vpc-f0ae0895' has dependencies and cannot be deleted.\r\n* 3 error(s) occurred:\r\n\r\n* 1 error(s) occurred:\r\n\r\n* 1 error(s) occurred:\r\n\r\n* resource sg-6ad6af0f has a dependent object\r\n* 1 error(s) occurred:\r\n\r\n* 1 error(s) occurred:\r\n\r\n* resource sg-75d6af10 has a dependent object\r\n* 1 error(s) occurred:\r\n\r\n* 1 error(s) occurred:\r\n\r\n* resource sg-74d6af11 has a dependent object\r\n\r\nTerraform does not automatically rollback in the face of errors.\r\nInstead, your Terraform state file has been partially updated with\r\nany resources that successfully completed. Please address the error\r\nabove and apply again to incrementally change your infrastructure.\r\n\r\n```\r\n\r\nit seems to me that the issue here lies around not deleting EC2 instances inside a security group or subnet BEFORE deleting those security groups. Perhaps there needs to be dependencies on that worked in?"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/81823708","html_url":"https://github.com/hashicorp/terraform/issues/1203#issuecomment-81823708","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/1203","id":81823708,"user":{"login":"catsby","id":61721,"avatar_url":"https://avatars.githubusercontent.com/u/61721?v=3","gravatar_id":"","url":"https://api.github.com/users/catsby","html_url":"https://github.com/catsby","followers_url":"https://api.github.com/users/catsby/followers","following_url":"https://api.github.com/users/catsby/following{/other_user}","gists_url":"https://api.github.com/users/catsby/gists{/gist_id}","starred_url":"https://api.github.com/users/catsby/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/catsby/subscriptions","organizations_url":"https://api.github.com/users/catsby/orgs","repos_url":"https://api.github.com/users/catsby/repos","events_url":"https://api.github.com/users/catsby/events{/privacy}","received_events_url":"https://api.github.com/users/catsby/received_events","type":"User","site_admin":false},"created_at":"2015-03-16T17:28:14Z","updated_at":"2015-03-16T17:28:14Z","body":"Hey @jaxxstorm do you have a minimal config that reproduces this? If you do, that would be really helpful. Be sure to strip any sensitive / secrets. \r\n\r\nThere was similar issues in https://github.com/hashicorp/terraform/pull/1189 that was resolved in part by using `depends_on` to explicitly set the order of deleting. I'd like to see if that helps here.\r\n"}}