hashicorp / terraform-provider-google

Terraform Provider for Google Cloud Platform
https://registry.terraform.io/providers/hashicorp/google/latest/docs
Mozilla Public License 2.0
2.33k stars 1.73k forks source link

Add provider documentation describing use of user_project_override and where APIs need to be enabled relative to which project Terraform's identity is in #18125

Open SarahFrench opened 5 months ago

SarahFrench commented 5 months ago

Community Note

Description

There are various factors that affect if a user encounters a permissions error/service not enabled error:

This problem also surfaces when users create a new project and try to enable APIs in the new service. Depending on their setup that API will need to be enabled in the project that the service account they are using as Terraform's identity is provisioned in. This is confusing and results in erroneous bug reports.

This is also a reason why enabling the service usage API in projects by default (https://github.com/hashicorp/terraform-provider-google/issues/14174) is a feature request that's unlikely to be implemented soon; users would need to set user_project_override correctly to avoid tainting the provisioned project resource if API call to activate the service usage API failing due to lack of permissions.


We should write up some provider documentation that covers all the different scenarios possible with these settings, including scenarios like:

There is an existing guide here about use of google_project_service that might need updating/extending: https://registry.terraform.io/providers/hashicorp/google/latest/docs/guides/google_project_service

The guide would need to cover concepts like:

New or Affected Resource(s)

Potential Terraform Configuration

N/A

References

b/343221059

SarahFrench commented 4 months ago

Here's another data point about where APIs need to be enabled: https://github.com/hashicorp/terraform-provider-google/issues/11255#issuecomment-2188681866

SarahFrench commented 2 months ago

Another example: https://github.com/hashicorp/terraform-provider-google/issues/18281