If you have any questions regarding this upgrade process, please consult the examples
directory:
v4.x
to v5.x
. For instructions on upgrading to v4.x
first, please see UPGRADE-4.0.md.
If you find a bug, please open an issue with supporting configuration to reproduce.
- Launch configuration support has been removed. AWS has stated that launch configurations will no longer receive updates and that launch templates should be used since they are the successor.
- A second autoscaling group
idc
(ignore desired capacity) has been added to allow users to utilize an autoscaling group that will ignore changes todesired_capacity
var.tags
was previously a list of maps ofkey
,value
, andpropagate_at_launch
. It has been changed to a standard map ofkey
=value
pairs- The use of
for_each = lookup(map.value, "attr", null) != null ? [map.value.attr] : []
pattern has been replaced with a more concise, readable pattern offor_each = can(map.value.attr) ? [map.value.attr] : []
. This is a no-op change for users
-
Removed variables:
propagate_name
tags_as_map
(usetags
instead)use_lt
-> this is now the default; only launch templates are supportedlaunch_configuration
create_lc
use_lc
lc_name
lc_use_name_prefix
user_data
associate_public_ip_address
spot_price
placement_tenancy
ebs_block_device
ephemeral_block_device
root_block_device
-
Renamed variables:
create_asg
->create
create_lt
->create_launch_template
lt_name
->launch_template_name
lt_use_name_prefix
->launch_template_use_name_prefix
lt_version
->launch_template_version
-
Added variables:
ignore_desired_capacity_changes
-> to flip between using a standard autoscaling group that respectsdesired_capacity
setting or one that ignores
-
Removed outputs:
launch_configuration_id
launch_configuration_arn
launch_configuration_name
-
Renamed outputs:
- None
-
Added outputs:
- None
module "asg" {
source = "terraform-aws-modules/autoscaling/aws"
version = "~> 4.0"
# Autoscaling group
name = "example-asg"
min_size = 0
max_size = 1
desired_capacity = 1
health_check_type = "EC2"
vpc_zone_identifier = ["subnet-1235678", "subnet-87654321"]
# Launch template
lt_name = "example-asg"
description = "Launch template example"
update_default_version = true
use_lt = true
create_lt = true
image_id = "ami-ebd02392"
instance_type = "t3.micro"
tags_as_map = {
extra_tag1 = "extra_value1"
extra_tag2 = "extra_value2"
}
}
module "asg" {
source = "terraform-aws-modules/autoscaling/aws"
version = "~> 5.0"
# Autoscaling group
name = "example-asg"
min_size = 0
max_size = 1
desired_capacity = 1
health_check_type = "EC2"
vpc_zone_identifier = ["subnet-1235678", "subnet-87654321"]
# Launch template
launch_template_name = "example-asg"
launch_template_description = "Launch template example"
update_default_version = true
image_id = "ami-ebd02392"
instance_type = "t3.micro"
tags = {
extra_tag1 = "extra_value1"
extra_tag2 = "extra_value2"
}
}
There are no required state changes to migrate from v4.x
to v5.x
. If you are using launch configuration support, you can continue to do so with the v4.x
version pinned or evaluate switching to a new autoscaling group that is backed by launch templates.
If you wish to opt into the new feature ignore_desired_capacity_changes
, you can perform the following state mv commands on your group(s) if desired:
ℹ️ Be sure to add the ignore_desired_capacity_changes = true
to your configuration.
terraform state mv 'module.<xxx>.aws_autoscaling_group.this[0]' 'module.<xxx>.aws_autoscaling_group.idc[0]'
For example, if you previously had a configuration such as (truncated for brevity):
module "example" {
source = "terraform-aws-modules/autoscaling/aws"
version = "~> 4.x"
# <your configs>
}
After updating the configuration to the latest v5.x
changes:
module "example" {
source = "terraform-aws-modules/autoscaling/aws"
version = "~> 5.x"
# <your configs>
ignore_desired_capacity_changes = true
}
The associated Terraform state move command would be:
terraform state mv 'module.example.aws_autoscaling_group.this[0]' 'module.example.aws_autoscaling_group.idc[0]'