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

computeDiskUserRegexString in resource_compute_disk.go should also accept projectIds that contain ":" or "." #1145

Merged
merged 5 commits into from
Mar 2, 2018

Conversation

derfloh
Copy link
Contributor

@derfloh derfloh commented Mar 2, 2018

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

@nat-henderson nat-henderson self-requested a review March 2, 2018 19:13
Copy link
Contributor

@nat-henderson nat-henderson left a 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/?",
Copy link
Contributor

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:"?

Copy link
Contributor

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".

@@ -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]*)$"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

@nat-henderson nat-henderson left a 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.

@nat-henderson nat-henderson merged commit 5ea98d2 into hashicorp:master Mar 2, 2018
modular-magician added a commit to modular-magician/terraform-provider-google that referenced this pull request Sep 27, 2019
@ghost
Copy link

ghost commented Mar 29, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 29, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants