Module library

EC2 Auto Scaling

Terraform module to create AWS Auto Scaling resources

Inputs

40 / 96
namerequiredstring

Name used across the resources created

autoscaling_group_tagsoptionalmap(string)

A map of additional tags to add to the autoscaling group

Default{}
autoscaling_group_tags_not_propagate_at_launchoptionallist(string)

A list of tag keys that should NOT be propagated to launched EC2 instances

Default[]
availability_zone_distributionoptionalobject({ capacity_distribution_strategy = optional(string) })

A map of configuration for capacity distribution across availability zones

Defaultnull
availability_zonesoptionallist(string)

A list of Availability Zones where instances in the Auto Scaling group can be created. Used for launching into the default VPC subnet in each Availability Zone when not using the `vpc_zone_identifier` attribute, or for attaching a network interface when an existing network interface ID is specified …

Defaultnull
block_device_mappingsoptionallist(object({ device_name = optional(string) ebs = optional(object({ delete_on_t…

Specify volumes to attach to the instance besides the volumes specified by the AMI

Defaultnull
capacity_rebalanceoptionalbool

Indicates whether capacity rebalance is enabled

Defaultnull
capacity_reservation_specificationoptionalobject({ capacity_reservation_preference = optional(string) capacity_reservation…

Targeting for EC2 capacity reservations

Defaultnull
contextoptionalstring

Reserved

Defaultnull
cpu_optionsoptionalobject({ amd_sev_snp = optional(string) core_count = optional(number) nested_vir…

The CPU options for the instance

Defaultnull
createoptionalbool

Determines whether to create autoscaling group or not

Defaulttrue
create_iam_instance_profileoptionalbool

Determines whether an IAM instance profile is created or to use an existing IAM instance profile

Defaultfalse
create_launch_templateoptionalbool

Determines whether to create launch template or not

Defaulttrue
credit_specificationoptionalobject({ cpu_credits = optional(string) })

Customize the credit specification of the instance

Defaultnull
default_cooldownoptionalnumber

The amount of time, in seconds, after a scaling activity completes before another scaling activity can start

Defaultnull
default_instance_warmupoptionalnumber

Amount of time, in seconds, until a newly launched instance can contribute to the Amazon CloudWatch metrics. This delay lets an instance finish initializing before Amazon EC2 Auto Scaling aggregates instance metrics, resulting in more reliable usage data. Set this value equal to the amount of time t…

Defaultnull
default_versionoptionalstring

Default Version of the launch template

Defaultnull
desired_capacityoptionalnumber

The number of Amazon EC2 instances that should be running in the autoscaling group

Defaultnull
desired_capacity_typeoptionalstring

The unit of measurement for the value specified for desired_capacity. Supported for attribute-based instance type selection only. Valid values: `units`, `vcpu`, `memory-mib`.

Defaultnull
disable_api_stopoptionalbool

If true, enables EC2 instance stop protection

Defaultnull
disable_api_terminationoptionalbool

If true, enables EC2 instance termination protection

Defaultnull
ebs_optimizedoptionalbool

If true, the launched EC2 instance will be EBS-optimized

Defaultnull
enable_monitoringoptionalbool

Enables/disables detailed monitoring

Defaulttrue
enabled_metricsoptionallist(string)

A list of metrics to collect. The allowed values are `GroupDesiredCapacity`, `GroupInServiceCapacity`, `GroupPendingCapacity`, `GroupMinSize`, `GroupMaxSize`, `GroupInServiceInstances`, `GroupPendingInstances`, `GroupStandbyInstances`, `GroupStandbyCapacity`, `GroupTerminatingCapacity`, `GroupTermin…

Default[]
enclave_optionsoptionalobject({ enabled = optional(bool) })

Enable Nitro Enclaves on launched instances

Defaultnull
force_deleteoptionalbool

Allows 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 …

Defaultnull
force_delete_warm_pooloptionalbool

Allows deleting the Auto Scaling Group without waiting for all instances in the warm pool to terminate

Defaultnull
health_check_grace_periodoptionalnumber

Time (in seconds) after instance comes into service before checking health

Defaultnull
health_check_typeoptionalstring

`EC2` or `ELB`. Controls how health checking is done

Defaultnull
hibernation_optionsoptionalobject({ configured = optional(bool) })

The hibernation options for the instance

Defaultnull
iam_instance_profile_arnoptionalstring

Amazon Resource Name (ARN) of an existing IAM instance profile. Used when `create_iam_instance_profile` = `false`

Defaultnull
iam_instance_profile_nameoptionalstring

The name of the IAM instance profile to be created (`create_iam_instance_profile` = `true`) or existing (`create_iam_instance_profile` = `false`)

Defaultnull
iam_role_descriptionoptionalstring

Description of the role

Defaultnull
iam_role_nameoptionalstring

Name to use on IAM role created

Defaultnull
iam_role_pathoptionalstring

IAM role path

Defaultnull
iam_role_permissions_boundaryoptionalstring

ARN of the policy that is used to set the permissions boundary for the IAM role

Defaultnull
iam_role_policiesoptionalmap(string)

IAM policies to attach to the IAM role

Default{}
iam_role_tagsoptionalmap(string)

A map of additional tags to add to the IAM role created

Default{}
iam_role_use_name_prefixoptionalbool

Determines whether the IAM role name (`iam_role_name`) is used as a prefix

Defaulttrue
ignore_desired_capacity_changesoptionalbool

Determines whether the `desired_capacity` value is ignored after initial apply. See README note for more details

Defaultfalse

1 of 96 must be supplied; the rest have defaults. Showing 40, so the site stays a static download — the remaining 56 are in the source.

Outputs

27
autoscaling_group_arn

The ARN for this AutoScaling Group

autoscaling_group_availability_zones

The availability zones of the autoscale group

autoscaling_group_default_cooldown

Time between a scaling activity and the succeeding scaling activity

autoscaling_group_desired_capacity

The number of Amazon EC2 instances that should be running in the group

autoscaling_group_enabled_metrics

List of metrics enabled for collection

autoscaling_group_health_check_grace_period

Time after instance comes into service before checking health

autoscaling_group_health_check_type

EC2 or ELB. Controls how health checking is done

autoscaling_group_id

The autoscaling group id

autoscaling_group_load_balancers

The load balancer names associated with the autoscaling group

autoscaling_group_max_size

The maximum size of the autoscale group

autoscaling_group_min_size

The minimum size of the autoscale group

autoscaling_group_name

The autoscaling group name

autoscaling_group_target_group_arns

List of Target Group ARNs that apply to this AutoScaling Group

autoscaling_group_vpc_zone_identifier

The VPC zone identifier

autoscaling_policy_arns

ARNs of autoscaling policies

autoscaling_schedule_arns

ARNs of autoscaling group schedules

iam_instance_profile_arn

ARN assigned by AWS to the instance profile

iam_instance_profile_id

Instance profile's ID

iam_instance_profile_unique

Stable and unique string identifying the IAM instance profile

iam_role_arn

The Amazon Resource Name (ARN) specifying the IAM role

iam_role_name

The name of the IAM role

iam_role_unique_id

Stable and unique string identifying the IAM role

launch_template_arn

The ARN of the launch template

launch_template_default_version

The default version of the launch template

launch_template_id

The ID of the launch template

launch_template_latest_version

The latest version of the launch template

launch_template_name

The name of the launch template

What the agent wires into the next module. An edge on the architecture diagram is one of these consumed by something else.