-
Notifications
You must be signed in to change notification settings - Fork 64
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
fix: Secrets when project_id is known after apply #95
fix: Secrets when project_id is known after apply #95
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR @deas
main.tf
Outdated
project_id = each.value | ||
} | ||
|
||
data "google_project" "main" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we only create this if any secrets exist?
count = length(var.secret_environment_variables) > 0 ? 1 : 0
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think not, because doing just that would break:
try(data.google_project.nums[secret_environment_variables.value["project_id"]].number, data.google_project.default.number)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure I follow can't we just do
try(data.google_project.nums[secret_environment_variables.value["project_id"]].number, data.google_project.default[0].number)
IIUC we use this just for secrets and length of secret_environment_variables
should be known at apply time even if values are not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, missed that. Updated the PR.
6f374ba
to
283daf4
Compare
9fb64c5
to
df5a79e
Compare
@deas |
Current code fails for me when the project hosting the function is created in the same execution:
The attached patch fixes this for me.
Please see hashicorp/terraform#28925 for a more detailed description of the general problem.