Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

googleapi: Error 400: Invalid value for field 'resource.network': 'projects/b/global/networks/c'. Network field cannot be modified., invalid #152

Open
chandra-scentre opened this issue Nov 8, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@chandra-scentre
Copy link

TL;DR

Have a Google Internal LB which got the backend.. it was created some 5 years back and now when i am trying to update the module version

Error when applying the module

Error updating RegionBackendService "projects/abc/regions/us-east1/backendServices/hc": googleapi: Error 400: Invalid value for field 'resource.network': 'projects/b/global/networks/c'. Network field cannot be modified., invalid

Expected behavior

No response

Observed behavior

module.abc.module.ilb.google_compute_region_backend_service.default will be updated in-place

~ resource "google_compute_region_backend_service" "default" {
~ connection_draining_timeout_sec = 0 -> 300
id = "projects/abc/regions/us-east1backendServices/ilb-with-http-hc"
name = "http-hc"
+ network = "https://www.googleapis.com/compute/v1/projects/xyzglobal/networks/abc"
# (17 unchanged attributes hidden)

    # (3 unchanged blocks hidden)
}

Plan: 0 to add, 1 to change, 0 to destroy.

Terraform Configuration

module "ilb" {
  source          = "GoogleCloudPlatform/lb-internal/google"
  version         = "7.0.0"
  name            = "ilb"
  region          = var.region
  ip_address      = google_compute_address.ilb.address
  ip_protocol     = "TCP"
  ports           = []
  all_ports       = true
  network         = var.host_network_name
  network_project = var.host_network_project_id
  subnetwork      = var.subnet_name
  health_check    = local.health_check
  source_tags     = ["${var.gce_prefix}-ingress"]
  target_tags     = [var.gce_prefix]
  backends = [
    { group = module.mig-a.instance_group, description = "worker-a" },
    { group = module.mig-b.instance_group, description = "worker-b" },
    { group = module.mig-c.instance_group, description = "worker-c" },
  ]
  service_label = "test"
}

Terraform Version

1.9.8

Additional information

when running the google describe command (note changed some project names and regions)

main thing to observe is that it is created in 2020 and there is no network in this describe .. now terraform module is trying to add the network module

gcloud compute backend-services describe http-hc
--region=us-east1
--project=abc
backends:

@chandra-scentre chandra-scentre added the bug Something isn't working label Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant