Skip to content

Commit

Permalink
Add var http_put_response_hop_limit with overridable default of 1.
Browse files Browse the repository at this point in the history
  • Loading branch information
herman-wong-cf committed Oct 15, 2024
1 parent a0317f2 commit f6e96d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ resource "aws_instance" "this" {
get_password_data = var.get_password_data
metadata_options {
http_endpoint = "enabled"
http_put_response_hop_limit = 1
http_put_response_hop_limit = var.http_put_response_hop_limit
http_tokens = var.http_tokens
instance_metadata_tags = "enabled"
}
Expand Down
10 changes: 8 additions & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,16 @@ EOF

variable "http_tokens" {
description = "Whether or not the metadata service requires session tokens, required=IMDSv2, optional=IMDSv1"
type = any
type = string
default = "required"
validation {
condition = can(regex("^(required|optional)$", var.http_tokens))
error_message = "ERROR: Valid values are 'required' or 'optional'."
}
}
}

variable "http_put_response_hop_limit" {
description = "Number of network hops to allow instance metadata. This should be 2 or higher if using containers on instance and you want containers to access metadata."
type = number
default = 1
}

0 comments on commit f6e96d7

Please sign in to comment.