cloudposse / terraform-aws-ecs-web-app

Terraform module that implements a web app on ECS and supports autoscaling, CI/CD, monitoring, ALB integration, and much more.
https://cloudposse.com/accelerate
Apache License 2.0
242 stars 154 forks source link

Error: creating ECS Service (mvv-esports-fe-development-app): InvalidParameterException: The target group with targetGroupArn * does not have an associated load balancer. #226

Closed astasiukmvv closed 1 year ago

astasiukmvv commented 1 year ago

Describe the Bug

Terraform apply failed on creating ECS Service with already created LB and listener with error "Error: creating ECS Service ("service-name"): InvalidParameterException: The target group with targetGroupArn "arn name" does not have an associated load balancer.",

current code

module "default_backend_web_app" { source = "cloudposse/ecs-web-app/aws"

Cloud Posse recommends pinning every module to a specific version

version = "x.x.x"

namespace = var.namespace name = "${var.name}-${terraform.workspace}-'app'" vpc_id = data.terraform_remote_state.vpc.outputs.vpc_id aws_logs_region = var.region ecs_cluster_arn = module.ecs_cluster.arn ecs_cluster_name = module.ecs_cluster.name ecs_private_subnet_ids = data.terraform_remote_state.vpc.outputs.private_subnet_ids codepipeline_enabled = true alb_security_group = data.terraform_remote_state.alb.outputs.security_group_id alb_arn_suffix = data.terraform_remote_state.alb.outputs.alb_arn_suffix alb_ingress_unauthenticated_listener_arns = [data.terraform_remote_state.alb.outputs.https_listener_arn] alb_ingress_unauthenticated_listener_arns_count = 1 alb_ingress_healthcheck_path = "/"

deployment_controller_type = "CODE_DEPLOY" webhook_enabled = false

container_environment = [ { name = "COOKIE" value = "cookiemonster" }, { name = "PORT" value = "80" } ] }

Expected Behavior

ECS Service should be created without errors and associate LB with TG , as seems all variables filled correctly

Steps to Reproduce

run template from description

Screenshots

No response

Environment

Additional Context

No response

404shades commented 1 year ago

Hi, @astasiukmvv I am also getting this error, How to fix this?