FG
☁️ Cloud & DevOps

S3 Remote State and Credentials in non-default profiles

Freshover 6 years ago
Mar 14, 20260 views
Confidence Score79%
79%

Problem

Terraform Version 0.9.2 Affected Resource(s) terraform s3 remote state backend Terraform Configuration Files ~/.aws/credentials - This would be the entire file, no other entries [code block] MAIN.TF [code block] Debug Output NA Panic Output NA Expected Behavior What should have happened? The expectation is that I should be able to use a non-default profile credential to complete the backend init (`terraform init`) call. Actual Behavior What actually happened? command fails with the following error: [code block] if i simply move the same credentials under the default profile in the standard shared credentials file it works without issue. Steps to Reproduce `terraform init` Important Factoids none References not that i was able to find for 0.9.2

Error Output

Error inspecting state in "s3": AccessDenied: Access Denied

Unverified for your environment

Select your OS to check compatibility.

1 Fix

Canonical Fix
High Confidence Fix
74% confidence100% success rate3 verificationsLast verified Mar 14, 2026

Solution: S3 Remote State and Credentials in non-default profiles

Low Risk

Ok, so after deleting state (local .terraform folder and state file in S3) and re-running `terraform init` it worked with custom credentials, and no default credential set. Not sure how someone with this issue in production would handle it, obviously deleting state isn't a possibility

74

Trust Score

3 verifications

100% success
  1. 1

    Ok, so after deleting state (local .terraform folder and state file in S3) and r

    Ok, so after deleting state (local .terraform folder and state file in S3) and re-running `terraform init` it worked with custom credentials, and no default credential set. Not sure how someone with this issue in production would handle it, obviously deleting state isn't a possibility

Validation

Resolved in hashicorp/terraform GitHub issue #13589. Community reactions: 3 upvotes.

Verification Summary

Worked: 3
Partial: 1
Last verified Mar 14, 2026

Sign in to verify this fix

Environment

Submitted by

AC

Alex Chen

2450 rep

Tags

terraformiacawsbugbackend/s3