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

provider/google: Use resource-specific project when waiting for creation, instead of global #7029

Conversation

igorwwwwwwwwwwwwwwwwwwww
Copy link

@igorwwwwwwwwwwwwwwwwwwww igorwwwwwwwwwwwwwwwwwwww commented Jun 6, 2016

Creating a google_compute_instance resource uses the compute_operation to wait for the creation to complete. However, the computeOperationWaitZone function always uses the global config.Project, instead of the instance-specific one.

This means that creating an instance in a project other than the main one fails with a 404 on the operation resource.

This patch uses the project from google_compute_instance instead of the global one.

@igorwwwwwwwwwwwwwwwwwwww igorwwwwwwwwwwwwwwwwwwww changed the title Use instance-specific project when waiting for instance creation, ins… Use instance-specific project when waiting for instance creation, instead of global Jun 6, 2016
@igorwwwwwwwwwwwwwwwwwwww
Copy link
Author

It is quite possible that other resources are also affected by this. If you like, I could put some work into identifying them and addressing them in this pull request.

@igorwwwwwwwwwwwwwwwwwwww
Copy link
Author

I forgot to paste the error that I got prior to this patch:

* google_compute_instance.bastion-b: Error waiting for instance to create: googleapi: Error 404: The resource 'projects/main-project/zones/us-central1-b/operations/operation-1465231044051-5349eafe50039-0d859069-041314f8' was not found, notFound

@igorwwwwwwwwwwwwwwwwwwww igorwwwwwwwwwwwwwwwwwwww changed the title Use instance-specific project when waiting for instance creation, instead of global Google: Use instance-specific project when waiting for instance creation, instead of global Jun 6, 2016
@igorwwwwwwwwwwwwwwwwwwww igorwwwwwwwwwwwwwwwwwwww changed the title Google: Use instance-specific project when waiting for instance creation, instead of global provider/google: Use instance-specific project when waiting for instance creation, instead of global Jun 6, 2016
…tion

Creating most google cloud resources uses the compute_operation to
wait for the creation to complete. However, the computeOperationWait*
functions always uses the global `config.Project`, instead of the resource-
specific one.

This means that creating resource in a project other than the main one
fails with a 404 on the operation resource.

This patch uses the project from google_compute_instance instead of the
global one.
@igorwwwwwwwwwwwwwwwwwwww igorwwwwwwwwwwwwwwwwwwww changed the title provider/google: Use instance-specific project when waiting for instance creation, instead of global provider/google: Use resource-specific project when waiting for creation, instead of global Jun 10, 2016
@igorwwwwwwwwwwwwwwwwwwww
Copy link
Author

I've gone ahead and passed the project for every resource in the google provider. And I've squashed the commits. This patch should now be complete!

@phinze
Copy link
Contributor

phinze commented Jun 10, 2016

Thanks for this @igorwwwwwwwwwwwwwwwwwwww! I'm going to defer to @lwander - our local GCP guru - for review. 👍

@lwander
Copy link
Contributor

lwander commented Jun 11, 2016

LGTM! @sethvargo was recently working on refactoring the GCP project stuff - is this OK with you?

@sethvargo
Copy link
Contributor

Hi @igorwwwwwwwwwwwwwwwwwwww

You have the coolest GitHub username.

This change looks good to me

@igorwwwwwwwwwwwwwwwwwwww
Copy link
Author

thanks for the review folks! :)

@phinze could you take another look at this?

@igorwwwwwwwwwwwwwwwwwwww
Copy link
Author

Bump

@lwander lwander merged commit 953e2ec into hashicorp:master Aug 4, 2016
@igorwwwwwwwwwwwwwwwwwwww igorwwwwwwwwwwwwwwwwwwww deleted the google-instance-wait-project branch August 7, 2016 21:28
@ghost
Copy link

ghost commented Apr 23, 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 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.

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

Successfully merging this pull request may close these issues.

4 participants