Marcin Mrotek
11/13/2021, 4:24 PMalb_security_group = module.alb.security_group_id
alb_target_group_alarms_enabled = true
alb_target_group_alarms_3xx_threshold = 25
alb_target_group_alarms_4xx_threshold = 25
alb_target_group_alarms_5xx_threshold = 25
alb_target_group_alarms_response_time_threshold = 0.5
alb_target_group_alarms_period = 300
alb_target_group_alarms_evaluation_periods = 1
alb_arn_suffix = module.alb.alb_arn_suffix
alb_ingress_healthcheck_path = "/"
# Without authentication, both HTTP and HTTPS endpoints are supported
alb_ingress_unauthenticated_listener_arns = module.alb.listener_arns
alb_ingress_unauthenticated_listener_arns_count = 2
# All paths are unauthenticated
alb_ingress_unauthenticated_paths = ["/*"]
alb_ingress_listener_unauthenticated_priority = 100
error I got
Error: Invalid count argument
│
│ on .terraform/modules/gateway.alb_ingress/main.tf line 50, in resource "aws_lb_listener_rule" "unauthenticated_paths":
│ 50: count = module.this.enabled && length(var.unauthenticated_paths) > 0 && length(var.unauthenticated_hosts) == 0 ? length(var.unauthenticated_listener_arns) : 0
│
│ The "count" value depends on resource attributes that cannot be determined until apply, so Terraform
│ cannot predict how many instances will be created. To work around this, use the -target argument to first
│ apply only the resources that the count depends on.
By chance you may know what I’m doing wrong here?RB
11/13/2021, 4:25 PMalb_ingress_unauthenticated_listener_arnsRB
11/13/2021, 4:26 PM-target module.alb first, it should workMarcin Mrotek
11/13/2021, 4:35 PM│ Error: error creating application Load Balancer: InvalidSubnet: VPC vpc-024b08d14c04aa553 has no internet gateway
│ status code: 400, request id: a5e9dd93-d1a3-49bf-a8d3-0748dcb1afe7
│
│ with module.alb.aws_lb.default[0],
│ on .terraform/modules/alb/main.tf line 64, in resource "aws_lb" "default":
│ 64: resource "aws_lb" "default" {
with this vpc/subnets code
module "vpc" {
source = "cloudposse/vpc/aws"
version = "0.28.1"
name = "microservices"
cidr_block = "20.0.0.0/16"
assign_generated_ipv6_cidr_block = true
context = module.this.context
}
## Subnets
module "subnets" {
source = "cloudposse/dynamic-subnets/aws"
version = "0.39.7"
name = "microservices"
availability_zones = var.availability_zones
vpc_id = module.vpc.vpc_id
igw_id = module.vpc.igw_id
cidr_block = module.vpc.vpc_cidr_block
nat_gateway_enabled = true
nat_instance_enabled = false
aws_route_create_timeout = "5m"
aws_route_delete_timeout = "10m"
context = module.this.context
}Marcin Mrotek
11/13/2021, 4:35 PMRB
11/13/2021, 4:40 PMenable_internet_gateway = true in the vpc moduleMarcin Mrotek
11/13/2021, 4:43 PMMarcin Mrotek
11/13/2021, 4:43 PMinternet_gateway_enabled and enable_internet_gatewayMarcin Mrotek
11/13/2021, 4:58 PMMarcin Mrotek
11/13/2021, 4:58 PMRB
11/13/2021, 5:25 PMMarcin Mrotek
11/13/2021, 5:26 PMRB
11/13/2021, 5:28 PMlocal.internet_gateway_enabled should resolve to true
and then that true should be passed in here to create the internet gateway
https://github.com/cloudposse/terraform-aws-vpc/blob/a3c4b1598942f3ae7a259d3f2823761a97befbd4/main.tf#L35-L40RB
11/13/2021, 5:28 PMMarcin Mrotek
11/13/2021, 5:29 PMMarcin Mrotek
11/13/2021, 5:29 PMRB
11/13/2021, 5:29 PMRB
11/13/2021, 5:29 PM<http://main.tf|main.tf> file within that directoryRB
11/13/2021, 5:29 PM<http://main.tf|main.tf> should only consume the vpc moduleRB
11/13/2021, 5:30 PMMarcin Mrotek
11/13/2021, 5:30 PMRB
11/13/2021, 5:30 PMRB
11/13/2021, 5:31 PMMarcin Mrotek
11/13/2021, 5:37 PMMarcin Mrotek
11/13/2021, 5:39 PMMarcin Mrotek
11/13/2021, 5:46 PMRB
11/13/2021, 5:47 PMRB
11/13/2021, 5:47 PMMarcin Mrotek
11/13/2021, 6:01 PMRB
11/13/2021, 6:06 PMRB
11/13/2021, 6:06 PMMarcin Mrotek
11/13/2021, 6:08 PMMarcin Mrotek
11/13/2021, 6:09 PMMarcin Mrotek
11/13/2021, 6:09 PMRB
11/13/2021, 6:09 PMMarcin Mrotek
11/13/2021, 6:09 PMMarcin Mrotek
11/13/2021, 6:10 PMRB
11/13/2021, 6:10 PMand on the other hand the thing I also wanted to ask is how to enable ALB just for a single service rather than for all of themit depends on how you have it setup. are you using 1 ALB and multiple services via different listener arns ? or 1 ALB per service ?
Marcin Mrotek
11/13/2021, 6:10 PMRB
11/13/2021, 6:11 PMMarcin Mrotek
11/13/2021, 6:12 PMRB
11/13/2021, 6:12 PMRB
11/13/2021, 6:13 PMMarcin Mrotek
11/13/2021, 6:17 PMMarcin Mrotek
11/13/2021, 6:18 PM# Without authentication, both HTTP and HTTPS endpoints are supported
alb_ingress_unauthenticated_listener_arns = module.alb.listener_arns
alb_ingress_unauthenticated_listener_arns_count = 1
# All paths are unauthenticated
alb_ingress_unauthenticated_paths = ["/*"]
alb_ingress_listener_unauthenticated_priority = 100
on a module which use cloudposse/ecs-web-app/awsRB
11/13/2021, 6:18 PMRB
11/13/2021, 6:19 PMRB
11/13/2021, 6:19 PMRB
11/13/2021, 6:20 PMMarcin Mrotek
11/13/2021, 6:20 PMRB
11/13/2021, 6:20 PMMarcin Mrotek
11/13/2021, 6:21 PMRB
11/13/2021, 7:21 PMRB
11/13/2021, 7:21 PMRB
11/13/2021, 7:22 PMRB
11/13/2021, 7:22 PMRB
11/13/2021, 7:23 PM