Skip to content

Commit

Permalink
fix: Forwarding rule names need to be unique (#219)
Browse files Browse the repository at this point in the history
* fix: Forwarding rule names need to be unique[C

* dumb github action

* hash naming

* desc
  • Loading branch information
dacbd authored Feb 4, 2025
1 parent a1b3bec commit 0db345c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion modules/networking/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,14 @@ resource "google_compute_global_address" "api_psc" {
address = var.google_api_psc_ipaddress
}

locals {
# gcp name rules require this to start with a letter & be unique
psc_fordwarding_rule_name = "a${substr(sha256("${var.namespace}gcpapi"), 0, 19)}"
}

resource "google_compute_global_forwarding_rule" "api_psc" {
name = "gcpapipsc"
name = local.psc_fordwarding_rule_name
description = "${var.namespace} - all apis forwarding rule"
ip_address = google_compute_global_address.api_psc.self_link
load_balancing_scheme = ""
network = google_compute_network.vpc.id
Expand Down

0 comments on commit 0db345c

Please sign in to comment.