You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Association should be created as expected even if containing a slash in the name.
Actual Behavior
If association name contains a slash '/' , then terraform apply will return the following error:
│ Error: Error creating FirewallPolicyAssociation: googleapi: Error 404: googleapi: Error 400: Invalid value for field 'name': '1234567'. An association with that name does not exist., invalid
│
│ with google_compute_firewall_policy_association.default,
│ on association.tf line 13, in resource "google_compute_firewall_policy_association" "default":
│ 13: resource "google_compute_firewall_policy_association" "default" {
│
renato-rudnicki
changed the title
Error when creating FirewallPolicyAssociation with Names Containing '/' Character"
Bug: Error when creating FirewallPolicyAssociation with Names Containing '/' Character"
Dec 10, 2024
Community Note
Terraform Version & Provider Version(s)
Terraform v1.5.7
on Linux Ubuntu 22.04.4 LTS
Affected Resource(s)
google_compute_firewall_policy_association
Terraform Configuration
Debug Output
https://gist.github.com/renato-rudnicki/8f0636f7bfd0ced0cd9b36c12cab145b
Expected Behavior
Association should be created as expected even if containing a slash in the name.
Actual Behavior
If association name contains a slash '/' , then terraform apply will return the following error:
│ Error: Error creating FirewallPolicyAssociation: googleapi: Error 404: googleapi: Error 400: Invalid value for field 'name': '1234567'. An association with that name does not exist., invalid
│
│ with google_compute_firewall_policy_association.default,
│ on association.tf line 13, in resource "google_compute_firewall_policy_association" "default":
│ 13: resource "google_compute_firewall_policy_association" "default" {
│
Steps to reproduce
terraform apply
Important Factoids
As workaround, using a replace fix the issue:
resource "google_compute_firewall_policy_association" "association" {
for_each = toset(var.associations)
name = replace("${local.policy_id}-${each.value}", "/", "-")
firewall_policy = google_compute_firewall_policy.policy.id
attachment_target = each.value
}
References
terraform-google-modules/terraform-example-foundation#1354
The text was updated successfully, but these errors were encountered: