Skip to content

Commit 29c4e70

Browse files
authored
DEVOPS-5728 | Make IMDSv2 required in this module (#11)
2 parents 9f47b86 + aa7ad39 commit 29c4e70

File tree

5 files changed

+4
-24
lines changed

5 files changed

+4
-24
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ and also serves as a unique key for re-use.
4040
addresses with instances managed by the auto scaling group.
4141
* `ebs_optimized` - (Default: **false**) Flag to enable Elastic Block Storage
4242
(EBS) optimization.
43-
* `enable_imdsv2` - (Default: false) Flag to enforce Instance Metadata Service IMDSv2.
4443
* `enable_monitoring` - (Optional) Flag to enable detailed monitoring.
4544
* `instance_based_naming_enabled` - (Optional) Flag to enable dynamic name tags
4645
on instances. The default format is **stack_item_label-instance-id**. Requires

group/lt/main.tf

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,16 +64,10 @@ resource "aws_launch_template" "lt" {
6464
}
6565
}
6666

67-
# Replace with a simple "metadata_options" block when rolling out to Prod.
68-
# This ensures we don't introduce drift to Prod in the meantime.
69-
dynamic "metadata_options" {
70-
for_each = var.enable_imdsv2 ? [1] : []
71-
72-
content {
73-
http_endpoint = "enabled"
74-
http_tokens = "required"
75-
http_put_response_hop_limit = 2
76-
}
67+
metadata_options {
68+
http_endpoint = "enabled"
69+
http_tokens = "required"
70+
http_put_response_hop_limit = 1
7771
}
7872

7973
instance_type = var.instance_type

group/lt/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# Input Variables
22

33
## Resource tags
4-
#Remove this var when rolling out IMDSv2 to Prod
5-
variable "enable_imdsv2" {
6-
type = bool
7-
default = false
8-
}
9-
104
variable "stack_item_fullname" {
115
type = string
126
}

group/main.tf

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ module "lt" {
7575
ebs_vol_size = var.ebs_vol_size
7676
ebs_vol_snapshot_id = var.ebs_vol_snapshot_id
7777
ebs_vol_type = var.ebs_vol_type
78-
enable_imdsv2 = var.enable_imdsv2
7978
enable_monitoring = var.enable_monitoring
8079
instance_market_options = local.instance_market_options
8180
instance_profile = var.instance_profile

group/variables.tf

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
# Input Variables
22

33
## Resource tags
4-
#Remove this var when rolling out IMDSv2 to Prod
5-
variable "enable_imdsv2" {
6-
type = bool
7-
default = false
8-
}
9-
104
variable "stack_item_fullname" {
115
type = string
126
description = "Long form descriptive name for this stack item. This value is used to create the 'application' resource tag for resources created by this stack item."

0 commit comments

Comments
 (0)