diff --git a/modules/nodepool/main.tf b/modules/nodepool/main.tf index f47b47f..2412d1a 100644 --- a/modules/nodepool/main.tf +++ b/modules/nodepool/main.tf @@ -16,11 +16,14 @@ resource "aws_launch_template" "this" { instance_type = var.instance_type user_data = var.userdata - metadata_options { - http_endpoint = var.metadata_options["http_endpoint"] - http_tokens = var.metadata_options["http_tokens"] - http_put_response_hop_limit = var.metadata_options["http_put_response_hop_limit"] - instance_metadata_tags = var.metadata_options["instance_metadata_tags"] + dynamic "metadata_options" { + for_each = (var.metadata_options == null) ? [] : [1] + content { + http_endpoint = var.metadata_options["http_endpoint"] + http_tokens = var.metadata_options["http_tokens"] + http_put_response_hop_limit = var.metadata_options["http_put_response_hop_limit"] + instance_metadata_tags = var.metadata_options["instance_metadata_tags"] + } } network_interfaces { diff --git a/versions.tf b/versions.tf index c3c2658..e1d335e 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.6" + version = ">= 5" } cloudinit = { source = "hashicorp/cloudinit"