File tree Expand file tree Collapse file tree 2 files changed +42
-2
lines changed
Expand file tree Collapse file tree 2 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -276,11 +276,11 @@ resource "aws_launch_template" "default" {
276276 user_data = base64encode (var. user_data )
277277
278278 monitoring {
279- enabled = true
279+ enabled = var . monitoring_enabled
280280 }
281281
282282 network_interfaces {
283- associate_public_ip_address = false
283+ associate_public_ip_address = var . associate_public_ip_address
284284 delete_on_termination = true
285285 security_groups = concat (var. additional_security_group_ids , [aws_security_group . default . id ])
286286 }
@@ -302,6 +302,12 @@ resource "aws_launch_template" "default" {
302302 lifecycle {
303303 create_before_destroy = true
304304 }
305+
306+ metadata_options {
307+ http_endpoint = var. metadata_http_endpoint_enabled ? " enabled" : " disabled"
308+ http_tokens = var. metadata_imdsv2_enabled ? " required" : " optional"
309+ http_protocol_ipv6 = var. metadata_http_protocol_ipv6_enabled ? " enabled" : " disabled"
310+ }
305311}
306312
307313resource "aws_autoscaling_group" "default" {
Original file line number Diff line number Diff line change @@ -62,6 +62,40 @@ variable "additional_security_group_ids" {
6262 default = []
6363}
6464
65+ variable "monitoring_enabled" {
66+ description = " Enable detailed monitoring of instance"
67+ type = bool
68+ default = true
69+ }
70+
71+ variable "associate_public_ip_address" {
72+ description = " Associate public IP address"
73+ type = bool
74+ # default should fall back to subnet setting
75+ default = null
76+ }
77+
78+ variable "metadata_http_endpoint_enabled" {
79+ description = " Whether or not to enable the metadata http endpoint"
80+ type = bool
81+ default = true
82+ }
83+
84+ variable "metadata_imdsv2_enabled" {
85+ description = <<- EOT
86+ Whether or not the metadata service requires session tokens,
87+ also referred to as Instance Metadata Service Version 2 (IMDSv2).
88+ EOT
89+ type = bool
90+ default = true
91+ }
92+
93+ variable "metadata_http_protocol_ipv6_enabled" {
94+ description = " Enable IPv6 metadata endpoint"
95+ type = bool
96+ default = false
97+ }
98+
6599# #####################
66100# # SESSION LOGGING ##
67101# ###################
You can’t perform that action at this time.
0 commit comments