Terraform: Error: Failed to load state: AccessDenied: Access Denied / Error refreshing state: AccessDenied status code: 403
Terraform can't read/write the S3 bucket (or DynamoDB table) that stores state — IAM permissions or wrong credentials/role.
Error: Failed to load state: AccessDenied: Access DeniedError refreshing state: AccessDenied: Access Denied status code: 403Error: error loading state: AccessDeniedFailed to save state: failed to upload state: AccessDeniedError: Error acquiring the state lock AccessDeniedException dynamodb Meaning
The identity needs s3:ListBucket on the bucket and s3:GetObject/PutObject/DeleteObject on the key, plus dynamodb:GetItem/PutItem/DeleteItem for locking, and kms:* if encrypted. Verify the AWS profile/role in use (aws sts get-caller-identity), bucket policy/SCPs, region and the role_arn.
Common causes
- Missing s3:GetObject/PutObject/ListBucket
- DynamoDB lock table permissions missing
- Wrong AWS profile/assumed role
- Bucket policy/SCP/VPC endpoint denying
- KMS key policy denying decrypt
⚡ Quick fix
aws sts get-caller-identityto confirm the identity- Grant S3 + DynamoDB (+KMS) permissions on state resources
- Set
profile/role_arnin the backend block
Detailed fix by platform
AWS
aws s3 ls s3://my-tf-state/path/ && aws sts get-caller-identity
How to diagnose
- Identity — Which role?
- Policy — S3/DynamoDB/KMS?
- Region — Correct?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
- Backend configuration changed (migrate or reconfigure) Terraform: Error: Backend configuration changed — A change in the backend configuration has been detected, which may require migrating existing state
- Backend initialization required Terraform: Error: Backend initialization required, please run "terraform init" — Reason: Initial configuration of the requested backend "s3"
- BucketNotEmpty: bucket you tried to delete is not empty Terraform: Error: deleting S3 Bucket (my-bucket): BucketNotEmpty: The bucket you tried to delete is not empty
Most viewed in Terraform
- Inconsistent dependency lock file Terraform: Error: Inconsistent dependency lock file — provider x: required by this configuration but no version is selected
- Reference to undeclared resource Terraform: Error: Reference to undeclared resource / Reference to undeclared input variable
- Resource is tainted and must be replaced Terraform: # aws_instance.web is tainted, so must be replaced — -/+ destroy and then create replacement
Other ways to find it
Where this error sits
Origin: Platform & cloud. Errors that are often confused with or caused by this one (click to open):
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
💬 What worked for others
No tips yet — did something else fix this for you?
Share what worked for you
Tips are checked by an editor before they appear. Links are removed.
Report a correction or suggest an improvement
Last updated 5 Nov 2026