diff --git a/modules/net-vpc/psa.tf b/modules/net-vpc/psa.tf index 1e44a9accb..913cebfb3a 100644 --- a/modules/net-vpc/psa.tf +++ b/modules/net-vpc/psa.tf @@ -28,7 +28,7 @@ locals { _psa_peered_domains = flatten([ for config in local.psa_configs : [ for v in config.peered_domains : { - key = "${config.key}-${replace(v, ".", "-")}" + key = "${config.key}-${trimsuffix(replace(v, ".", "-"), "-")}" dns_suffix = v service_producer = config.service_producer } diff --git a/tests/modules/net_vpc/examples/psa-routes.yaml b/tests/modules/net_vpc/examples/psa-routes.yaml index c64353b788..a9a8bfddb3 100644 --- a/tests/modules/net_vpc/examples/psa-routes.yaml +++ b/tests/modules/net_vpc/examples/psa-routes.yaml @@ -84,9 +84,9 @@ values: - servicenetworking-googleapis-com-myrange service: servicenetworking.googleapis.com timeouts: null - module.vpc.google_service_networking_peered_dns_domain.name["servicenetworking-googleapis-com-gcp-example-com-"]: + module.vpc.google_service_networking_peered_dns_domain.name["servicenetworking-googleapis-com-gcp-example-com"]: dns_suffix: gcp.example.com. - name: servicenetworking-googleapis-com-gcp-example-com- + name: servicenetworking-googleapis-com-gcp-example-com network: my-network project: project-id service: servicenetworking.googleapis.com