In Terraform
How can register known private ip addresses in target group of type "ip". Below is my current code.
resource "aws_alb_target_group" "default" {
name = "target group name"
port = var.container_port
protocol = "HTTP"
target_type = "ip"
vpc_id = data.terraform_remote_state.network.outputs.vpc_id
health_check {
path = var.health_check_path
protocol = "HTTP"
port = var.target_group_port
interval = 60
}
tags = var.tags
}
You use aws_lb_target_group_attachment for that.
For example:
resource "aws_lb_target_group_attachment" "test" {
target_group_arn = aws_alb_target_group.default.arn
target_id = instance-ip-address
port = 80
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With