Skip to content

Commit

Permalink
* 2.10.5 -- 2024-11-13
Browse files Browse the repository at this point in the history
  - vpc-interface-endpoint
    - fix service vs service_name to better handle service name which are not short and non-regional (for new iam endpoint)
  • Loading branch information
badra001 committed Nov 13, 2024
1 parent 8ad2308 commit 3ef76da
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion common/version.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
locals {
_module_version = "2.10.4"
_module_version = "2.10.5"
_module_names = {
"_main_" = "aws-vpc-setup"

Expand Down
10 changes: 7 additions & 3 deletions vpc-interface-endpoint/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"]
Expand Down

0 comments on commit 3ef76da

Please sign in to comment.