{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/5899","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/5899/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/5899/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/5899/events","html_url":"https://github.com/hashicorp/terraform/issues/5899","id":144291283,"number":5899,"title":"`destroy` should wait (longer) for an RDS instance to be destroyed","user":{"login":"timmytofu","id":439208,"avatar_url":"https://avatars3.githubusercontent.com/u/439208?v=4","gravatar_id":"","url":"https://api.github.com/users/timmytofu","html_url":"https://github.com/timmytofu","followers_url":"https://api.github.com/users/timmytofu/followers","following_url":"https://api.github.com/users/timmytofu/following{/other_user}","gists_url":"https://api.github.com/users/timmytofu/gists{/gist_id}","starred_url":"https://api.github.com/users/timmytofu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/timmytofu/subscriptions","organizations_url":"https://api.github.com/users/timmytofu/orgs","repos_url":"https://api.github.com/users/timmytofu/repos","events_url":"https://api.github.com/users/timmytofu/events{/privacy}","received_events_url":"https://api.github.com/users/timmytofu/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2016-03-29T14:58:46Z","updated_at":"2017-07-30T07:17:54Z","closed_at":"2016-04-08T01:39:46Z","body":"With the minimal config at the bottom, I can create a DB in a subnet. When I `terraform destroy`, though, I inevitably get an error \n\n```\n* aws_db_subnet_group.pg-subnet-group: InvalidDBSubnetGroupStateFault: Cannot delete the subnet group 'pg-subnet-group' because at least one database instance: postgres is still using it.\n        status code: 400, request id: 47b1b254-f5bd-11e5-8be4-d967ab0696f7\n```\n\nIf I run `terraform destroy` again it works, starting by destroying `pg-subnet-group`. So, I think terraform needs to wait a little longer/check that the DB instance is completely destroyed before trying to destroy resources upon which it depends.\n\nSystem info:\n\n```\ntim 2016Mar29 10:54:33> terraform -version\nTerraform v0.6.13\n\ntim 2016Mar29 10:57:50> uname -a\nLinux seitan 3.19.0-43-generic #49~14.04.1-Ubuntu SMP Thu Dec 31 15:44:49 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux\n```\n\nConfig used:\n\n```\nvariable \"aws_access_key\" {}\nvariable \"aws_secret_key\" {}\n\nprovider \"aws\" {\n  access_key = \"${var.aws_access_key}\"\n  secret_key = \"${var.aws_secret_key}\"\n  region     = \"us-west-2\"\n}\n\nresource \"aws_vpc\" \"vpc\" {\n  cidr_block = \"10.0.0.0/16\"\n\n  tags {\n    Name = \"vpc\"\n  }\n}\n\nresource \"aws_security_group\" \"db-sg\" {\n  name = \"db-sg\"\n\n  vpc_id = \"${aws_vpc.vpc.id}\"\n\n  tags {\n    Name = \"db-sg\"\n  }\n}\n\nresource \"aws_subnet\" \"db-priv-west2a\" {\n  vpc_id = \"${aws_vpc.vpc.id}\"\n  cidr_block = \"10.0.1.0/24\"\n\n  availability_zone = \"us-west-2a\"\n}\n\nresource \"aws_subnet\" \"db-priv-west2c\" {\n  vpc_id = \"${aws_vpc.vpc.id}\"\n  cidr_block = \"10.0.2.0/24\"\n\n  availability_zone = \"us-west-2c\"\n}\n\nresource \"aws_db_subnet_group\" \"pg-subnet-group\" {\n  name = \"pg-subnet-group\"\n  description = \"blah\"\n\n  subnet_ids = [ \"${aws_subnet.db-priv-west2a.id}\", \"${aws_subnet.db-priv-west2c.id}\" ]\n}\n\nresource \"aws_db_instance\" \"postgres\" {\n  allocated_storage = 5\n  engine            = \"postgres\"\n  engine_version    = \"9.4.5\"\n  identifier        = \"postgres\"\n  instance_class    = \"db.t2.micro\"\n  storage_type      = \"standard\"\n\n  vpc_security_group_ids = [ \"${aws_security_group.db-sg.id}\" ]\n  publicly_accessible = false\n  db_subnet_group_name = \"pg-subnet-group\"\n\n  name     = \"foo\"\n  username = \"foofoofoo\"\n  password = \"barbarbar\"\n  port     = \"5432\"\n\n  backup_retention_period = \"1\"\n  skip_final_snapshot = \"true\"\n}\n```\n"},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/318883886","html_url":"https://github.com/hashicorp/terraform/issues/5899#issuecomment-318883886","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/5899","id":318883886,"user":{"login":"shederman","id":1817913,"avatar_url":"https://avatars3.githubusercontent.com/u/1817913?v=4","gravatar_id":"","url":"https://api.github.com/users/shederman","html_url":"https://github.com/shederman","followers_url":"https://api.github.com/users/shederman/followers","following_url":"https://api.github.com/users/shederman/following{/other_user}","gists_url":"https://api.github.com/users/shederman/gists{/gist_id}","starred_url":"https://api.github.com/users/shederman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shederman/subscriptions","organizations_url":"https://api.github.com/users/shederman/orgs","repos_url":"https://api.github.com/users/shederman/repos","events_url":"https://api.github.com/users/shederman/events{/privacy}","received_events_url":"https://api.github.com/users/shederman/received_events","type":"User","site_admin":false},"created_at":"2017-07-30T07:17:54Z","updated_at":"2017-07-30T07:17:54Z","body":"Hi, I'm getting this exact same issue, means tear down does not work predictably. When will this be fixed?"}}
{"actor":{"display_login":"shederman"}}