{"action":"created","issue":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/4853","repository_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws","labels_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/4853/labels{/name}","comments_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/4853/comments","events_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/4853/events","html_url":"https://github.com/terraform-providers/terraform-provider-aws/issues/4853","id":332953460,"node_id":"MDU6SXNzdWUzMzI5NTM0NjA=","number":4853,"title":"ResourceInUse: Service contains registered instances; delete the instances before deleting the service","user":{"login":"hashibot[bot]","id":35615658,"node_id":"MDM6Qm90MzU2MTU2NTg=","avatar_url":"https://avatars2.githubusercontent.com/in/8332?v=4","gravatar_id":"","url":"https://api.github.com/users/hashibot%5Bbot%5D","html_url":"https://github.com/apps/hashibot","followers_url":"https://api.github.com/users/hashibot%5Bbot%5D/followers","following_url":"https://api.github.com/users/hashibot%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/hashibot%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/hashibot%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hashibot%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/hashibot%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/hashibot%5Bbot%5D/repos","events_url":"https://api.github.com/users/hashibot%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/hashibot%5Bbot%5D/received_events","type":"Bot","site_admin":false},"labels":[{"id":620316241,"node_id":"MDU6TGFiZWw2MjAzMTYyNDE=","url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/labels/enhancement","name":"enhancement","color":"d4c5f9","default":true},{"id":801971615,"node_id":"MDU6TGFiZWw4MDE5NzE2MTU=","url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/labels/service/servicediscovery","name":"service/servicediscovery","color":"bfd4f2","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-06-16T02:20:04Z","updated_at":"2018-10-03T15:04:47Z","closed_at":null,"author_association":"NONE","body":"_This issue was originally opened by @tuaris as hashicorp/terraform#18264. It was migrated here as a result of the [provider split](https://www.hashicorp.com/blog/upcoming-provider-changes-in-terraform-0-10/). The original body of the issue is below._\r\n\r\n<hr>\r\n\r\n### Terraform Version\r\n```\r\n0.11.5\r\n```\r\n\r\n### Terraform Configuration Files\r\n```hcl\r\nresource \"aws_service_discovery_private_dns_namespace\" \"app_service\" {\r\n\tname = \"app.service\"\r\n\tvpc = \"vcp-12345678\"\r\n}\r\n\r\nresource \"aws_service_discovery_service\" \"worker\" {\r\n\tname = \"worker\"\r\n\tdns_config {\r\n\t\tnamespace_id = \"${aws_service_discovery_private_dns_namespace.app_service.id}\"\r\n\t\tdns_records {\r\n\t\t\tttl = 10\r\n\t\t\ttype = \"A\"\r\n\t\t}\r\n\t\trouting_policy = \"MULTIVALUE\"\r\n\t}\r\n\r\n\thealth_check_custom_config {\r\n\t\tfailure_threshold = 1\r\n\t}\r\n}\r\n\r\nresource \"aws_ecs_service\" \"worker\" {\r\n        ...\r\n\tservice_registries {\r\n\t\tregistry_arn = \"${aws_service_discovery_service.worker.arn}\"\r\n                container_name = \"worker\"\r\n\t}\r\n}\r\n```\r\n\r\n### Debug Output\r\n```\r\nError: Error applying plan:\r\n\r\n1 error(s) occurred:\r\n\r\n* aws_service_discovery_service.worker(destroy): 1 error(s) occurred:\r\n\r\n* aws_service_discovery_service.worker: ResourceInUse: Service contains registered instances; delete the instances before deleting the service \r\n\r\n```\r\n\r\n### Expected Behavior\r\n\r\nRemoving the resource `aws_service_discovery_service.worker` should first stop the service `aws_ecs_service.worker`, then proceed to delete the resource.\r\n\r\n### Actual Behavior\r\n\r\nProcess fails with `ResourceInUse: Service contains registered instances; delete the instances before deleting the service`\r\n\r\n### Steps to Reproduce\r\n\r\nTo reproduce the issue, for example:\r\n1. Use the configuration above\r\n2. `terraform apply`\r\n3. Remove the resource `aws_service_discovery_service.worker`\r\n4. `terraform apply`\r\n"},"comment":{"url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/comments/426671683","html_url":"https://github.com/terraform-providers/terraform-provider-aws/issues/4853#issuecomment-426671683","issue_url":"https://api.github.com/repos/terraform-providers/terraform-provider-aws/issues/4853","id":426671683,"node_id":"MDEyOklzc3VlQ29tbWVudDQyNjY3MTY4Mw==","user":{"login":"choeflake","id":1510586,"node_id":"MDQ6VXNlcjE1MTA1ODY=","avatar_url":"https://avatars2.githubusercontent.com/u/1510586?v=4","gravatar_id":"","url":"https://api.github.com/users/choeflake","html_url":"https://github.com/choeflake","followers_url":"https://api.github.com/users/choeflake/followers","following_url":"https://api.github.com/users/choeflake/following{/other_user}","gists_url":"https://api.github.com/users/choeflake/gists{/gist_id}","starred_url":"https://api.github.com/users/choeflake/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/choeflake/subscriptions","organizations_url":"https://api.github.com/users/choeflake/orgs","repos_url":"https://api.github.com/users/choeflake/repos","events_url":"https://api.github.com/users/choeflake/events{/privacy}","received_events_url":"https://api.github.com/users/choeflake/received_events","type":"User","site_admin":false},"created_at":"2018-10-03T15:04:46Z","updated_at":"2018-10-03T15:04:46Z","author_association":"NONE","body":"+1"}}
{"actor":{"display_login":"choeflake"}}