feat: Add capacity option type to instance launch template #387
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Add support for
capacity_option_typeattribute to theaws_ecs_capacity_providerresource within themanaged_instances_provider.instance_launch_templateblock.This attribute allows users to specify the purchasing option for EC2 instances used in ECS managed instances capacity providers.
Valid values:
ON_DEMAND(default) orSPOTFiles changed:
modules/cluster/variables.tf- Addedcapacity_option_typeto the variable type definitionmodules/cluster/main.tf- Addedcapacity_option_typeto the resource configurationvariables.tf- Addedcapacity_option_typeto the root module variable type definitionMotivation and Context
The
capacity_option_typeattribute was added to the AWS provider foraws_ecs_capacity_providerresource but was missing from this module. This change enables users to leverage Spot instances for ECS managed instances, potentially reducing infrastructure costs.Reference: https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/ecs_capacity_provider#capacity_option_type-1
Breaking Changes
This is an additive change that introduces a new optional attribute. When not specified, AWS defaults to
ON_DEMANDbehavior, maintaining full backwards compatibility.How Has This Been Tested?
examples/*to demonstrate and validate my change(s)examples/*projectspre-commit run -aon my pull requestValidation performed:
terraform fmt -recursive- Passedterraform validate- Passedpre-commit run -a- All hooks passed