terraform-google-modules / terraform-google-lb-internal

Creates an internal load balancer for Compute Engine by using forwarding rules
https://registry.terraform.io/modules/terraform-google-modules/lb-internal/google
Apache License 2.0
81 stars 88 forks source link

unable to create and attach Target Proxies #100

Closed rak287 closed 1 year ago

rak287 commented 2 years ago

TL;DR

I have try to create or attach the forwarding rules to targetProxies for my internal load balancer but unfortunately, I am not able to do so as it trying to look in "global" instead of the region. All the resources have been created regionally as I am using regional internal LB. How could we solve this problem?

ERROR: 10:29:21 module.gce-ilb-https.google_compute_forwarding_rule.default: Creating... 10:29:22
10:29:22 Error: Error creating ForwardingRule: googleapi: Error 404: The resource 'projects//global/networks/' was not found, notFound 10:29:22
10:29:22 with module.gce-ilb-https.google_compute_forwarding_rule.default,

I use the following resource in the code

`

Regional forwarding rule

resource "google_compute_forwarding_rule" "default" { name = "${var.env}-${var.region}-ilb-forwarding-rule" region = "${var.region}" depends_on = [local.proxy_subnet] ip_protocol = "TCP" ip_address = local.address load_balancing_scheme = "INTERNAL_MANAGED" port_range = "80" target = google_compute_region_target_http_proxy.default.self_link network = local.network subnetwork = local.subnetwork network_tier = "PREMIUM" }

Regional HTTP proxy

resource "google_compute_region_target_http_proxy" "default" {

count = local.create_http_forward ? 1 : 0

name = "${var.env}-${var.region}-ilb-target-proxy" region = "${var.region}" project = "${var.project_id}" url_map = local.url_map }`

NOTE: all other resources have been able to create regional I can create when I manually update LB which created a region target proxy but I try to use the same instead of looking in the region it looks in global.

Expected behavior

No response

Observed behavior

Should pick or create forwarding rules target proxy from the region instead of global when given a region option

Terraform Configuration

`
# Regional forwarding rule
resource "google_compute_forwarding_rule" "default" {
  name                  = "${var.env}-${var.region}-ilb-forwarding-rule"
  region                = "${var.region}"
  depends_on            = [local.proxy_subnet]
  ip_protocol           = "TCP"
  ip_address            = local.address
  load_balancing_scheme = "INTERNAL_MANAGED"
  port_range            = "80"
  target                = google_compute_region_target_http_proxy.default.self_link
  network               = local.network
  subnetwork            = local.subnetwork
  network_tier          = "PREMIUM"
}

# Regional HTTP proxy
resource "google_compute_region_target_http_proxy" "default" {
#  count   = local.create_http_forward ? 1 : 0
  name       = "${var.env}-${var.region}-ilb-target-proxy"
  region     = "${var.region}"
  project    = "${var.project_id}"
  url_map    = local.url_map
}`

Terraform Version

using hashicorp/google v4.31.0

Additional information

No response

github-actions[bot] commented 1 year ago

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days