Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Terraform module to create AWS Auto Scaling resources 🇺🇦

License

NotificationsYou must be signed in to change notification settings

terraform-aws-modules/terraform-aws-autoscaling

Terraform module which creates Auto Scaling resources on AWS.

SWUbanner

Available Features

  • Autoscaling group with launch template - either created by the module or utilizing an existing launch template
  • Autoscaling group utilizing mixed instances policy
  • Ability to configure autoscaling groups to set instance refresh configuration and add lifecycle hooks
  • Ability to create an autoscaling group that respectsdesired_capacity or one that ignores to allow for scaling without conflicting Terraform diffs
  • IAM role and instance profile creation

Usage

module"asg" {source="terraform-aws-modules/autoscaling/aws"# Autoscaling groupname="example-asg"min_size=0max_size=1desired_capacity=1wait_for_capacity_timeout=0health_check_type="EC2"vpc_zone_identifier=["subnet-1235678","subnet-87654321"]initial_lifecycle_hooks=[    {      name="ExampleStartupLifeCycleHook"      default_result="CONTINUE"      heartbeat_timeout=60      lifecycle_transition="autoscaling:EC2_INSTANCE_LAUNCHING"      notification_metadata=jsonencode({"hello" ="world" })    },    {      name="ExampleTerminationLifeCycleHook"      default_result="CONTINUE"      heartbeat_timeout=180      lifecycle_transition="autoscaling:EC2_INSTANCE_TERMINATING"      notification_metadata=jsonencode({"goodbye" ="world" })    }  ]instance_refresh={    strategy="Rolling"    preferences= {      checkpoint_delay=600      checkpoint_percentages= [35,70,100]      instance_warmup=300      min_healthy_percentage=50      max_healthy_percentage=100    }    triggers= ["tag"]  }# Launch templatelaunch_template_name="example-asg"launch_template_description="Launch template example"update_default_version=trueimage_id="ami-ebd02392"instance_type="t3.micro"ebs_optimized=trueenable_monitoring=true# IAM role & instance profilecreate_iam_instance_profile=trueiam_role_name="example-asg"iam_role_path="/ec2/"iam_role_description="IAM role example"iam_role_tags={    CustomIamRole="Yes"  }iam_role_policies={    AmazonSSMManagedInstanceCore="arn:aws:iam::aws:policy/AmazonSSMManagedInstanceCore"  }block_device_mappings=[    {# Root volume      device_name="/dev/xvda"      no_device=0      ebs= {        delete_on_termination=true        encrypted=true        volume_size=20        volume_type="gp2"      }    }, {      device_name="/dev/sda1"      no_device=1      ebs= {        delete_on_termination=true        encrypted=true        volume_size=30        volume_type="gp2"      }    }  ]capacity_reservation_specification={    capacity_reservation_preference="open"  }cpu_options={    core_count=1    threads_per_core=1  }credit_specification={    cpu_credits="standard"  }instance_market_options={    market_type="spot"    spot_options= {      block_duration_minutes=60    }  }# This will ensure imdsv2 is enabled, required, and a single hop which is aws security# best practices# See https://docs.aws.amazon.com/securityhub/latest/userguide/autoscaling-controls.html#autoscaling-4metadata_options={    http_endpoint="enabled"    http_tokens="required"    http_put_response_hop_limit=1  }network_interfaces=[    {      delete_on_termination=true      description="eth0"      device_index=0      security_groups= ["sg-12345678"]    },    {      delete_on_termination=true      description="eth1"      device_index=1      security_groups= ["sg-12345678"]    }  ]placement={    availability_zone="us-west-1b"  }tag_specifications=[    {      resource_type="instance"      tags= { WhatAmI="Instance" }    },    {      resource_type="volume"      tags= { WhatAmI="Volume" }    },    {      resource_type="spot-instances-request"      tags= { WhatAmI="SpotInstanceRequest" }    }  ]tags={    Environment="dev"    Project="megasecret"  }}

Conditional creation

The following combinations are supported to conditionally create resources and/or use externally created resources within the module:

Note: the default behavior of the module is to create an autoscaling group and launch template.

  • Disable resource creation (no resources created):
create=falsecreate_launch_template=false
  • Create only a launch template:
create=false
  • Create an autoscaling group using an externally created launch template:
create_launch_template=falselaunch_template=aws_launch_template.my_launch_template.name
  • Create an autoscaling group with a mixed instance policy:
use_mixed_instances_policy=true
  • Create the autoscaling policies:
scaling_policies={    my-policy= {      policy_type="TargetTrackingScaling"      target_tracking_configuration= {        predefined_metric_specification= {          predefined_metric_type="ASGAverageCPUUtilization"          resource_label="MyLabel"        }        target_value=50.0      }    }  }

Examples

  • Complete - Creates several variations of resources for autoscaling groups and launch templates.

Requirements

NameVersion
terraform>= 1.5.7
aws>= 6.0

Providers

NameVersion
aws>= 6.0

Modules

No modules.

Resources

NameType
aws_autoscaling_group.idcresource
aws_autoscaling_group.thisresource
aws_autoscaling_policy.thisresource
aws_autoscaling_schedule.thisresource
aws_autoscaling_traffic_source_attachment.thisresource
aws_iam_instance_profile.thisresource
aws_iam_role.thisresource
aws_iam_role_policy_attachment.thisresource
aws_launch_template.thisresource
aws_iam_policy_document.assume_role_policydata source
aws_partition.currentdata source

Inputs

NameDescriptionTypeDefaultRequired
autoscaling_group_tagsA map of additional tags to add to the autoscaling groupmap(string){}no
autoscaling_group_tags_not_propagate_at_launchA list of tag keys that should NOT be propagated to launched EC2 instanceslist(string)[]no
availability_zone_distributionA map of configuration for capacity distribution across availability zones
object({
capacity_distribution_strategy = optional(string)
})
nullno
availability_zonesA 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 thevpc_zone_identifier attribute, or for attaching a network interface when an existing network interface ID is specified in a launch template. Conflicts withvpc_zone_identifierlist(string)nullno
block_device_mappingsSpecify volumes to attach to the instance besides the volumes specified by the AMI
list(object({
device_name = optional(string)
ebs = optional(object({
delete_on_termination = optional(bool)
encrypted = optional(bool)
iops = optional(number)
kms_key_id = optional(string)
snapshot_id = optional(string)
throughput = optional(number)
volume_initialization_rate = optional(number)
volume_size = optional(number)
volume_type = optional(string)
}))
no_device = optional(string)
virtual_name = optional(string)
}))
nullno
capacity_rebalanceIndicates whether capacity rebalance is enabledboolnullno
capacity_reservation_specificationTargeting for EC2 capacity reservations
object({
capacity_reservation_preference = optional(string)
capacity_reservation_target = optional(object({
capacity_reservation_id = optional(string)
capacity_reservation_resource_group_arn = optional(string)
}))
})
nullno
contextReservedstringnullno
cpu_optionsThe CPU options for the instance
object({
amd_sev_snp = optional(string)
core_count = optional(number)
threads_per_core = optional(number)
})
nullno
createDetermines whether to create autoscaling group or notbooltrueno
create_iam_instance_profileDetermines whether an IAM instance profile is created or to use an existing IAM instance profileboolfalseno
create_launch_templateDetermines whether to create launch template or notbooltrueno
credit_specificationCustomize the credit specification of the instance
object({
cpu_credits = optional(string)
})
nullno
default_cooldownThe amount of time, in seconds, after a scaling activity completes before another scaling activity can startnumbernullno
default_instance_warmupAmount 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 that it takes for resource consumption to become stable after an instance reaches the InService state.numbernullno
default_versionDefault Version of the launch templatestringnullno
desired_capacityThe number of Amazon EC2 instances that should be running in the autoscaling groupnumbernullno
desired_capacity_typeThe unit of measurement for the value specified for desired_capacity. Supported for attribute-based instance type selection only. Valid values:units,vcpu,memory-mib.stringnullno
disable_api_stopIf true, enables EC2 instance stop protectionboolnullno
disable_api_terminationIf true, enables EC2 instance termination protectionboolnullno
ebs_optimizedIf true, the launched EC2 instance will be EBS-optimizedboolnullno
enable_monitoringEnables/disables detailed monitoringbooltrueno
enabled_metricsA list of metrics to collect. The allowed values areGroupDesiredCapacity,GroupInServiceCapacity,GroupPendingCapacity,GroupMinSize,GroupMaxSize,GroupInServiceInstances,GroupPendingInstances,GroupStandbyInstances,GroupStandbyCapacity,GroupTerminatingCapacity,GroupTerminatingInstances,GroupTotalCapacity,GroupTotalInstanceslist(string)[]no
enclave_optionsEnable Nitro Enclaves on launched instances
object({
enabled = optional(bool)
})
nullno
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 danglingboolnullno
force_delete_warm_poolAllows deleting the Auto Scaling Group without waiting for all instances in the warm pool to terminateboolnullno
health_check_grace_periodTime (in seconds) after instance comes into service before checking healthnumbernullno
health_check_typeEC2 orELB. Controls how health checking is donestringnullno
hibernation_optionsThe hibernation options for the instance
object({
configured = optional(bool)
})
nullno
iam_instance_profile_arnAmazon Resource Name (ARN) of an existing IAM instance profile. Used whencreate_iam_instance_profile =falsestringnullno
iam_instance_profile_nameThe name of the IAM instance profile to be created (create_iam_instance_profile =true) or existing (create_iam_instance_profile =false)stringnullno
iam_role_descriptionDescription of the rolestringnullno
iam_role_nameName to use on IAM role createdstringnullno
iam_role_pathIAM role pathstringnullno
iam_role_permissions_boundaryARN of the policy that is used to set the permissions boundary for the IAM rolestringnullno
iam_role_policiesIAM policies to attach to the IAM rolemap(string){}no
iam_role_tagsA map of additional tags to add to the IAM role createdmap(string){}no
iam_role_use_name_prefixDetermines whether the IAM role name (iam_role_name) is used as a prefixbooltrueno
ignore_desired_capacity_changesDetermines whether thedesired_capacity value is ignored after initial apply. See README note for more detailsboolfalseno
ignore_failed_scaling_activitiesWhether to ignore failed Auto Scaling scaling activities while waiting for capacity. The default is false -- failed scaling activities cause errors to be returned.boolfalseno
image_idThe AMI from which to launch the instancestringnullno
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 separateaws_autoscaling_lifecycle_hook resource, without theautoscaling_group_name attribute. Please note that this will only work when creating a new Auto Scaling Group. For all other use-cases, please useaws_autoscaling_lifecycle_hook resource
list(object({
default_result = optional(string)
heartbeat_timeout = optional(number)
lifecycle_transition = string
name = string
notification_metadata = optional(string)
notification_target_arn = optional(string)
role_arn = optional(string)
}))
nullno
instance_initiated_shutdown_behaviorShutdown behavior for the instance. Can bestop orterminate. (Default:stop)stringnullno
instance_maintenance_policyIf this block is configured, add a instance maintenance policy to the specified Auto Scaling group
object({
max_healthy_percentage = number
min_healthy_percentage = number
})
nullno
instance_market_optionsThe market (purchasing) option for the instance
object({
market_type = optional(string)
spot_options = optional(object({
block_duration_minutes = optional(number)
instance_interruption_behavior = optional(string)
max_price = optional(string)
spot_instance_type = optional(string)
valid_until = optional(string)
}))
})
nullno
instance_nameName that is propogated to launched EC2 instances via a tag - if not provided, defaults tovar.namestring""no
instance_refreshIf this block is configured, start an Instance Refresh when this Auto Scaling Group is updated
object({
preferences = optional(object({
alarm_specification = optional(object({
alarms = optional(list(string))
}))
auto_rollback = optional(bool)
checkpoint_delay = optional(number)
checkpoint_percentages = optional(list(number))
instance_warmup = optional(number)
max_healthy_percentage = optional(number)
min_healthy_percentage = optional(number)
scale_in_protected_instances = optional(string)
skip_matching = optional(bool)
standby_instances = optional(string)
}))
strategy = string
triggers = optional(list(string))
})
nullno
instance_requirementsThe attribute requirements for the type of instance. If present theninstance_type cannot be present
object({
accelerator_count = optional(object({
max = optional(number)
min = optional(number)
}))
accelerator_manufacturers = optional(list(string))
accelerator_names = optional(list(string))
accelerator_total_memory_mib = optional(object({
max = optional(number)
min = optional(number)
}))
accelerator_types = optional(list(string))
allowed_instance_types = optional(list(string))
bare_metal = optional(string)
baseline_ebs_bandwidth_mbps = optional(object({
max = optional(number)
min = optional(number)
}))
burstable_performance = optional(string)
cpu_manufacturers = optional(list(string))
excluded_instance_types = optional(list(string))
instance_generations = optional(list(string))
local_storage = optional(string)
local_storage_types = optional(list(string))
max_spot_price_as_percentage_of_optimal_on_demand_price = optional(number)
memory_gib_per_vcpu = optional(object({
max = optional(number)
min = optional(number)
}))
memory_mib = optional(object({
max = optional(number)
min = optional(number)
}))
network_bandwidth_gbps = optional(object({
max = optional(number)
min = optional(number)
}))
network_interface_count = optional(object({
max = optional(number)
min = optional(number)
}))
on_demand_max_price_percentage_over_lowest_price = optional(number)
require_hibernate_support = optional(bool)
spot_max_price_percentage_over_lowest_price = optional(number)
total_local_storage_gb = optional(object({
max = optional(number)
min = optional(number)
}))
vcpu_count = optional(object({
max = optional(number)
min = string
}))
})
nullno
instance_typeThe type of the instance. If present theninstance_requirements cannot be presentstringnullno
kernel_idThe kernel IDstringnullno
key_nameThe key name that should be used for the instancestringnullno
launch_template_descriptionDescription of the launch templatestringnullno
launch_template_idID of an existing launch template to be used (created outside of this module)stringnullno
launch_template_nameName of launch template to be createdstring""no
launch_template_tagsA map of additional tags to add to the launch templatemap(string){}no
launch_template_use_name_prefixDetermines whether to uselaunch_template_name as is or create a unique name beginning with thelaunch_template_name as the prefixbooltrueno
launch_template_versionLaunch template version. Can be version number,$Latest, or$Defaultstringnullno
license_specificationsA list of license specifications to associate with
list(object({
license_configuration_arn = string
}))
nullno
maintenance_optionsThe maintenance options for the instance
object({
auto_recovery = optional(string)
})
nullno
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 secondsnumbernullno
max_sizeThe maximum size of the autoscaling groupnumbernullno
metadata_optionsCustomize the metadata options for the instance
object({
http_endpoint = optional(string, "enabled")
http_protocol_ipv6 = optional(string)
http_put_response_hop_limit = optional(number, 1)
http_tokens = optional(string, "required")
instance_metadata_tags = optional(string)
})
{
"http_endpoint": "enabled",
"http_put_response_hop_limit": 1,
"http_tokens": "required"
}
no
metrics_granularityThe granularity to associate with the metrics to collect. The only valid value is1Minutestringnullno
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 changesnumbernullno
min_sizeThe minimum size of the autoscaling groupnumbernullno
mixed_instances_policyConfiguration block containing settings to define launch targets for Auto Scaling groups
object({
instances_distribution = optional(object({
on_demand_allocation_strategy = optional(string)
on_demand_base_capacity = optional(number)
on_demand_percentage_above_base_capacity = optional(number)
spot_allocation_strategy = optional(string)
spot_instance_pools = optional(number)
spot_max_price = optional(string)
}))
launch_template = object({
override = optional(list(object({
instance_requirements = optional(object({
accelerator_count = optional(object({
max = optional(number)
min = optional(number)
}))
accelerator_manufacturers = optional(list(string))
accelerator_names = optional(list(string))
accelerator_total_memory_mib = optional(object({
max = optional(number)
min = optional(number)
}))
accelerator_types = optional(list(string))
allowed_instance_types = optional(list(string))
bare_metal = optional(string)
baseline_ebs_bandwidth_mbps = optional(object({
max = optional(number)
min = optional(number)
}))
burstable_performance = optional(string)
cpu_manufacturers = optional(list(string))
excluded_instance_types = optional(list(string))
instance_generations = optional(list(string))
local_storage = optional(string)
local_storage_types = optional(list(string))
max_spot_price_as_percentage_of_optimal_on_demand_price = optional(number)
memory_gib_per_vcpu = optional(object({
max = optional(number)
min = optional(number)
}))
memory_mib = optional(object({
max = optional(number)
min = optional(number)
}))
network_bandwidth_gbps = optional(object({
max = optional(number)
min = optional(number)
}))
network_interface_count = optional(object({
max = optional(number)
min = optional(number)
}))
on_demand_max_price_percentage_over_lowest_price = optional(number)
require_hibernate_support = optional(bool)
spot_max_price_percentage_over_lowest_price = optional(number)
total_local_storage_gb = optional(object({
max = optional(number)
min = optional(number)
}))
vcpu_count = optional(object({
max = optional(number)
min = optional(number)
}))
}))
instance_type = optional(string)
launch_template_specification = optional(object({
launch_template_id = optional(string)
launch_template_name = optional(string)
version = optional(string)
}))
weighted_capacity = optional(string)
})))
})
})
nullno
nameName used across the resources createdstringn/ayes
network_interfacesCustomize network interfaces to be attached at instance boot time
list(object({
associate_carrier_ip_address = optional(bool)
associate_public_ip_address = optional(bool)
connection_tracking_specification = optional(object({
tcp_established_timeout = optional(number)
udp_stream_timeout = optional(number)
udp_timeout = optional(number)
}))
delete_on_termination = optional(bool)
description = optional(string)
device_index = optional(number)
ena_srd_specification = optional(object({
ena_srd_enabled = optional(bool)
ena_srd_udp_specification = optional(object({
ena_srd_udp_enabled = optional(bool)
}))
}))
interface_type = optional(string)
ipv4_address_count = optional(number)
ipv4_addresses = optional(list(string))
ipv4_prefix_count = optional(number)
ipv4_prefixes = optional(list(string))
ipv6_address_count = optional(number)
ipv6_addresses = optional(list(string))
ipv6_prefix_count = optional(number)
ipv6_prefixes = optional(list(string))
network_card_index = optional(number)
network_interface_id = optional(string)
primary_ipv6 = optional(bool)
private_ip_address = optional(string)
security_groups = optional(list(string), [])
subnet_id = optional(string)
}))
nullno
placementThe placement of the instance
object({
affinity = optional(string)
availability_zone = optional(string)
group_name = optional(string)
host_id = optional(string)
host_resource_group_arn = optional(string)
partition_number = optional(number)
spread_domain = optional(string)
tenancy = optional(string)
})
nullno
placement_groupThe name of the placement group into which you'll launch your instances, if anystringnullno
private_dns_name_optionsThe options for the instance hostname. The default values are inherited from the subnet
object({
enable_resource_name_dns_aaaa_record = optional(bool)
enable_resource_name_dns_a_record = optional(bool)
hostname_type = optional(string)
})
nullno
protect_from_scale_inAllows setting instance protection. The autoscaling group will not select instances with this setting for termination during scale in events.boolfalseno
putin_khuyloDo you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info:https://en.wikipedia.org/wiki/Putin_khuylo!booltrueno
ram_disk_idThe ID of the ram diskstringnullno
regionRegion where the resource(s) will be managed. Defaults to the Region set in the provider configurationstringnullno
scaling_policiesMap of target scaling policy schedule to create
map(object({
adjustment_type = optional(string)
cooldown = optional(number)
enabled = optional(bool)
estimated_instance_warmup = optional(number)
metric_aggregation_type = optional(string)
min_adjustment_magnitude = optional(number)
name = optional(string) # Will fall back to the map key if not provided
policy_type = optional(string)
predictive_scaling_configuration = optional(object({
max_capacity_breach_behavior = optional(string)
max_capacity_buffer = optional(number)
metric_specification = object({
customized_capacity_metric_specification = optional(object({
metric_data_queries = optional(list(object({
expression = optional(string)
id = string
label = optional(string)
metric_stat = optional(object({
metric = object({
dimensions = optional(list(object({
name = string
value = string
})))
metric_name = string
namespace = string
})
stat = string
unit = optional(string)
}))
return_data = optional(bool)
})))
}))
customized_load_metric_specification = optional(object({
metric_data_queries = optional(list(object({
expression = optional(string)
id = string
label = optional(string)
metric_stat = optional(object({
metric = object({
dimensions = optional(list(object({
name = string
value = string
})))
metric_name = string
namespace = string
})
stat = string
unit = optional(string)
}))
return_data = optional(bool)
})))
}))
customized_scaling_metric_specification = optional(object({
metric_data_queries = optional(list(object({
expression = optional(string)
id = string
label = optional(string)
metric_stat = optional(object({
metric = object({
dimensions = optional(list(object({
name = string
value = string
})))
metric_name = string
namespace = string
})
stat = string
unit = optional(string)
}))
return_data = optional(bool)
})))
}))
predefined_load_metric_specification = optional(object({
predefined_metric_type = string
resource_label = optional(string)
}))
predefined_metric_pair_specification = optional(object({
predefined_metric_type = string
resource_label = optional(string)
}))
predefined_scaling_metric_specification = optional(object({
predefined_metric_type = string
resource_label = optional(string)
}))
target_value = optional(number)
})
mode = optional(string)
scheduling_buffer_time = optional(number)
}))
scaling_adjustment = optional(number)
step_adjustment = optional(list(object({
metric_interval_lower_bound = optional(number)
metric_interval_upper_bound = optional(number)
scaling_adjustment = number
})))
target_tracking_configuration = optional(object({
customized_metric_specification = optional(object({
metric_dimension = optional(list(object({
name = string
value = string
})))
metric_name = optional(string)
metrics = optional(list(object({
expression = optional(string)
id = string
label = optional(string)
metric_stat = optional(object({
metric = object({
dimensions = optional(list(object({
name = string
value = string
})))
metric_name = string
namespace = string
})
period = optional(number)
stat = string
unit = optional(string)
}))
return_data = optional(bool)
})))
namespace = optional(string)
period = optional(number)
statistic = optional(string)
unit = optional(string)
}))
disable_scale_in = optional(bool)
predefined_metric_specification = optional(object({
predefined_metric_type = string
resource_label = optional(string)
}))
target_value = number
}))
}))
nullno
schedulesMap of autoscaling group schedule to create
map(object({
desired_capacity = optional(number)
end_time = optional(string)
max_size = optional(number)
min_size = optional(number)
recurrence = optional(string)
start_time = optional(string)
time_zone = optional(string)
}))
nullno
security_groupsA list of security group IDs to associatelist(string)[]no
service_linked_role_arnThe ARN of the service-linked role that the ASG will use to call other AWS servicesstringnullno
suspended_processesA list of processes to suspend for the Auto Scaling Group. The allowed values areLaunch,Terminate,HealthCheck,ReplaceUnhealthy,AZRebalance,AlarmNotification,ScheduledActions,AddToLoadBalancer,InstanceRefresh. Note that if you suspend either theLaunch orTerminate process types, it can prevent your Auto Scaling Group from functioning properlylist(string)[]no
tag_specificationsThe tags to apply to the resources during launch
list(object({
resource_type = optional(string)
tags = optional(map(string), {})
}))
nullno
tagsA map of tags to assign to resourcesmap(string){}no
termination_policiesA list of policies to decide how the instances in the Auto Scaling Group should be terminated. The allowed values areOldestInstance,NewestInstance,OldestLaunchConfiguration,ClosestToNextInstanceHour,OldestLaunchTemplate,AllocationStrategy,Defaultlist(string)[]no
timeoutsTimeout configurations for the autoscaling group
object({
delete = optional(string)
})
nullno
traffic_source_attachmentsMap of traffic source attachment definitions to create
map(object({
traffic_source_identifier = string
traffic_source_type = optional(string, "elbv2")
}))
nullno
update_default_versionWhether to update Default Version each update. Conflicts withdefault_versionboolnullno
use_mixed_instances_policyDetermines whether to use a mixed instances policy in the autoscaling group or notboolfalseno
use_name_prefixDetermines whether to usename as is or create a unique name beginning with thename as the prefixbooltrueno
user_dataThe Base64-encoded user data to provide when launching the instancestringnullno
vpc_zone_identifierA list of subnet IDs to launch resources in. Subnets automatically determine which availability zones the group will reside. Conflicts withavailability_zoneslist(string)nullno
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.stringnullno
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 overmin_elb_capacity behavior.numbernullno
warm_poolIf this block is configured, add a Warm Pool to the specified Auto Scaling group
object({
instance_reuse_policy = optional(object({
reuse_on_scale_in = optional(bool)
}))
max_group_prepared_capacity = optional(number)
min_size = optional(number)
pool_state = optional(string)
})
nullno

Outputs

NameDescription
autoscaling_group_arnThe ARN for this AutoScaling Group
autoscaling_group_availability_zonesThe availability zones of the autoscale group
autoscaling_group_default_cooldownTime between a scaling activity and the succeeding scaling activity
autoscaling_group_desired_capacityThe number of Amazon EC2 instances that should be running in the group
autoscaling_group_enabled_metricsList of metrics enabled for collection
autoscaling_group_health_check_grace_periodTime after instance comes into service before checking health
autoscaling_group_health_check_typeEC2 or ELB. Controls how health checking is done
autoscaling_group_idThe autoscaling group id
autoscaling_group_load_balancersThe load balancer names associated with the autoscaling group
autoscaling_group_max_sizeThe maximum size of the autoscale group
autoscaling_group_min_sizeThe minimum size of the autoscale group
autoscaling_group_nameThe autoscaling group name
autoscaling_group_target_group_arnsList of Target Group ARNs that apply to this AutoScaling Group
autoscaling_group_vpc_zone_identifierThe VPC zone identifier
autoscaling_policy_arnsARNs of autoscaling policies
autoscaling_schedule_arnsARNs of autoscaling group schedules
iam_instance_profile_arnARN assigned by AWS to the instance profile
iam_instance_profile_idInstance profile's ID
iam_instance_profile_uniqueStable and unique string identifying the IAM instance profile
iam_role_arnThe Amazon Resource Name (ARN) specifying the IAM role
iam_role_nameThe name of the IAM role
iam_role_unique_idStable and unique string identifying the IAM role
launch_template_arnThe ARN of the launch template
launch_template_default_versionThe default version of the launch template
launch_template_idThe ID of the launch template
launch_template_latest_versionThe latest version of the launch template
launch_template_nameThe name of the launch template

Notes

  • A refresh will not start iflaunch_template_version is set to$Latest when using an external launch template. To trigger the refresh when the external launch template is changed, set this tolatest_version of thataws_launch_template resource.

Authors

Module is maintained byAnton Babenko with help fromthese awesome contributors.

License

Apache 2 Licensed. SeeLICENSE for full details.

Additional information for users from Russia and Belarus

Sponsor this project

  •  

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp