Skip to content

Commit

Permalink
chore: updated naming convention for internal managed fw rules
Browse files Browse the repository at this point in the history
  • Loading branch information
pawan1210 committed Mar 10, 2025
1 parent 5fc88e4 commit 44a03f6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions examples/internal-lb-cloud-run/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ module "frontend-service-a" {
project_id = var.project_id
location = var.subnet_region_a
service_name = "fs-a"
containers = [{ "env_vars" : { "TARGET_IP" : module.internal-lb-http-frontend.ip_address_http_internal_managed[0] }, "ports" = { "container_port" = 80, "name" = "http1" }, "container_name" = "", "container_image" = "gcr.io/design-center-container-repo/redirect-traffic:latest-2002" }]
containers = [{ "env_vars" : { "TARGET_IP" : module.internal-lb-http-frontend.ip_address_internal_managed_http[0] }, "ports" = { "container_port" = 80, "name" = "http1" }, "container_name" = "", "container_image" = "gcr.io/design-center-container-repo/redirect-traffic:latest-2002" }]
members = ["allUsers"]
vpc_access = {
connector = google_vpc_access_connector.internal_lb_vpc_connector.id
Expand All @@ -161,7 +161,7 @@ module "frontend-service-b" {
project_id = var.project_id
location = var.subnet_region_a
service_name = "fs-b"
containers = [{ "env_vars" : { "TARGET_IP" : module.internal-lb-http-frontend.ip_address_http_internal_managed[1] }, "ports" = { "container_port" = 80, "name" = "http1" }, "container_name" = "", "container_image" = "gcr.io/design-center-container-repo/redirect-traffic:latest-2002" }]
containers = [{ "env_vars" : { "TARGET_IP" : module.internal-lb-http-frontend.ip_address_internal_managed_http[1] }, "ports" = { "container_port" = 80, "name" = "http1" }, "container_name" = "", "container_image" = "gcr.io/design-center-container-repo/redirect-traffic:latest-2002" }]
members = ["allUsers"]
vpc_access = {
connector = google_vpc_access_connector.internal_lb_vpc_connector.id
Expand Down
16 changes: 8 additions & 8 deletions modules/frontend/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,12 @@ resource "google_compute_global_forwarding_rule" "http" {
network = local.internal_network
}

resource "google_compute_global_forwarding_rule" "http_internal_managed" {
resource "google_compute_global_forwarding_rule" "internal_managed_http" {
count = local.create_http_forward && local.is_internal_managed ? length(var.internal_forwarding_rule_subnetworks) : 0

provider = google-beta
project = var.project_id
name = "${var.name}-http-internal-managed-${count.index}"
name = "${var.name}-internal-managed-http-${count.index}"
target = google_compute_target_http_proxy.default[0].self_link
port_range = var.http_port
labels = var.labels
Expand All @@ -84,12 +84,12 @@ resource "google_compute_global_forwarding_rule" "https" {
network = local.internal_network
}

resource "google_compute_global_forwarding_rule" "https_internal_managed" {
resource "google_compute_global_forwarding_rule" "internal_managed_https" {
count = var.ssl && local.is_internal_managed ? length(var.internal_forwarding_rule_subnetworks) : 0

provider = google-beta
project = var.project_id
name = "${var.name}-https-internal-managed-${count.index}"
name = "${var.name}-internal-managed-https-${count.index}"
target = google_compute_target_https_proxy.default[0].self_link
port_range = var.https_port
labels = var.labels
Expand Down Expand Up @@ -122,12 +122,12 @@ resource "google_compute_global_forwarding_rule" "http_ipv6" {
network = local.internal_network
}

resource "google_compute_global_forwarding_rule" "http_ipv6_internal_managed" {
resource "google_compute_global_forwarding_rule" "internal_managed_http_ipv6" {
count = var.enable_ipv6 && local.create_http_forward && local.is_internal_managed ? length(var.internal_forwarding_rule_subnetworks) : 0

provider = google-beta
project = var.project_id
name = "${var.name}-http-ipv6-internal-managed-${count.index}"
name = "${var.name}-internal-managed-http-ipv6-${count.index}"
target = google_compute_target_http_proxy.default[0].self_link
port_range = "80"
labels = var.labels
Expand All @@ -149,12 +149,12 @@ resource "google_compute_global_forwarding_rule" "https_ipv6" {
network = local.internal_network
}

resource "google_compute_global_forwarding_rule" "https_ipv6_internal)managed" {
resource "google_compute_global_forwarding_rule" "internal_managed_https_ipv6" {
count = var.enable_ipv6 && var.ssl && local.is_internal_managed ? length(var.internal_forwarding_rule_subnetworks) : 0

provider = google-beta
project = var.project_id
name = "${var.name}-https-ipv6-internal-managed-${count.index}"
name = "${var.name}-internal-managed-https-ipv6-${count.index}"
target = google_compute_target_https_proxy.default[0].self_link
port_range = "443"
labels = var.labels
Expand Down
4 changes: 2 additions & 2 deletions modules/frontend/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@
* limitations under the License.
*/

output "ip_address_http_internal_managed" {
output "ip_address_internal_managed_http" {
description = "The internal/external IP addresses assigned to the HTTP forwarding rules."
value = [for rule in google_compute_global_forwarding_rule.http_internal_managed : rule.ip_address]
value = [for rule in google_compute_global_forwarding_rule.internal_managed_http : rule.ip_address]
}

output "external_ip" {
Expand Down
2 changes: 1 addition & 1 deletion modules/frontend/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -203,4 +203,4 @@ variable "internal_forwarding_rule_subnetworks" {
description = "Subnetworks for internal forwarding rules."
type = list(string)
default = []
}
}

0 comments on commit 44a03f6

Please sign in to comment.