Skip to content

Commit cb367ec

Browse files
authored
feat: Add support for disable_api_stop attribute (terraform-aws-modules#275)
1 parent 9aa189f commit cb367ec

File tree

6 files changed

+13
-3
lines changed

6 files changed

+13
-3
lines changed

README.md

+3-2
Original file line numberDiff line numberDiff line change
@@ -168,13 +168,13 @@ The following combinations are supported to conditionally create resources:
168168
| Name | Version |
169169
|------|---------|
170170
| <a name="requirement_terraform"></a> [terraform](#requirement\_terraform) | >= 0.13.1 |
171-
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.7 |
171+
| <a name="requirement_aws"></a> [aws](#requirement\_aws) | >= 4.20.0 |
172172

173173
## Providers
174174

175175
| Name | Version |
176176
|------|---------|
177-
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.7 |
177+
| <a name="provider_aws"></a> [aws](#provider\_aws) | >= 4.20.0 |
178178

179179
## Modules
180180

@@ -200,6 +200,7 @@ No modules.
200200
| <a name="input_cpu_threads_per_core"></a> [cpu\_threads\_per\_core](#input\_cpu\_threads\_per\_core) | Sets the number of CPU threads per core for an instance (has no effect unless cpu\_core\_count is also set). | `number` | `null` | no |
201201
| <a name="input_create"></a> [create](#input\_create) | Whether to create an instance | `bool` | `true` | no |
202202
| <a name="input_create_spot_instance"></a> [create\_spot\_instance](#input\_create\_spot\_instance) | Depicts if the instance is a spot instance | `bool` | `false` | no |
203+
| <a name="input_disable_api_stop"></a> [disable\_api\_stop](#input\_disable\_api\_stop) | If true, enables EC2 Instance Stop Protection. | `bool` | `null` | no |
203204
| <a name="input_disable_api_termination"></a> [disable\_api\_termination](#input\_disable\_api\_termination) | If true, enables EC2 Instance Termination Protection | `bool` | `null` | no |
204205
| <a name="input_ebs_block_device"></a> [ebs\_block\_device](#input\_ebs\_block\_device) | Additional EBS block devices to attach to the instance | `list(map(string))` | `[]` | no |
205206
| <a name="input_ebs_optimized"></a> [ebs\_optimized](#input\_ebs\_optimized) | If true, the launched EC2 instance will be EBS-optimized | `bool` | `null` | no |

examples/complete/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ module "ec2_complete" {
9595
vpc_security_group_ids = [module.security_group.security_group_id]
9696
placement_group = aws_placement_group.web.id
9797
associate_public_ip_address = true
98+
disable_api_stop = false
9899

99100
# only one of these can be enabled at a time
100101
hibernation = true

main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ resource "aws_instance" "this" {
120120

121121
source_dest_check = length(var.network_interface) > 0 ? null : var.source_dest_check
122122
disable_api_termination = var.disable_api_termination
123+
disable_api_stop = var.disable_api_stop
123124
instance_initiated_shutdown_behavior = var.instance_initiated_shutdown_behavior
124125
placement_group = var.placement_group
125126
tenancy = var.tenancy

variables.tf

+6
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,12 @@ variable "spot_valid_from" {
305305
default = null
306306
}
307307

308+
variable "disable_api_stop" {
309+
description = "If true, enables EC2 Instance Stop Protection."
310+
type = bool
311+
default = null
312+
313+
}
308314
variable "putin_khuylo" {
309315
description = "Do you agree that Putin doesn't respect Ukrainian sovereignty and territorial integrity? More info: https://en.wikipedia.org/wiki/Putin_khuylo!"
310316
type = bool

versions.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ terraform {
44
required_providers {
55
aws = {
66
source = "hashicorp/aws"
7-
version = ">= 4.7"
7+
version = ">= 4.20.0"
88
}
99
}
1010
}

wrappers/main.tf

+1
Original file line numberDiff line numberDiff line change
@@ -54,5 +54,6 @@ module "wrapper" {
5454
spot_instance_interruption_behavior = try(each.value.spot_instance_interruption_behavior, var.defaults.spot_instance_interruption_behavior, null)
5555
spot_valid_until = try(each.value.spot_valid_until, var.defaults.spot_valid_until, null)
5656
spot_valid_from = try(each.value.spot_valid_from, var.defaults.spot_valid_from, null)
57+
disable_api_stop = try(each.value.disable_api_stop, var.defaults.disable_api_stop, null)
5758
putin_khuylo = try(each.value.putin_khuylo, var.defaults.putin_khuylo, true)
5859
}

0 commit comments

Comments
 (0)