-
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
Use of Unique IDs breaks resource.name IAM condition expressions #14419
Comments
@rifelpet did you notice below error in the log? It seems the account itself has not been authenticated before hitting the error you listed.
Using the config you provided (3 resources), I am not able to hit the error. Please detail the steps for reproducing the issues. |
Hi @edwardmedia, thanks for the quick response. Here is a gist with v4.59.0 (the last release before the PR I mentioned) which successfully creates and reads the launch template. The same authentication error is in these logs, leading me to believe the failure may be an attempt to find credentials from a variety of sources and a different source succeeds. In this case the credentials are provided via |
@rifelpet how did you upgrade your provider version from v4.59.0 to v4.63.0? Do you still have the log when the I do see this id,
|
Here is a full gist showing the following steps starting with an empty terraform state:
|
@edwardmedia Did you run the second
the |
@rileykarson here is a fresh log that follows the steps here. Did not hit an error on the subsequent plan/apply. https://gist.github.com/edwardmedia/17484267f83f1c886767978ae890235e |
Discussed offline- to repro this the instance template call would need to come from the second service account (who was granted the conditional permission) rather than from the general Terraform runner that set the IAM policy. |
Changed the runner does lead to the error in the 2nd plan/apply. Below is the log https://gist.github.com/edwardmedia/c27b81075d2fdbc54110f60c10d08ec3 |
I think that log shows a failure to read Its the reading of actual |
Yeah, that log is a different error (we expect you to receive that one). The second service account can only make the instance template call. |
It seems that #14128 's intent to mitigate TOCTOU attacks is fundamentally at odds with the current GCP API's handling of resource.name IAM condition expressions. Unless GCP IAM begins supporting resource.name conditions with requests for unique IDs, would some sort of |
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)
Terraform Configuration Files
Copied from the documentation example:
Debug Output
https://gist.github.com/rifelpet/993436c77c6b3e11df4a3373e6e50515
Panic Output
Expected Behavior
The plan succeeds.
Actual Behavior
The plan fails:
Steps to Reproduce
Setup a GCP Service Account with the following IAM permissions:
Run
terraform plan
using the service account's credentialsImportant Factoids
This started happening after #14128. This changed terraform's read request from:
to
which now fails the
resource.name.endsWith('appserver-template')
IAM condition expression.In the spirit of least priviledge I would like to continue using resource.name IAM condition expressions but having the provider use the Unique ID integer as the resource ID seems to prevent this.
References
b/308755809
The text was updated successfully, but these errors were encountered: