#help (2021-03)

Where to get help about getting help!

2021-03-09

kevcube avatar
kevcube

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?

kevcube avatar
kevcube

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

kevcube avatar
kevcube

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

kevcube avatar
kevcube

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

kevcube avatar
kevcube

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

kevcube avatar
kevcube

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

kevcube avatar
kevcube

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)

kevcube avatar
kevcube

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

kevcube avatar
kevcube

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

2021-03-10

    keyboard_arrow_up