Skip to content

Conversation

@dimitrije-janic
Copy link
Contributor

Description

Add support for capacity_option_type attribute to the aws_ecs_capacity_provider resource within the managed_instances_provider.instance_launch_template block.

This attribute allows users to specify the purchasing option for EC2 instances used in ECS managed instances capacity providers.

Valid values: ON_DEMAND (default) or SPOT

Files changed:

  • modules/cluster/variables.tf - Added capacity_option_type to the variable type definition
  • modules/cluster/main.tf - Added capacity_option_type to the resource configuration
  • variables.tf - Added capacity_option_type to the root module variable type definition

Motivation and Context

The capacity_option_type attribute was added to the AWS provider for aws_ecs_capacity_provider resource 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

  • No breaking changes

This is an additive change that introduces a new optional attribute. When not specified, AWS defaults to ON_DEMAND behavior, maintaining full backwards compatibility.

How Has This Been Tested?

  • I have updated at least one of the examples/* to demonstrate and validate my change(s)
  • I have tested and validated these changes using one or more of the provided examples/* projects
  • I have executed pre-commit run -a on my pull request

Validation performed:

  • terraform fmt -recursive - Passed
  • terraform validate - Passed
  • pre-commit run -a - All hooks passed

Copy link
Member

@bryantbiggs bryantbiggs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great, thank you!

@bryantbiggs bryantbiggs merged commit c7d7c4d into terraform-aws-modules:master Jan 9, 2026
13 checks passed
antonbabenko pushed a commit that referenced this pull request Jan 9, 2026
## [7.1.0](v7.0.0...v7.1.0) (2026-01-09)

### Features

* Add capacity option type to instance launch template ([#387](#387)) ([c7d7c4d](c7d7c4d))
@antonbabenko
Copy link
Member

This PR is included in version 7.1.0 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants