Skip to content

Commit e2c2649

Browse files
authored
Merge pull request Coalfire-CF#15 from Coalfire-CF/add_imds_var
Add_imds_var
2 parents d879e10 + 7d84422 commit e2c2649

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

ec2.tf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ resource "aws_instance" "this" {
1212
metadata_options {
1313
http_endpoint = "enabled"
1414
http_put_response_hop_limit = 1
15-
http_tokens = "required"
15+
http_tokens = var.http_tokens
1616
instance_metadata_tags = "enabled"
1717
}
1818

@@ -59,6 +59,4 @@ resource "aws_instance" "this" {
5959
lifecycle {
6060
ignore_changes = [root_block_device, ebs_block_device, user_data, ami]
6161
}
62-
63-
depends_on = [var.module_depends_on]
6462
}

sg.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module "security_group" {
2-
source = "github.com/Coalfire-CF/terraform-aws-securitygroup"
2+
source = "github.com/Coalfire-CF/terraform-aws-securitygroup?ref=v1.0.0"
33

44
name = "${var.name}-sg"
55
description = var.sg_description

variables.tf

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,12 @@ variable "assume_role_policy" {
235235
EOF
236236
}
237237

238-
variable "module_depends_on" {
239-
description = "A variable to simulate the depends on feature that resources have"
238+
variable "http_tokens" {
239+
description = "Whether or not the metadata service requires session tokens, required=IMDSv2, optional=IMDSv1"
240240
type = any
241-
default = null
242-
}
241+
default = "required"
242+
validation {
243+
condition = can(regex("^(required|optional)$", var.http_tokens))
244+
error_message = "ERROR: Valid values are 'required' or 'optional'."
245+
}
246+
}

0 commit comments

Comments
 (0)