Complete the code to specify the minimum size of the Auto Scaling group.
resource "aws_autoscaling_group" "example" { name = "example-asg" max_size = 3 min_size = [1] desired_capacity = 2 launch_configuration = aws_launch_configuration.example.id vpc_zone_identifier = ["subnet-12345678"] }
The min_size defines the minimum number of instances the Auto Scaling group maintains. Setting it to 1 ensures at least one instance is always running.
Complete the code to attach the Auto Scaling group to the correct subnet.
resource "aws_autoscaling_group" "example" { name = "example-asg" max_size = 3 min_size = 1 desired_capacity = 2 launch_configuration = aws_launch_configuration.example.id vpc_zone_identifier = ["[1]"] }
The vpc_zone_identifier specifies the subnet IDs where instances will launch. Using the correct subnet ID ensures instances are placed in the right network.
Fix the error in the launch configuration reference.
resource "aws_autoscaling_group" "example" { name = "example-asg" max_size = 3 min_size = 1 desired_capacity = 2 launch_configuration = [1] vpc_zone_identifier = ["subnet-12345678"] }
The launch_configuration property requires the ID of the launch configuration resource, not the resource object itself or other attributes.
Fill both blanks to set the health check type and grace period correctly.
resource "aws_autoscaling_group" "example" { name = "example-asg" max_size = 3 min_size = 1 desired_capacity = 2 launch_configuration = aws_launch_configuration.example.id vpc_zone_identifier = ["subnet-12345678"] health_check_type = "[1]" health_check_grace_period = [2] }
The health_check_type set to ELB means the Auto Scaling group uses the Elastic Load Balancer health checks. The health_check_grace_period of 300 seconds allows instances time to start before health checks begin.
Fill all three blanks to configure tags with propagation correctly.
resource "aws_autoscaling_group" "example" { name = "example-asg" max_size = 3 min_size = 1 desired_capacity = 2 launch_configuration = aws_launch_configuration.example.id vpc_zone_identifier = ["subnet-12345678"] tag { key = "Name" value = "example-instance" propagate_at_launch = [1] } tag { key = "Environment" value = "production" propagate_at_launch = [2] } tag { key = "Team" value = "devops" propagate_at_launch = [3] } }
The propagate_at_launch flag controls whether tags are applied to instances launched by the Auto Scaling group. Setting it to true applies the tag to instances, false does not.