For a standard tf boilerplate:
provider "google" {}
How do I get what is the provider's default project and region? Something analogous to aws_region in AWS (like in this question), but for Google Compute Engine (GCE/GCP).
In some cases these are specified externally in the environment variables:
export GOOGLE_PROJECT=myproject
export GOOGLE_REGION=europe-west2
terraform apply
Less often they are overridden in hcl code:
provider "google" {
project = "myproject"
region = "europe-west2"
}
This fails with A managed resource "provider" "google" has not been declared in the root module.:
output "region" {
value = provider.google.region
}