-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
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)
}
}