AccessDenied
terraform
auth_error
ai_generated
true
错误:访问远程状态时出错:AccessDenied:访问被拒绝
Error: error accessing remote state: AccessDenied: Access Denied
ID: terraform/terraform-apply-permission-denied-s3-backend
85%修复率
86%置信度
1证据数
2023-05-12首次发现
版本兼容性
| 版本 | 状态 | 引入 | 弃用 | 备注 |
|---|---|---|---|---|
| Terraform v1.0+ | active | — | — | — |
| AWS S3 backend | active | — | — | — |
根因分析
IAM 用户/角色没有足够的权限来读/写用于远程状态存储的 S3 存储桶。
English
The IAM user/role does not have sufficient permissions to read/write the S3 bucket used for remote state storage.
官方文档
https://developer.hashicorp.com/terraform/language/settings/backends/s3#s3-bucket-permissions解决方案
-
将必要的 IAM 策略附加到用户/角色:对状态存储桶的 s3:ListBucket、s3:GetObject、s3:PutObject、s3:DeleteObject
-
检查 S3 存储桶策略或 ACL 是否阻止访问;更新存储桶策略以允许 IAM 角色
无效尝试
常见但无效的做法:
-
80% 失败
Reconfiguration does not change IAM permissions; still fails.
-
30% 失败
Region mismatch is not the cause; permissions are region-agnostic for S3.