#help (2021-03)
Where to get help about getting help!
2021-03-09

Hi friends! Having trouble spinning up atlantis using the cloudposse module, I’m getting this error:
Error: InvalidParameterException: The target group with targetGroupArn arn:aws:elasticloadbalancing:us-east-2:121212121212:targetgroup/atlantis/e69e6e3e328b63dd does not have an associated load balancer. "atlantis"
The target group is created by the module, but it doesn’t create the target group association to the load balancer which was created outside of the module. What is the recommended approach for fixing this?

I also made a change and PR’d it here - please take a look when possible! https://github.com/cloudposse/terraform-aws-ecs-atlantis/pull/36

we did not look at it recently, but when we looked, TF could not detect that the just provisioned LB was in “Ready” state since LB tales long time to come online, so TF thought the LB was not provisioned

so we did terraform apply
two times in a row

hm. the load balancer has been active for a while because it is created outside of the atlantis module - the problem is that the atlantis module (and its submodules) create a target group but they never create the attachment to the ALB that I’ve created, from what I see readin through the [main.tf](http://main.tf)
s

Terraform module for deploying Atlantis as an ECS Task - cloudposse/terraform-aws-ecs-atlantis

Terratest for the module ^

the only ways to solve that were 1) to use two-stage apply; 2) separate the ALB into a folder and apply first

maybe there are possibilities now (AWS changed a lot, TF changed a lot. etc.)

for example, now we can use depend_on
on modules

so if we add that to the atlantis
module to depend on ALB, it could work )or not, depending on the internal implementation and how TF detects if the ALB is ready))

yes but its not the target group or the ALB that are causing my problem, it’s the fact that a aws_lb_target_group_attachment
resource is not created in any of the child modules of the atlantis service

the target group in atlantis is created here module.ecs_web_app.module.alb_ingress.aws_lb_target_group.default[0]
but it is never attached to the LB that I provide.
So I’m mainly curious how this setup has worked for people in the past. I’m ok PRing it in but curious how this hasn’t been raised before

Or maybe I’m missing something obvious

it was working and deployed into many accounts

and the Terratest runs everytime we merge a PR

yes i expect its the latter, that I’m missing something. but I’m not sure what that is..

Terratest deploys this example https://github.com/cloudposse/terraform-aws-ecs-atlantis/tree/master/examples/complete
Terraform module for deploying Atlantis as an ECS Task - cloudposse/terraform-aws-ecs-atlantis

it should work (unless something was changed in AWS after we merged the last PR)

I see the tests succeed on the PR that I’ve got open right now.. I’m very confused. Going to read the terratest logs

I found the solution! I wasn’t setting the var alb_ingress_unauthenticated_listener_arns_count = 1