Skip to main content
Version: Next



Terraform module which creates Auto Scaling resources on AWS



autoscaling_group_tagsA map of additional tags to add to the autoscaling groupmap(string)false
availability_zonesA list of one or more availability zones for the group. Used for EC2-Classic and default subnets when not specified with vpc_zone_identifier argument. Conflicts with vpc_zone_identifierlist(string)false
block_device_mappingsSpecify volumes to attach to the instance besides the volumes specified by the AMIlist(any)false
capacity_rebalanceIndicates whether capacity rebalance is enabledboolfalse
capacity_reservation_specificationTargeting for EC2 capacity reservationsanyfalse
cpu_optionsThe CPU options for the instancemap(string)false
createDetermines whether to create autoscaling group or notboolfalse
create_launch_templateDetermines whether to create launch template or notboolfalse
create_scaling_policyDetermines whether to create target scaling policy schedule or notboolfalse
create_scheduleDetermines whether to create autoscaling group schedule or notboolfalse
credit_specificationCustomize the credit specification of the instancemap(string)false
default_cooldownThe amount of time, in seconds, after a scaling activity completes before another scaling activity can startnumberfalse
default_versionDefault Version of the launch templatestringfalse
delete_timeoutDelete timeout to wait for destroying autoscaling groupstringfalse
desired_capacityThe number of Amazon EC2 instances that should be running in the autoscaling groupnumberfalse
disable_api_terminationIf true, enables EC2 instance termination protectionboolfalse
ebs_optimizedIf true, the launched EC2 instance will be EBS-optimizedboolfalse
elastic_gpu_specificationsThe elastic GPU to attach to the instancemap(string)false
elastic_inference_acceleratorConfiguration block containing an Elastic Inference Accelerator to attach to the instancemap(string)false
enable_monitoringEnables/disables detailed monitoringboolfalse
enabled_metricsA list of metrics to collect. The allowed values are GroupDesiredCapacity, GroupInServiceCapacity, GroupPendingCapacity, GroupMinSize, GroupMaxSize, GroupInServiceInstances, GroupPendingInstances, GroupStandbyInstances, GroupStandbyCapacity, GroupTerminatingCapacity, GroupTerminatingInstances, GroupTotalCapacity, GroupTotalInstanceslist(string)false
enclave_optionsEnable Nitro Enclaves on launched instancesmap(string)false
force_deleteAllows deleting the Auto Scaling Group without waiting for all instances in the pool to terminate. You can force an Auto Scaling Group to delete even if it's in the process of scaling a resource. Normally, Terraform drains all the instances before deleting the group. This bypasses that behavior and potentially leaves resources danglingboolfalse
health_check_grace_periodTime (in seconds) after instance comes into service before checking healthnumberfalse
health_check_typeEC2 or ELB. Controls how health checking is donestringfalse
hibernation_optionsThe hibernation options for the instancemap(string)false
iam_instance_profile_arnThe IAM Instance Profile ARN to launch the instance withstringfalse
iam_instance_profile_nameThe name attribute of the IAM instance profile to associate with launched instancesstringfalse
ignore_desired_capacity_changesDetermines whether the desired_capacity value is ignored after initial apply. See README note for more detailsboolfalse
image_idThe AMI from which to launch the instancestringfalse
initial_lifecycle_hooksOne or more Lifecycle Hooks to attach to the Auto Scaling Group before instances are launched. The syntax is exactly the same as the separate aws_autoscaling_lifecycle_hook resource, without the autoscaling_group_name attribute. Please note that this will only work when creating a new Auto Scaling Group. For all other use-cases, please use aws_autoscaling_lifecycle_hook resourcelist(map(string))false
instance_initiated_shutdown_behaviorShutdown behavior for the instance. Can be stop or terminate. (Default: stop)stringfalse
instance_market_optionsThe market (purchasing) option for the instanceanyfalse
instance_nameName that is propogated to launched EC2 instances via a tag - if not provided, defaults to var.namestringfalse
instance_refreshIf this block is configured, start an Instance Refresh when this Auto Scaling Group is updatedanyfalse
instance_typeThe type of the instance to launchstringfalse
kernel_idThe kernel IDstringfalse
key_nameThe key name that should be used for the instancestringfalse
launch_templateName of an existing launch template to be used (created outside of this module)stringfalse
launch_template_descriptionDescription of the launch templatestringfalse
launch_template_nameName of launch template to be createdstringfalse
launch_template_use_name_prefixDetermines whether to use launch_template_name as is or create a unique name beginning with the launch_template_name as the prefixboolfalse
launch_template_versionLaunch template version. Can be version number, $Latest, or $Defaultstringfalse
license_specificationsA list of license specifications to associate withmap(string)false
load_balancersA list of elastic load balancer names to add to the autoscaling group names. Only valid for classic load balancers. For ALBs, use target_group_arns insteadlist(string)false
max_instance_lifetimeThe maximum amount of time, in seconds, that an instance can be in service, values must be either equal to 0 or between 86400 and 31536000 secondsnumberfalse
max_sizeThe maximum size of the autoscaling groupnumberfalse
metadata_optionsCustomize the metadata options for the instancemap(string)false
metrics_granularityThe granularity to associate with the metrics to collect. The only valid value is 1Minutestringfalse
min_elb_capacitySetting this causes Terraform to wait for this number of instances to show up healthy in the ELB only on creation. Updates will not wait on ELB instance number changesnumberfalse
min_sizeThe minimum size of the autoscaling groupnumberfalse
mixed_instances_policyConfiguration block containing settings to define launch targets for Auto Scaling groupsanyfalse
nameName used across the resources createdstringtrue
network_interfacesCustomize network interfaces to be attached at instance boot timelist(any)false
placementThe placement of the instancemap(string)false
placement_groupThe name of the placement group into which you'll launch your instances, if anystringfalse
private_dns_name_optionsThe options for the instance hostname. The default values are inherited from the subnetmap(string)false
protect_from_scale_inAllows setting instance protection. The autoscaling group will not select instances with this setting for termination during scale in events.boolfalse
putin_khuyloDo you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info:!boolfalse
ram_disk_idThe ID of the ram diskstringfalse
scaling_policiesMap of target scaling policy schedule to createanyfalse
schedulesMap of autoscaling group schedule to createmap(any)false
security_groupsA list of security group IDs to associatelist(string)false
service_linked_role_arnThe ARN of the service-linked role that the ASG will use to call other AWS servicesstringfalse
suspended_processesA list of processes to suspend for the Auto Scaling Group. The allowed values are Launch, Terminate, HealthCheck, ReplaceUnhealthy, AZRebalance, AlarmNotification, ScheduledActions, AddToLoadBalancer. Note that if you suspend either the Launch or Terminate process types, it can prevent your Auto Scaling Group from functioning properlylist(string)false
tag_specificationsThe tags to apply to the resources during launchlist(any)false
tagsA map of tags to assign to resourcesmap(string)false
target_group_arnsA set of aws_alb_target_group ARNs, for use with Application or Network Load Balancinglist(string)false
termination_policiesA list of policies to decide how the instances in the Auto Scaling Group should be terminated. The allowed values are OldestInstance, NewestInstance, OldestLaunchConfiguration, ClosestToNextInstanceHour, OldestLaunchTemplate, AllocationStrategy, Defaultlist(string)false
update_default_versionWhether to update Default Version each update. Conflicts with default_versionstringfalse
use_mixed_instances_policyDetermines whether to use a mixed instances policy in the autoscaling group or notboolfalse
use_name_prefixDetermines whether to use name as is or create a unique name beginning with the name as the prefixboolfalse
user_dataThe Base64-encoded user data to provide when launching the instancestringfalse
vpc_zone_identifierA list of subnet IDs to launch resources in. Subnets automatically determine which availability zones the group will reside. Conflicts with availability_zoneslist(string)false
wait_for_capacity_timeoutA maximum duration that Terraform should wait for ASG instances to be healthy before timing out. (See also Waiting for Capacity below.) Setting this to '0' causes Terraform to skip all Capacity Waiting behavior.stringfalse
wait_for_elb_capacitySetting this will cause Terraform to wait for exactly this number of healthy instances in all attached load balancers on both create and update operations. Takes precedence over min_elb_capacity behavior.numberfalse
warm_poolIf this block is configured, add a Warm Pool to the specified Auto Scaling groupmap(string)false
writeConnectionSecretToRefThe secret which the cloud resource connection will be written towriteConnectionSecretToReffalse


nameThe secret name which the cloud resource connection will be written tostringtrue
namespaceThe secret namespace which the cloud resource connection will be written tostringfalse