-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
Creating a Project and resources within the same codebase fails #3730
Comments
Confirmed with: # This is only used to create the project itself
provider "google" {
version = ">= 2.5.1, < 3.0.0"
alias = "project"
region = "us-central1"
}
# This is the default provider used to create all resources within the project
provider "google" {
version = ">= 2.5.1, < 3.0.0"
project = google_project.it.id
region = "us-central1"
}
resource "google_project" "it" {
provider = "google.project"
name = "my-project"
project_id = "my-project-######"
auto_create_network = false
billing_account = "######-######-######"
}
data "google_compute_zones" "us" {
region = "us-central1"
} Logs:
|
Thanks for confirming this @rileykarson and raising this upstream - wasn’t sure if it was a provider bug or core 👍 |
Upstream hashicorp#6739. Signed-off-by: Modular Magician <magic-modules@google.com>
Any plans to fix this? My configuration works fine with the stable google provider but fails with the google-beta with the error in the subject. |
This block fails with the google-beta provider but not with the stable one. |
Can you confirm that you've done the same thing as was done in the original issue + my reproduction, interpolated a project into one of your provider blocks? Unfortunately there's no solution in the provider & we need to wait on hashicorp/terraform#4149 being iterated upon. |
I got this error on the config like this:
with Terraform v0.14.0 and google beta provider v3.50.0 |
For that last configuration, the datasource needs an explicit For the issue in general, see hashicorp/terraform#2430. This is not very supported by Terraform & has become less supported over time. |
Community Note
Terraform Version
Affected Resource(s)
google_compute_instance_template
Data: google_compute_default_service_account
Data: google_compute_zones
Possibly others, though this feels like an overall provider bug or usage problem.
Terraform Configuration Files
00-provider.tf
02-data.tf
03-project.tf
Debug Output
Same issue on completely unrelated modules:
Expected Behavior
A clean plan
Actual Behavior
Terraform crashed
Steps to Reproduce
terraform plan
Important Factoids
terraform destroy
on the stack, which was created with TF 0.11google.project
provider are the project itself andgoogle_project_service
The errors disappear if I add the following snippet to the resources:
However I shouldn't have to provide the project explicitly as the resources should use the default (non-aliased) provider, which has the project set at that level.
b/308756165
The text was updated successfully, but these errors were encountered: