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

Add new google_project_service resource for fine-grained service control. #668

Merged
merged 3 commits into from
Nov 7, 2017

Conversation

danawillow
Copy link
Contributor

Fixes #482.
Potential fix for #5 and #596.

Also adds retry logic for enabling/disabling because the tests were being too flaky without it.

Copy link
Contributor

@paddycarver paddycarver left a comment

Choose a reason for hiding this comment

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

Minor ID quibble, but otherwise looks good.

return fmt.Errorf("Error enabling service: %s", err)
}

d.SetId(srv)
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we include the project in this, so multiple projects can enable the same service within the same Terraform state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure! Done.

@eilgin
Copy link
Contributor

eilgin commented Nov 7, 2017

👍 x10

I was about to create a PR about it since we were having a lot of inconsistent states when enabling some complex APIs (like appengineflex.googleapis.com) which in turn enabled a lot of APIs (including "private" ones) that render the project deletion impossible.

Copy link
Contributor

@paddycarver paddycarver left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Contributor

@rosbo rosbo left a comment

Choose a reason for hiding this comment

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

Sweet!

@danawillow danawillow merged commit 10e4f68 into hashicorp:master Nov 7, 2017
@danawillow danawillow deleted the is-482 branch November 7, 2017 23:20
@loffelmacher
Copy link

Just to confirm my understanding...I want to use appengine flex in my project, so in order to enable that API I need to "do a little dance" and rely on google_project_service instead of google_project_services and then enable AppEngine Flex and it's dependencies, in the proper order? Is that about right?

@rosbo
Copy link
Contributor

rosbo commented Dec 12, 2017

google_project_service makes sure that the API specified in that resource is enabled.

google_project_services makes sure ONLY the APIs specified in that resource are enabled. If some APIs are enabled and not listed in the google_project_services resource, they will be disabled when running terraform apply.

For your use case, it is up to you. Do you want to make sure only the APIs specified in your config are enabled? If so, use google_project_services. If you want to let users enable API outside of Terraform (for instance: using gcloud or the UI), then go with google_project_service.

I hope this helps :)

chrisst pushed a commit to chrisst/terraform-provider-google that referenced this pull request Nov 9, 2018
…ntrol. (hashicorp#668)

* add new project service resource; add retry logic for enable/disable

* docs for google_project_service

* add project into the id
luis-silva pushed a commit to luis-silva/terraform-provider-google that referenced this pull request May 21, 2019
@ghost
Copy link

ghost commented Mar 30, 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 30, 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.

Make google_project_services fine-grained: add resource to enable/disable a single API
5 participants