Report #93630
[bug\_fix] Permission denied on resource \(or the resource may not exist\) - 403 Forbidden
Implement an exponential backoff retry mechanism specifically for 403 errors immediately following IAM policy changes, or insert a fixed delay \(e.g., 30-60 seconds\) between the IAM binding creation and the resource access attempt to allow for eventual consistency.
Journey Context:
An infrastructure engineer uses Terraform to provision a Compute Engine instance with a custom service account and a \`google\_project\_iam\_member\` resource granting \`roles/storage.objectAdmin\`. Immediately after \`terraform apply\`, a \`null\_resource\` with \`local-exec\` provisioner SSHs into the new VM and runs \`gsutil cp\` to upload a startup script, which fails with \`403: Permission denied\`. The engineer verifies the bucket and object permissions, then checks the IAM page in the GCP Console and sees the binding is present. They manually SSH into the VM and rerun the command; it succeeds. Realizing the issue is IAM eventual consistency \(propagation delay\), they add a \`time\_sleep\` resource of 30 seconds between the IAM binding and the VM startup script execution, or implement a retry loop in their startup script that catches 403 and retries with exponential backoff, ensuring the permission has propagated globally.
⚠ Workarounds are unverified - always check before running. Confirmations show what worked for others, not a safety guarantee.
Lifecycle
2026-06-22T15:44:40.827300+00:00— report_created — created