File tree 2 files changed +42
-2
lines changed
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" {
276
276
user_data = base64encode (var. user_data )
277
277
278
278
monitoring {
279
- enabled = true
279
+ enabled = var . monitoring_enabled
280
280
}
281
281
282
282
network_interfaces {
283
- associate_public_ip_address = false
283
+ associate_public_ip_address = var . associate_public_ip_address
284
284
delete_on_termination = true
285
285
security_groups = concat (var. additional_security_group_ids , [aws_security_group . default . id ])
286
286
}
@@ -302,6 +302,12 @@ resource "aws_launch_template" "default" {
302
302
lifecycle {
303
303
create_before_destroy = true
304
304
}
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
+ }
305
311
}
306
312
307
313
resource "aws_autoscaling_group" "default" {
Original file line number Diff line number Diff line change @@ -62,6 +62,40 @@ variable "additional_security_group_ids" {
62
62
default = []
63
63
}
64
64
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
+
65
99
# #####################
66
100
# # SESSION LOGGING ##
67
101
# ###################
You can’t perform that action at this time.
0 commit comments