Hello Guys,
When running the terraform plan
command, my Terraform environment encountered an issue with the terraform-aws-modules/alb/aws module. The specific error is as follows:
Error: Unsupported attribute
on .terraform/modules/its_alb/main.tf line 527, in resource "aws_lb_target_group_attachment" "this":
527: target_id = each.value.target_id
├────────────────
│ each.value is object with 4 attributes
This object does not have an attribute named "target_id".
Scenario:
I am using version 9.4.1 of the AWS ALB module, and when creating instances of type aws_lb_target_group_attachment
according to the module documentation, I am facing difficulties due to the mentioned error.
my terraform code alb.tf:
module "its_alb" {
source = "terraform-aws-modules/alb/aws"
version = "9.4.1"
name = "its-alb"
subnets = module.its_vpc_us_east_2.private_subnets
create_security_group = false
security_groups = [module.its_alb_sg.security_group_id]
vpc_id = module.its_vpc_us_east_2.vpc_id
listeners = {
http-https-redirect = {
port = 80
protocol = "HTTP"
redirect = {
port = "443"
protocol = "HTTPS"
status_code = "HTTP_301"
}
}
https_listeners = {
port = 443
protocol = "HTTPS"
certificate_arn = aws_acm_certificate.cert.arn
forward = {
target_groups_key = "ex-target"
}
}
}
target_groups = {
ex-target = {
name_prefix = "its-"
backend_protocol = "HTTP"
backend_port = var.http_port
target_type = "ip"
health_check = {
enabled = true
interval = 30
path = "/"
port = var.http_port
healthy_threshold = 5
unhealthy_threshold = 2
timeout = 5
protocol = "HTTP"
matcher = "200"
}
}
}
}
Steps Taken So Far:
- Checked the module documentation, and the syntax used is according to the guidelines.
- Confirmed that subnets and security groups are correct and accessible.
Request for Help:
- Has anyone encountered this issue before, or does anyone have any suggestions on how to resolve it?
- Is there any additional configuration that may be required?
I appreciate any guidance or assistance you can provide.
Thank you