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

Creation of google_compute_forwarding_rule fails if default labels are set at provider level #16906

Open
wjf3121 opened this issue Jan 5, 2024 · 6 comments

Comments

@wjf3121
Copy link

wjf3121 commented Jan 5, 2024

This happens with provider 5.2.0 and when the default labels are defined at provider level and there is no label block in google_compute_forwarding_rule itself:

provider "google" {
  default_labels  = { mylabel = "labelvalue"}
}
resource "google_compute_forwarding_rule" "prisma_fwd" {
  ip_address            = "127.0.0.3"
  name                  = "rule"
  network               = var.project_network
  project               = var.project_id
  region                = var.region
  target                = var.private_service_connect
}

Affected Resource(s)

google_compute_forwarding_rule

Originally posted by @Ziemowit-LH in #16255 (comment)

b/327610708

@rileykarson rileykarson added the bug label Jan 8, 2024
@rileykarson
Copy link
Collaborator

I think that PSC forwarding rules can't have labels set, based on #16255 (comment) - we'll need to not apply default labels for forwarding rules of that type.

@eraac
Copy link
Contributor

eraac commented Apr 25, 2024

Does a workaround exist?

@DevoFalcon
Copy link

If you create the resource without labels initially, and then update it to include labels, it works correctly (as a workarround). What I did was

  1. Comment out provider default_labels
  2. Targetted-apply my google_compute_forwarding_rule
  3. Uncomment provider default_labels
  4. Apply update to google_compute_forwarding_rule to add labels

@Ziemowit-LH
Copy link

That's what I've been doing until I got tired of it and just stopped using provider-defined labels.
Now I declare/compute a standard set of labels and just apply them to each resource that can take labels. google_compute_forwarding_rule is not one.

@Ziemowit-LH
Copy link

Ziemowit-LH commented Jun 21, 2024

I think that PSC forwarding rules can't have labels set, based on #16255 (comment) - we'll need to not apply default labels for forwarding rules of that type.

They can. What is stupid is that the labels can't be set at creation time (GCP API limitation) but only added after the resource already exists.

Is there a way to ignore provider-level labels for a particular resource by some statement?

@pawelJas
Copy link

This is a duplicate to #17334
@rileykarson I think this issue can be closed now as is resolved by #17334.

The request for the same fix for google_compute_global_forwarding_rule is open: #20873

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants