#help (2021-03)

Where to get help about getting help!

2021-03-10

2021-03-09

Kevin Mahoney avatar
Kevin Mahoney

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?

Kevin Mahoney avatar
Kevin Mahoney

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

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

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

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

so we did terraform apply two times in a row

Kevin Mahoney avatar
Kevin Mahoney

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

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)
cloudposse/terraform-aws-ecs-atlantis

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

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

Terratest for the module ^

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

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

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

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

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

for example, now we can use depend_on on modules

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

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))

Kevin Mahoney avatar
Kevin Mahoney

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

Kevin Mahoney avatar
Kevin Mahoney

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

Kevin Mahoney avatar
Kevin Mahoney

Or maybe I’m missing something obvious

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

it was working and deployed into many accounts

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

and the Terratest runs everytime we merge a PR

Kevin Mahoney avatar
Kevin Mahoney

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

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)
cloudposse/terraform-aws-ecs-atlantis

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

Andriy Knysh (Cloud Posse) avatar
Andriy Knysh (Cloud Posse)

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

Kevin Mahoney avatar
Kevin Mahoney

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

Kevin Mahoney avatar
Kevin Mahoney

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

    keyboard_arrow_up