Move google_project_service
into the provider configuration / add enabled_services
to the provider
#12283
Labels
google_project_service
into the provider configuration / add enabled_services
to the provider
#12283
Community Note
Description
Every time I add a new kind of GCP resource to my terraform configuration, I need to add a
google_project_service
to enable the API for that kind of GCP resource.This leads to a configuration that looks like the following:
where nearly every resource requires
depends_on
to be added to it in order to assure that the resource will be applied cleanly, by forcing Terraform to enable the API before trying to use the API to create the resource. This is error prone - often thedepends_on
lines are forgotten.Instead, allow moving the
google_project_service.enabled
into the provider configuration. This will ensure that the provider always has the APIs enabled.New or Affected Resource(s)
Potential Terraform Configuration
References
Take a leaf out of the AWS provider - instead of needing to attach
tags
to every single resource created by the AWS provider, they added adefault_tags
option to the provider so that it could be configured once at the provider level and not on every single resource. Reference: https://www.hashicorp.com/blog/default-tags-in-the-terraform-aws-providerThe text was updated successfully, but these errors were encountered: