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

Unable to handle % character in resource names on GCP #10005

Closed
vsaroha opened this issue Sep 3, 2021 · 2 comments
Closed

Unable to handle % character in resource names on GCP #10005

vsaroha opened this issue Sep 3, 2021 · 2 comments
Assignees
Labels
bug forward/review In review; remove label to forward service/pubsub

Comments

@vsaroha
Copy link

vsaroha commented Sep 3, 2021

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 the modular-magician user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned to hashibot, a community member has claimed the issue already.

Terraform Version

1.0.5

Affected Resource(s)

  • google_pubsub_subscription

Terraform Configuration Files

resource "google_pubsub_topic" "hello_world" {
  name = "hello-world"
}

resource "google_pubsub_subscription" "hello_world" {
  name = "hello%world"

  topic = google_pubsub_topic.hello_world.name
}

Debug Output

  # google_pubsub_subscription.hello_world will be created
  + resource "google_pubsub_subscription" "hello_world" {
      + ack_deadline_seconds       = (known after apply)
      + id                         = (known after apply)
      + message_retention_duration = "604800s"
      + name                       = "hello%world"
      + path                       = (known after apply)
      + project                    = (known after apply)
      + topic                      = "hello-world"

      + expiration_policy {
          + ttl = (known after apply)
        }
    }

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

Do you want to perform these actions?
  Terraform will perform the actions described above.
  Only 'yes' will be accepted to approve.

  Enter a value: yes

google_pubsub_subscription.hello_world: Creating...
╷
│ Error: Error creating Subscription: parse "https://pubsub.googleapis.com/v1/projects/streem-144523/subscriptions/hello%world": invalid URL escape "%wo"
│
│   with google_pubsub_subscription.hello_world,
│   on pubsub.tf line 10, in resource "google_pubsub_subscription" "hello_world":
│   10: resource "google_pubsub_subscription" "hello_world" {
│

https://gist.github.com/vsaroha/ccd832c376f9124ef3ad5929a1e310d2

Panic Output

Expected Behavior

Pubsub subscription should have been created. Google doesn't restrict having % characters in the subscription names.
https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions#resource:-subscription

Actual Behavior

got the error -
Error: Error creating Subscription: parse "https://pubsub.googleapis.com/v1/projects/streem-144523/subscriptions/hello%world": invalid URL escape "%wo"

Steps to Reproduce

  1. terraform apply

Important Factoids

References

@vsaroha vsaroha added the bug label Sep 3, 2021
@edwardmedia edwardmedia self-assigned this Sep 3, 2021
@edwardmedia
Copy link
Contributor

edwardmedia commented Sep 3, 2021

@vsaroha Thank you for filing this issue. I can repro it and I can also see the name is accepted from the Console. But it is very unusual and vast majority of resources have strict rules on naming convention. Not sure if API will update its validation in the future. Do you have to have this name? I would suggest to avoid this. This is a bug but we may just leave it as is. Closing the issue accordingly.

@github-actions
Copy link

github-actions bot commented Oct 4, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 4, 2021
@github-actions github-actions bot added forward/review In review; remove label to forward service/pubsub labels Jan 14, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug forward/review In review; remove label to forward service/pubsub
Projects
None yet
Development

No branches or pull requests

2 participants