diff --git a/CHANGELOG.md b/CHANGELOG.md index b304655..14cd7ee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -414,3 +414,7 @@ * 2.10.4 -- 2024-10-07 - examples/dummy-vpc/vpc0 - add default security group (to manage it) to remove ingress/egress rules + +* 2.10.5 -- 2024-11-13 + - vpc-interface-endpoint + - fix service vs service_name to better handle service name which are not short and non-regional (for new iam endpoint) diff --git a/common/version.tf b/common/version.tf index dc8e83f..ba09d74 100644 --- a/common/version.tf +++ b/common/version.tf @@ -1,5 +1,5 @@ locals { - _module_version = "2.10.4" + _module_version = "2.10.5" _module_names = { "_main_" = "aws-vpc-setup" diff --git a/vpc-interface-endpoint/main.tf b/vpc-interface-endpoint/main.tf index 0a2e1bf..84dc51c 100644 --- a/vpc-interface-endpoint/main.tf +++ b/vpc-interface-endpoint/main.tf @@ -63,7 +63,9 @@ locals { # short_service = length(regexall("^com.amazonaws", var.service)) == 0 ? var.service : replace(local.service, format("com.amazonaws.%v.", local.region), "") # short_service = element(local.full_service_parts, length(local.full_service_parts) - 1) - short_service = join(".", slice(local.full_service_parts, index(local.full_service_parts, local.region) + 1, length(local.full_service_parts))) + #short_service = join(".", slice(local.full_service_parts, index(local.full_service_parts, local.region) + 1, length(local.full_service_parts))) + short_service = replace(replace(local.service, "com.amazonaws.", ""), format("%v.", local.region), "") + is_short_service = ! (local.full_service_parts[0] != "com" || ! contains(local.full_service_parts, local.region)) base_tags = { "boc:tf_module_version" = local._module_version @@ -76,8 +78,10 @@ locals { # https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeVpcEndpoints.html data "aws_vpc_endpoint_service" "interface_endpoint" { - service = local.full_service_parts[0] == "com" ? local.short_service : null - service_name = local.full_service_parts[0] != "com" ? local.service : null + # service = local.full_service_parts[0] == "com" ? local.short_service : null + # service_name = local.full_service_parts[0] != "com" ? local.service : null + service = local.is_short_service ? local.short_service : null + service_name = ! local.is_short_service ? local.service : null filter { name = "service-type" values = ["Interface"]