Terraform module which creates Auto Scaling resources on AWS.
These types of resources are supported:
module "asg" { source = "terraform-aws-modules/autoscaling/aws" name = "service" # Launch configuration lc_name = "example-lc" image_id = "ami-ebd02392" instance_type = "t2.micro" security_groups = ["sg-12345678"] ebs_block_device = [ { device_name = "/dev/xvdz" volume_type = "gp2" volume_size = "50" delete_on_termination = true }, ] root_block_device = [ { volume_size = "50" volume_type = "gp2" }, ] # Auto scaling group asg_name = "example-asg" vpc_zone_identifier = ["subnet-1235678", "subnet-87654321"] health_check_type = "EC2" min_size = 0 max_size = 1 desired_capacity = 1 wait_for_capacity_timeout = 0 tags = [ { key = "Environment" value = "dev" propagate_at_launch = true }, { key = "Project" value = "megasecret" propagate_at_launch = true }, ] }Normally this module creates both Auto Scaling Group (ASG) and Launch Configuration (LC), and connect them together. It is possible to customize this behaviour passing different parameters to this module:
- To create ASG, but not LC. Associate ASG with an existing LC:
create_lc = false launch_configuration = "existing-launch-configuration"- To create LC, but not ASG. Outputs may produce errors.
create_asg = false- To disable creation of both resources (LC and ASG) you can specify both arguments
create_lc = falseandcreate_asg = false. Sometimes you need to use this way to create resources in modules conditionally but Terraform does not allow to usecountinsidemoduleblock.
Module managed by Anton Babenko.
Apache 2 Licensed. See LICENSE for full details.