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

google_compute_global_forwarding_rule create fails, if targeting PSC and using labels #20873

Open
wiktorn opened this issue Jan 10, 2025 · 5 comments · May be fixed by GoogleCloudPlatform/magic-modules#12737

Comments

@wiktorn
Copy link

wiktorn commented Jan 10, 2025

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave +1 or me too comments, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.
  • If an issue is assigned to a user, that user is claiming responsibility for the issue.
  • Customers working with a Google Technical Account Manager or Customer Engineer can ask them to reach out internally to expedite investigation and resolution of this issue.

Terraform Version & Provider Version(s)

$ terraform version
Terraform v1.10.2
on linux_amd64

  • provider registry.terraform.io/hashicorp/google v6.14.0
  • provider registry.terraform.io/hashicorp/google-beta v6.14.0

Affected Resource(s)

google_compute_global_forwarding_rule

Terraform Configuration

resource "google_compute_global_address" "default" {
  project       = var.project_id
  name          = "global-psconnect-ip"
  address_type  = "INTERNAL"
  purpose       = "PRIVATE_SERVICE_CONNECT"
  network       = var.vpc.self_link
  address       = "100.100.100.106"
}

resource "google_compute_global_forwarding_rule" "default" {
  project       = var.project_id
  name          = "globalrule"
  target        = "all-apis"
  network       = var.vpc.self_link
  ip_address    = google_compute_global_address.default.id
  load_balancing_scheme = ""
  labels = {
    foo = "bar"
  }
}

Debug Output

https://gist.github.com/wiktorn/9a006c00387c2a831b15440910cd1d4f

Expected Behavior

No response

Actual Behavior

google_compute_global_forwarding_rule.default: Creating...
╷
│ Error: Error creating GlobalForwardingRule: googleapi: Error 400: Invalid value for field 'resource.labels': ''. Invalid field set in Private Service Connect Forwarding Rule. This field should not be set., invalid
│ 
│   with google_compute_global_forwarding_rule.default,
│   on main.tf line 10, in resource "google_compute_global_forwarding_rule" "default":
│   10: resource "google_compute_global_forwarding_rule" "default" {
│ 
╵

Steps to reproduce

  1. terraform apply

Important Factoids

No response

References

Similar issue was fixed for google_compute_forwarding_rule in #18984 (see also #17334).

For global forwarding rule, additional conditions needs to be added to accomodate for Global APIs - all-apis and vpc-sc targets

b/390492067

@ggtisc
Copy link
Collaborator

ggtisc commented Jan 16, 2025

Confirmed issue

It is not possible to create the resource using labels with the shared configuration, but without this argument the google_compute_global_forwarding_rule was created successfully

@ggtisc ggtisc self-assigned this Jan 16, 2025
@ggtisc ggtisc removed the forward/review In review; remove label to forward label Jan 16, 2025
@ggtisc ggtisc removed their assignment Jan 16, 2025
@pawelJas
Copy link

I think this is a duplicate to #16906. The last comment describes this pretty well: #16906 (comment).
I would suggest closing this one and 👍 the other.

@wiktorn
Copy link
Author

wiktorn commented Jan 17, 2025

I think this is a duplicate to #16906. The last comment describes this pretty well: #16906 (comment). I would suggest closing this one and 👍 the other.

#16906 is for google_compute_forwarding_rule while this issue is for google_compute_global_forwarding_rule. And #16906 was fixed in #18984.

@pawelJas
Copy link

Ahh, It makes sense. So the fix for this problem would be to apply the same changes as in #18984 to google_compute_global_forwarding_rule

@wiktorn
Copy link
Author

wiktorn commented Jan 17, 2025

Yes, I started work on this in GoogleCloudPlatform/magic-modules#12737 , I just need to finish addressing review comments there.

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

Successfully merging a pull request may close this issue.

4 participants