Complete the code to specify the protocol for the target group.
resource "aws_lb_target_group" "example" { name = "example-tg" port = 80 protocol = "[1]" vpc_id = aws_vpc.main.id }
The protocol for a target group must be a supported load balancer protocol like HTTP.
Complete the code to set the health check path for the target group.
resource "aws_lb_target_group" "example" { name = "example-tg" port = 80 protocol = "HTTP" vpc_id = aws_vpc.main.id health_check { path = "[1]" } }
The health check path should be a URL path that returns a healthy status, commonly /healthcheck.
Fix the error in the target group configuration by selecting the correct target type.
resource "aws_lb_target_group" "example" { name = "example-tg" port = 80 protocol = "HTTP" vpc_id = aws_vpc.main.id target_type = "[1]" }
The correct target type for EC2 instances is 'instance'. 'instance-id' is invalid.
Fill both blanks to configure a target group with a sticky session and a timeout.
resource "aws_lb_target_group" "example" { name = "example-tg" port = 80 protocol = "HTTP" vpc_id = aws_vpc.main.id stickiness { enabled = [1] duration = [2] } }
Sticky sessions must be enabled with 'true' and duration is commonly set in seconds, e.g., 60.
Fill all three blanks to define a target group with a custom health check interval, timeout, and unhealthy threshold.
resource "aws_lb_target_group" "example" { name = "example-tg" port = 80 protocol = "HTTP" vpc_id = aws_vpc.main.id health_check { interval = [1] timeout = [2] unhealthy_threshold = [3] } }
Health check interval is often 30 seconds, timeout 5 seconds, and unhealthy threshold 3 failures.