Skip to content

Add support for launching into EC2 Capacity Blocks reservation #383

@erezzarum

Description

@erezzarum

Is your request related to a new offering from AWS? Yes

Is this functionality available in the AWS provider for Terraform? ✅ v5.24.0

To launch an EC2 instance into a Capacity Block reservation, we have to specify both a reservation specification with the target as the reservation id as well as to launch into a specific new MarketType option value - "capacity-block".

The AWS provider for Terraform docs do not list the value "capacity-block" as a valid value for market_type in the instance_market_options block.
This is a bug in the docs, as the provider uses the AWS SDK Go v2 library in the correct version which does support the "capacity-block" value.
The AWS SDK Go v2 introduced that "capacity-block" value since v1.130.0 and the AWS provider for Terraform bumped the service/ec2 version to v1.130.0 at v5.24.0.

TL;DR - The AWS provider for Terraform, does support launching an EC2 instance using the aws_instance resource into a reserved capacity-block.

Is your request related to a problem? Please describe.

Does not support launching an EC2 instance into a Capacity Block reservation

Describe the solution you'd like.

Add support for the instance_market_options block.

dynamic "instance_market_options" {
  for_each = length(var.instance_market_options) > 0 ? [var.instance_market_options] : []

  content {
    market_type  = try(instance_market_options.value.market_type, null)
    spot_options = try(instance_market_options.value.spot_options, null)
  }
}

Describe alternatives you've considered.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions