-
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
data.google_project.project.project_id
sometimes null
#10587
Comments
@asnare using your code, it seems fine with you. After I provided
variable "project" {
type = string
}
provider "google" {
project = var.project
} |
@edwardmedia Hmm. And that is with the With it in place, the
I get the same results when running on two laptops against different GCP subscriptions/accounts. The versions are the identical for both; I get it with provider 4.0.0 and 4.1.0. The lock-file for the debug log I made is:
I'm a bit perplexed as to why you're not seeing the same error. Is there any obvious difference in your DEBUG log? :-/ |
@asnare I see what you mean. As you can see the difference between having |
@asnare closing the issue now based on the behavior observed. Feel free to reopen if you have further questions |
I have the same issue with random It worked for a few days, everything was running smoothly and today, out of nowhere I got:
I spent 3 hours trying to figure out what was wrong, restarting the computer, playing with providers’ versions, digging up open and closed issues. Nothing helped. Returned to the version which worked perfectly yesterday, retried a few times without success, and then... magically, it started working again 🤷.
Extracted sample: terraform {
required_version = ">= 1.0.10"
}
provider "google" {
project = var.project_id
region = var.region
zone = var.zone
}
data "google_project" "project" {}
resource "google_project_iam_binding" "secret_manager_secret_accessor" {
project = var.project_id
role = "roles/secretmanager.secretAccessor"
members = [
"serviceAccount:${data.google_project.project.number}@cloudbuild.gserviceaccount.com"
]
} |
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
modular-magician
user, it is either in the process of being autogenerated, or is planned to be autogenerated soon. If an issue is assigned to a user, that user is claiming responsibility for the issue. If an issue is assigned tohashibot
, a community member has claimed the issue already.Terraform Version
Affected Resource(s)
google_project
(data source)Terraform Configuration Files
A module is needed to demonstrate the problem; this is the minimum set of files I needed to reproduce the issue:
main.tf
modules/problem/main.tf
Debug Output
Some debug output is here, produced by running:
TF_LOG=DEBUG terraform plan -no-color -var project_id=MASKED
Panic Output
No panic is involved.
Expected Behavior
The
google_project
data source inside the module should have a usableproject_id
attribute, irrespective of whether the module depends on another resource/module or not.Actual Behavior
If the enclosing module instantiation has a non-empty
depends_on
property, for some reason the data source inside the module hasnull
for the project_id. This triggers errors such as seen here, where string interpolation fails because null isn't allowed in that context. If thedepends_on
clause is removed then the data source/property all seem to work properly and provide the correct project id.Steps to Reproduce
terraform plan -var project=a_project_id
project_id
from the data source.depends_on
property where the module is being used.terraform plan -var project=a_project_id
Important Factoids
N/A
References
A potential earlier report of the same thing:
null
#9509 (Closed due to inactivity)The text was updated successfully, but these errors were encountered: