-
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
Missing google_project_service data source #5132
Missing google_project_service data source #5132
Comments
Hey @ondrejklucka! I'm curious what your use case for this datasource is. Have you found that you often need to check in Terraform whether services are enabled? And in what cases? Since there's no way to specify a service as disabled in TF, the only actionable thing TF can do for a disabled service is enable it. Generally, I see the resource "google_project_service" "spanner" {
service = "spanner.googleapis.com"
disable_on_destroy = true
} That way, your config will work consistently regardless of whether the service was originally enabled or not. |
Hi @rileykarson , thank you for the quick answer. We need to know what APIs have been enabled (directly or as dependency) so that we can apply the appropriate IAM policy bindings on project-level (using google_project_iam_policy resource). |
In my use case, which is also spanner, there is a race condition. When you add the spanner api, it doesn't spin up quickly enough before the instance creation fails. It would be nice if either there were explicit module dependencies or, the way this is often done, poll a data source for the service and make that a dependency of the spanner resources. |
Thanks for the feedback! I'm somewhat surprised the datasource works when the resource doesn't- it should verify that the service is enabled as part of creation. We're tracking this issue as part of our triage process; if there's lots of interest (measured by number of 👍s on the parent post), we're likely to move it up in our priority list. |
This is the issue I run into, for context
module:
Error Message:
|
I do have the same problem here, the main use cases for data source is related to the If you want to be authoritative on your project IAM policiy, you need to know the enabled services (and also the services enabled by dependencies). You may need to add some IAM rules for service-specific service accounts. I did this with some conditional magic inside my While removing the resource |
It's nice to have. We were using it to check if "container.googleapis.com" is enabled for a project. |
b/263562201 |
Open Query:
I've created a PR for the time being to add the |
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. |
Community Note
Description
In 3.x release, both resource and data source for google_project_services have been removed from the provider. However, the now recommended google_project_service resource is missing data source.
What's the best way to check if API has been enabled in the project? Does google_project_service data source make sense?
New or Affected Resource(s)
Potential Terraform Configuration
In 3.1.0 release:
References
The text was updated successfully, but these errors were encountered: