Skip to content

Commit d01f3ae

Browse files
committed
Configure metadata endpoint
1 parent 8c25793 commit d01f3ae

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

main.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,12 @@ resource "aws_launch_template" "default" {
302302
lifecycle {
303303
create_before_destroy = true
304304
}
305+
306+
metadata_options {
307+
http_endpoint = "enabled"
308+
http_tokens = var.enable_imdsv2 ? "required" : "optional"
309+
http_protocol_ipv6 = var.metadata_ipv6 ? "enabled" : "disabled"
310+
}
305311
}
306312

307313
resource "aws_autoscaling_group" "default" {

variables.tf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,18 @@ variable "associate_public_ip_address" {
7575
default = null
7676
}
7777

78+
variable "enable_imdsv2" {
79+
description = "Enable IMDSv2"
80+
type = bool
81+
default = true
82+
}
83+
84+
variable "metadata_ipv6" {
85+
description = "Enable IPv6 metadata endpoint"
86+
type = bool
87+
default = false
88+
}
89+
7890
######################
7991
## SESSION LOGGING ##
8092
####################

0 commit comments

Comments
 (0)