-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
computeDiskUserRegexString in resource_compute_disk.go should also accept projectIds that contain ":" or "." #1145
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks so much! We appreciate the patch. :)
shouldFail := []string{ | ||
"https://www.googleapis.com/compute/v1/projects/project#/zones/us-central1/instances/123", | ||
"https://www.googleapis.com/compute/v1/projects/project/zones/us-central#/instances/123", | ||
"https://www.googleapis.com/compute/v1/projects/project/zones/us-central1/instances/?", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks right - can you add a shouldFail test for "foo.com:bar:baz", and "foo.com:"?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, though of course those should fail, I meant as project names:
"https://www.googleapis.com/compute/v1/projects/foo.com:bar:baz/zones/us-central1/instances/123".
google/resource_compute_disk.go
Outdated
@@ -13,7 +13,7 @@ import ( | |||
) | |||
|
|||
const ( | |||
computeDiskUserRegexString = "^(?:https://www.googleapis.com/compute/v1/projects/)?([-_a-zA-Z0-9]*)/zones/([-_a-zA-Z0-9]*)/instances/([-_a-zA-Z0-9]*)$" | |||
computeDiskUserRegexString = "^(?:https://www.googleapis.com/compute/v1/projects/)?([-_a-zA-Z0-9:.]*)/zones/([-_a-zA-Z0-9]*)/instances/([-_a-zA-Z0-9]*)$" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just a little bit too loose: you probably want this regex right here:
https://github.com/terraform-providers/terraform-provider-google/blob/411017c35f96ff73b951e49607093b442cad360a/google/validation.go#L15:2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great, running tests and merging.
Signed-off-by: Modular Magician <[email protected]>
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 feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks! |
I ran into problems, when I had a project that was using a project ID in the format of "hashicorptest.net:my-project".
The problem came up, when terraform tried to delete attached disks and threw an error like "Unknown user XXX of disk YYY"
This PR adds ":" and "." to the projectID part of computeDiskUserRegexString