{"action":"created","issue":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/12634","repository_url":"https://api.github.com/repos/hashicorp/terraform","labels_url":"https://api.github.com/repos/hashicorp/terraform/issues/12634/labels{/name}","comments_url":"https://api.github.com/repos/hashicorp/terraform/issues/12634/comments","events_url":"https://api.github.com/repos/hashicorp/terraform/issues/12634/events","html_url":"https://github.com/hashicorp/terraform/issues/12634","id":213705357,"number":12634,"title":"[AWS] Creating of ALB, Target Group and Service in one script causes errors","user":{"login":"Timboo89","id":11556495,"avatar_url":"https://avatars0.githubusercontent.com/u/11556495?v=4","gravatar_id":"","url":"https://api.github.com/users/Timboo89","html_url":"https://github.com/Timboo89","followers_url":"https://api.github.com/users/Timboo89/followers","following_url":"https://api.github.com/users/Timboo89/following{/other_user}","gists_url":"https://api.github.com/users/Timboo89/gists{/gist_id}","starred_url":"https://api.github.com/users/Timboo89/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Timboo89/subscriptions","organizations_url":"https://api.github.com/users/Timboo89/orgs","repos_url":"https://api.github.com/users/Timboo89/repos","events_url":"https://api.github.com/users/Timboo89/events{/privacy}","received_events_url":"https://api.github.com/users/Timboo89/received_events","type":"User","site_admin":false},"labels":[{"id":85946957,"url":"https://api.github.com/repos/hashicorp/terraform/labels/bug","name":"bug","color":"f7c6c7","default":true},{"id":127939518,"url":"https://api.github.com/repos/hashicorp/terraform/labels/provider/aws","name":"provider/aws","color":"bfdadc","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":21,"created_at":"2017-03-13T08:54:29Z","updated_at":"2018-03-08T16:58:32Z","closed_at":"2017-03-16T08:42:53Z","author_association":"NONE","body":"Hi there,\r\n\r\n### Terraform Version\r\nv0.8.8\r\n\r\n### Affected Resource(s)\r\n- aws_alb\r\n- aws_alb_target_group\r\n- aws_ecs_service\r\n\r\n### Error\r\n#### first run\r\n* aws_ecs_service.servicelayer: InvalidParameterException: The target group with targetGroupArn arn:aws:elasticloadbalancing:eu-central-1:xxx:targetgroup/prod-test-servicelayer-tg/xxx does not have an associated load balancer.\r\n\tstatus code: 400, request id: xxx \"servicelayer\"\r\n\r\n#### second run and further on\r\n* aws_ecs_service.servicelayer: InvalidParameterException: Creation of service was not idempotent.\r\n\tstatus code: 400, request id: xxx \"servicelayer\"\r\n\r\n### Cause\r\n- I am starting an ALB, some target groups and a bunch of (container-)services in one terraform - script. \r\n- At the first run the target groups cannot connect to the ALB since that is created but not active yet.\r\n- At the following runs, the ALB is fully loaded, so that the target groups can connect to the ALB, BUT the services are already started, so that the creation of services is not idempotent. Yey!\r\n\r\n### Ad-hoc Solution\r\n- Set the disired count of the services manually to 0\r\n- delete services\r\n- rerun terraform apply\r\n\r\n### Desired Solution\r\nIt would be great, if you guys could wait until the ALB is active before terraform says it's ready or to check before trying to connect a target group to it and if it's not active yet, wait for it."},"comment":{"url":"https://api.github.com/repos/hashicorp/terraform/issues/comments/371550976","html_url":"https://github.com/hashicorp/terraform/issues/12634#issuecomment-371550976","issue_url":"https://api.github.com/repos/hashicorp/terraform/issues/12634","id":371550976,"user":{"login":"pedros007","id":3934621,"avatar_url":"https://avatars2.githubusercontent.com/u/3934621?v=4","gravatar_id":"","url":"https://api.github.com/users/pedros007","html_url":"https://github.com/pedros007","followers_url":"https://api.github.com/users/pedros007/followers","following_url":"https://api.github.com/users/pedros007/following{/other_user}","gists_url":"https://api.github.com/users/pedros007/gists{/gist_id}","starred_url":"https://api.github.com/users/pedros007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pedros007/subscriptions","organizations_url":"https://api.github.com/users/pedros007/orgs","repos_url":"https://api.github.com/users/pedros007/repos","events_url":"https://api.github.com/users/pedros007/events{/privacy}","received_events_url":"https://api.github.com/users/pedros007/received_events","type":"User","site_admin":false},"created_at":"2018-03-08T16:58:32Z","updated_at":"2018-03-08T16:58:32Z","author_association":"NONE","body":"@seanscottking did you try what I said?  You probably need _two_ `depends_on`'s:  The TargetGroup `depends_on` the ALB.  The ECS Service `depends_on` a Listener and/or ListenerRule."}}
{"actor":{"display_login":"pedros007"}}