diff --git a/README.md b/README.md index 0a649f5..b6fb006 100644 --- a/README.md +++ b/README.md @@ -247,7 +247,6 @@ Available targets: | [external\_network\_interfaces](#input\_external\_network\_interfaces) | The external interface definitions to attach to the instances. This depends on the instance type |
list(object({
delete_on_termination = bool
device_index = number
network_card_index = number
network_interface_id = string
}))
| `null` | no | | [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no | | [instance\_initiated\_shutdown\_behavior](#input\_instance\_initiated\_shutdown\_behavior) | Specifies whether an instance stops or terminates when you initiate shutdown from the instance. Can be one of 'stop' or 'terminate'. | `string` | `null` | no | -| [instance\_market\_options\_enabled](#input\_instance\_market\_options\_enabled) | Wheter to enable the purchasing option for the instances | `bool` | `false` | no | | [instance\_profile](#input\_instance\_profile) | A pre-defined profile to attach to the instance (default is to build our own) | `string` | `""` | no | | [instance\_profile\_enabled](#input\_instance\_profile\_enabled) | Whether an IAM instance profile is created to pass a role to an Amazon EC2 instance when the instance starts | `bool` | `true` | no | | [instance\_type](#input\_instance\_type) | The type of the instance | `string` | `"t2.micro"` | no | @@ -327,7 +326,7 @@ Available targets: | [security\_group\_id](#output\_security\_group\_id) | EC2 instance Security Group ID | | [security\_group\_ids](#output\_security\_group\_ids) | IDs on the AWS Security Groups associated with the instance | | [security\_group\_name](#output\_security\_group\_name) | EC2 instance Security Group name | -| [spot\_instance\_request\_id](#output\_spot\_instance\_request\_id) | the ID of the Spot Instance request | +| [spot\_instance\_request\_id](#output\_spot\_instance\_request\_id) | ID of the Spot Instance request | | [ssh\_key\_pair](#output\_ssh\_key\_pair) | Name of the SSH key pair provisioned on the instance | diff --git a/docs/terraform.md b/docs/terraform.md index f55f007..2da1113 100644 --- a/docs/terraform.md +++ b/docs/terraform.md @@ -88,7 +88,6 @@ | [external\_network\_interfaces](#input\_external\_network\_interfaces) | The external interface definitions to attach to the instances. This depends on the instance type |
list(object({
delete_on_termination = bool
device_index = number
network_card_index = number
network_interface_id = string
}))
| `null` | no | | [id\_length\_limit](#input\_id\_length\_limit) | Limit `id` to this many characters (minimum 6).
Set to `0` for unlimited length.
Set to `null` for keep the existing setting, which defaults to `0`.
Does not affect `id_full`. | `number` | `null` | no | | [instance\_initiated\_shutdown\_behavior](#input\_instance\_initiated\_shutdown\_behavior) | Specifies whether an instance stops or terminates when you initiate shutdown from the instance. Can be one of 'stop' or 'terminate'. | `string` | `null` | no | -| [instance\_market\_options\_enabled](#input\_instance\_market\_options\_enabled) | Wheter to enable the purchasing option for the instances | `bool` | `false` | no | | [instance\_profile](#input\_instance\_profile) | A pre-defined profile to attach to the instance (default is to build our own) | `string` | `""` | no | | [instance\_profile\_enabled](#input\_instance\_profile\_enabled) | Whether an IAM instance profile is created to pass a role to an Amazon EC2 instance when the instance starts | `bool` | `true` | no | | [instance\_type](#input\_instance\_type) | The type of the instance | `string` | `"t2.micro"` | no | @@ -168,6 +167,6 @@ | [security\_group\_id](#output\_security\_group\_id) | EC2 instance Security Group ID | | [security\_group\_ids](#output\_security\_group\_ids) | IDs on the AWS Security Groups associated with the instance | | [security\_group\_name](#output\_security\_group\_name) | EC2 instance Security Group name | -| [spot\_instance\_request\_id](#output\_spot\_instance\_request\_id) | the ID of the Spot Instance request | +| [spot\_instance\_request\_id](#output\_spot\_instance\_request\_id) | ID of the Spot Instance request | | [ssh\_key\_pair](#output\_ssh\_key\_pair) | Name of the SSH key pair provisioned on the instance | diff --git a/examples/complete/fixtures.us-east-2.spot.tfvars b/examples/complete/fixtures.us-east-2.spot.tfvars index 340072c..31a47d6 100644 --- a/examples/complete/fixtures.us-east-2.spot.tfvars +++ b/examples/complete/fixtures.us-east-2.spot.tfvars @@ -58,8 +58,6 @@ ssh_public_key_path = "/secrets" metric_treat_missing_data = "notBreaching" -instance_market_options_enabled = true - market_type = "spot" spot_options_attributes = [{ diff --git a/examples/complete/main.tf b/examples/complete/main.tf index e2067d8..67f54e5 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -86,7 +86,6 @@ module "ec2_instance" { instance_profile = aws_iam_instance_profile.test.name tenancy = var.tenancy metric_treat_missing_data = var.metric_treat_missing_data - instance_market_options_enabled = var.instance_market_options_enabled market_type = var.market_type spot_options_attributes = var.spot_options_attributes diff --git a/examples/complete/outputs.tf b/examples/complete/outputs.tf index 1f376ea..cbb7930 100644 --- a/examples/complete/outputs.tf +++ b/examples/complete/outputs.tf @@ -114,11 +114,11 @@ output "security_group_name" { } output "instance_lifecycle" { - value = var.instance_market_options_enabled ? module.ec2_instance.instance_lifecycle : null + value = var.spot_options_attributes != [] ? module.ec2_instance.instance_lifecycle : null description = "Indicates whether this is a Spot Instance or a Scheduled Instance" } output "spot_instance_request_id" { - value = var.instance_market_options_enabled && var.market_type == "spot" ? module.ec2_instance.spot_instance_request_id : null + value = var.spot_options_attributes != [] && var.market_type == "spot" ? module.ec2_instance.spot_instance_request_id : null description = "the ID of the Spot Instance request" } diff --git a/examples/complete/variables.tf b/examples/complete/variables.tf index 8d83fb4..2a33b8c 100644 --- a/examples/complete/variables.tf +++ b/examples/complete/variables.tf @@ -57,12 +57,6 @@ variable "metric_treat_missing_data" { } } -variable "instance_market_options_enabled" { - type = bool - description = "Wheter to enable the purchasing option for the instances" - default = false -} - variable "market_type" { type = string description = "(Optional) Type of market for the instance. Valid values are `spot` and `capacity-block`. Defaults to `spot`. Required if a non-empty value is provided for `spot_options_attributes`." diff --git a/main.tf b/main.tf index 4a2aac4..32294d7 100644 --- a/main.tf +++ b/main.tf @@ -168,9 +168,7 @@ resource "aws_instance" "default" { cpu_credits = var.burstable_mode } - dynamic "instance_market_options" { - for_each = var.instance_market_options_enabled ? [var.spot_options_attributes] : [] - content { + instance_market_options { market_type = var.market_type dynamic "spot_options" { @@ -182,7 +180,6 @@ resource "aws_instance" "default" { valid_until = spot_options.value.valid_until } } - } } tags = module.this.tags diff --git a/outputs.tf b/outputs.tf index 9a63f57..9946d82 100644 --- a/outputs.tf +++ b/outputs.tf @@ -102,11 +102,11 @@ output "security_group_name" { } output "instance_lifecycle" { - value = var.instance_market_options_enabled ? aws_instance.default[*].instance_lifecycle : null + value = var.spot_options_attributes != [] ? aws_instance.default[*].instance_lifecycle : null description = "Indicates whether this is a Spot Instance or a Scheduled Instance" } output "spot_instance_request_id" { - value = var.instance_market_options_enabled && var.market_type == "spot" ? aws_instance.default[*].spot_instance_request_id : null + value = var.spot_options_attributes != [] && var.market_type == "spot" ? aws_instance.default[*].spot_instance_request_id : null description = "ID of the Spot Instance request" } diff --git a/variables.tf b/variables.tf index b631486..f8a6fb5 100644 --- a/variables.tf +++ b/variables.tf @@ -46,12 +46,6 @@ variable "burstable_mode" { default = null } -variable "instance_market_options_enabled" { - type = bool - description = "Whether to enable the purchasing option for the instances" - default = false -} - variable "market_type" { type = string description = "Type of market for the instance. Valid values are `spot` and `capacity-block`. Defaults to `spot`. Required if a non-empty value is provided for `spot_options_attributes`."