From 651b70cb3a530970c86f64c00fbfdf78f0683bd4 Mon Sep 17 00:00:00 2001 From: Michael Meidlinger Date: Mon, 27 Jan 2025 15:59:00 +0000 Subject: [PATCH 1/3] Make it so we can pass service_region=null to the VPC endpoint module --- modules/vpc-endpoints/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/vpc-endpoints/main.tf b/modules/vpc-endpoints/main.tf index e2cddd268..315a3e79b 100644 --- a/modules/vpc-endpoints/main.tf +++ b/modules/vpc-endpoints/main.tf @@ -13,7 +13,7 @@ data "aws_vpc_endpoint_service" "this" { service = try(each.value.service, null) service_name = try(each.value.service_name, null) - service_regions = try([each.value.service_region], null) + service_regions = try(each.value.service_region != null ? [each.value.service_region] : null, null) filter { name = "service-type" From 6c7cb27659801a2a01fdee8d831e563e912c5bd8 Mon Sep 17 00:00:00 2001 From: Michael Meidlinger Date: Tue, 28 Jan 2025 12:08:27 +0000 Subject: [PATCH 2/3] Made expression a bit easier to read. --- modules/vpc-endpoints/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/vpc-endpoints/main.tf b/modules/vpc-endpoints/main.tf index 315a3e79b..0f19c2a2f 100644 --- a/modules/vpc-endpoints/main.tf +++ b/modules/vpc-endpoints/main.tf @@ -13,7 +13,7 @@ data "aws_vpc_endpoint_service" "this" { service = try(each.value.service, null) service_name = try(each.value.service_name, null) - service_regions = try(each.value.service_region != null ? [each.value.service_region] : null, null) + service_regions = try(each.value.service_region, null) != null ? [each.value.service_region] : null filter { name = "service-type" From d57be99d731980a393828bb58fb3494f280cd2b0 Mon Sep 17 00:00:00 2001 From: Michael Meidlinger Date: Tue, 28 Jan 2025 13:18:38 +0000 Subject: [PATCH 3/3] Further simplified service_region parsing --- modules/vpc-endpoints/main.tf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/vpc-endpoints/main.tf b/modules/vpc-endpoints/main.tf index 0f19c2a2f..12d4e71ce 100644 --- a/modules/vpc-endpoints/main.tf +++ b/modules/vpc-endpoints/main.tf @@ -13,7 +13,7 @@ data "aws_vpc_endpoint_service" "this" { service = try(each.value.service, null) service_name = try(each.value.service_name, null) - service_regions = try(each.value.service_region, null) != null ? [each.value.service_region] : null + service_regions = try(coalescelist(compact([each.value.service_region])), null) filter { name = "service-type"