Complete the code to specify the launch configuration name in the Auto Scaling group.
resource "aws_autoscaling_group" "example" { launch_configuration = "[1]" min_size = 1 max_size = 3 vpc_zone_identifier = ["subnet-12345678"] }
The launch_configuration property must be set to the name of the launch configuration resource.
Complete the code to attach the Elastic Load Balancer to the Auto Scaling group.
resource "aws_autoscaling_group" "example" { launch_configuration = "my_launch_config" min_size = 1 max_size = 3 vpc_zone_identifier = ["subnet-12345678"] [1] = ["my-elb"] }
target_group_arns for classic ELB attachment.The load_balancers property attaches classic ELBs to the Auto Scaling group.
Fix the error in the Auto Scaling group resource by completing the missing property for health check type.
resource "aws_autoscaling_group" "example" { launch_configuration = "my_launch_config" min_size = 1 max_size = 3 vpc_zone_identifier = ["subnet-12345678"] load_balancers = ["my-elb"] health_check_type = "[1]" }
When using an ELB, the health_check_type should be set to ELB to use the load balancer's health checks.
Fill both blanks to configure the Auto Scaling group with desired capacity and termination policies.
resource "aws_autoscaling_group" "example" { launch_configuration = "my_launch_config" min_size = 1 max_size = 3 desired_capacity = [1] termination_policies = ["[2]"] vpc_zone_identifier = ["subnet-12345678"] load_balancers = ["my-elb"] health_check_type = "ELB" }
The desired_capacity sets how many instances should run, here 2. The termination_policies define which instances to terminate first; OldestInstance is a common choice.
Fill all three blanks to define a launch configuration with AMI, instance type, and associate it with a security group.
resource "aws_launch_configuration" "my_launch_config" { name_prefix = "example-" image_id = "[1]" instance_type = "[2]" security_groups = ["[3]"] }
The image_id is the AMI ID to launch instances from. The instance_type defines the size of the instance. The security_groups list controls network access.