Terraform module to provision Auto Scaling Group and Launch Template on AWS
In my other PR for terraform ECS component I changed the default value of variable that is being passed here. Without this change terraform will complain that there is no such field as instances_distribution/override
NOTE: This PR must be merged first and then I will change version of ASG component in ECS component
Version v0.36.0
does not work with AWS Provider 4.X.
In PR #121 of v0.36.0
, the preference key scale_in_protected_instances
, which had been available only since AWS Provider 5.16.0
introduced by PR#33310, was added. That basically upgrades the required AWS provider version to 5.16.0+
.
We will get errors like the below while planning with AWS provider <5.16.0
:
│ Error: Unsupported argument
│
│ on .terraform/modules/autoscale_group/main.tf line 187, in resource "aws_autoscaling_group" "default":
│ 187: scale_in_protected_instances = lookup(preferences.value, "scale_in_protected_instances", null)
│
│ An argument named "scale_in_protected_instances" is not expected here.
Version v0.36.0
does not work with AWS Provider 4.X.
In PR #121 of v0.36.0
, the preference key scale_in_protected_instances
, which had been available only since AWS Provider 5.16.0
introduced by PR#33310, was added. That basically upgrades the required AWS provider version to 5.16.0+
.
We will get errors like the below while planning with AWS provider <5.16.0
:
│ Error: Unsupported argument
│
│ on .terraform/modules/autoscale_group/main.tf line 187, in resource "aws_autoscaling_group" "default":
│ 187: scale_in_protected_instances = lookup(preferences.value, "scale_in_protected_instances", null)
│
│ An argument named "scale_in_protected_instances" is not expected here.
Fix 0.37.0
│ Error: Invalid value for input variable
│
│ on main.tf line 125, in module "autoscale_group":
│ 125: block_device_mappings = var.block_device_mappings
│
│ The given value is not suitable for
│ module.autoscale_group.var.block_device_mappings declared at
│ .terraform/modules/autoscale_group/variables.tf:72,1-33: incorrect list
│ element type: attribute "ebs": attribute "throughput" is required.
╵
As per the code in main.tf, all these stuff are optional
https://github.com/cloudposse/terraform-aws-ec2-autoscale-group/pull/97
This PR contains the following updates:
Package | Type | Update | Change |
---|---|---|---|
cloudposse/dynamic-subnets/aws (source) | module | minor | 2.3.0 -> 2.4.1 |
v2.4.1
v2.4.0
With this release, EIPs allocated for NAT ingress are allocated in the default domain. This most likely does not affect you, but for accounts created before 2013-12-04 (almost 10 years ago as of this writing), the default domain could be EC2-Classic rather than the current VPC. Previously this module forced the EIPs to be in the VPC domain, but the breaking changes between AWS Provider v4 and v5 make that difficult.
If you find yourself in the rare situation where the EIPs allocated by this module are in EC2-Classic but you want them in VPC, then create the EIPs outside of this module and supply them to this module via nat_elastic_ips
.
This release includes an example (examples/nacls/
) showing how to create custom NACLs in conjunction with this module. Note that by default, this module creates wide-open NACLs, and subnets can only have one NACL associated with them. If you try to add a NACL to a subnet without disabling the default NACLs, you may get a possibly confusing error like:
│ Error: creating EC2 Network ACL: creating EC2 Network ACL (acl-0376c5f12dd9d784d) Association: InvalidAssociationID.NotFound: The association ID 'aclassoc-0818d5a9e3876a2bb' does not exist
See https://github.com/hashicorp/terraform-provider-aws/issues/31888
null
as meaning "default")aws_eip
vpc = true
This PR adds two missing properties to the instance_refresh stanza.
Right now there is no way to configure scale_in_protected_instances and standby_instances in the instance refresh stanza.
This solves: #120
Adds skip_matching
and auto_rollback
to the instance refresh preferences.
Allows the instance refresh preferences to be optional. If the values are not set in the calling module, then the default values are used as per:
Previously it was not possible to set the skip_matching
and auto_rollback
.
It was also not possible to omit preferences from the calling module and just use the defaults instead.
With this change we can now set preferences and/or omit preferences that we wish to use the defaults for.
The change should not cause any diffs in current infrastructure.
It is now possible to use something such as this to use defaults:
instance_refresh = ({
strategy = "Rolling"
})
or this to override certain defaults:
instance_refresh = ({
strategy = "Rolling"
preferences = ({
min_healthy_percentage = 50
skip_matching = true
})
triggers = ["tags"]
})
Made spot_options in instance_market_options optional.
On the AWS Web console there is an option to tick a box that provides guidance on how to create a Launch Template, there works with an EC2 Auto scaling group.
Expanding the "Advanced details" ticking "Request spot instance" you will see most of the options are marked as "Don't include in launch template (recommended)"
Expiry date and Interruption behaviour are not applicable. Having all spot_options as required in this template makes it impossible to enable spot instances in an EC2 Auto Scaling group.
On a related note, but not requiring any change to the module.
The variable instance_initiated_shutdown_behavior
should be set to null as it's also not allowed in the Launch Template when used for an EC2 Auto Scaling group
https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-template.html
Support AWS Provider V5 Linter fixes
Maintenance
https://github.com/hashicorp/terraform-provider-aws/releases/tag/v5.0.0
Rebuild github dir from the template
resource/aws_autoscaling_group: Remove deprecated tags attribute (https://github.com/hashicorp/terraform-provider-aws/issues/30842)
https://github.com/hashicorp/terraform-provider-aws/releases/tag/v5.0.0