-
Notifications
You must be signed in to change notification settings - Fork 822
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
terraform: update secret iam to depend on secrets #2847
Conversation
This is a subtle ordering bug that appears to only surface when new secrets are created. The workaround was to just keep re-running `terraform apply` until it worked The first time I ran `terraform apply` for k8s-infra-prow-build, there were secrets to be created, and then iam bindings to be applied on those secrets. But terraform didn't know about that ordering, because the iam bindings depended on the same locals that the secrets did, so terraform tried to create them all in parallel. This resulted in terraform erroring out on first run, because it was trying to create iam bindings on secrets that didn't yet exist. When I reran `terraform apply` the secrets had been created, so the iam bindings succeeded. One way to let terraform know about an ordering like this is to have one terraform resource use the value of another. Another way would be an explicit `depends_on`, but that's described as a last resort, and we're not out of options here.
/hold |
/lgtm |
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.
/lgtm
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cpanato, spiffxp The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/hold cancel |
Related:
This is a subtle ordering bug that appears to only surface when new
secrets are created. The workaround was to just keep re-running
terraform apply
until it workedThe first time I ran
terraform apply
for k8s-infra-prow-build, therewere secrets to be created, and then iam bindings to be applied on those
secrets. But terraform didn't know about that ordering, because the
iam bindings depended on the same locals that the secrets did, so
terraform tried to create them all in parallel.
This resulted in terraform erroring out on first run, because it was
trying to create iam bindings on secrets that didn't yet exist. When I
reran
terraform apply
the secrets had been created, so the iambindings succeeded.
One way to let terraform know about an ordering like this is to have one
terraform resource use the value of another. Another way would be an
explicit
depends_on
, but that's described as a last resort, and we'renot out of options here.