Skip to content

Conversation

@vietcgi
Copy link
Contributor

@vietcgi vietcgi commented Dec 13, 2025

Summary

  • Improves error message when backend state file contains Terraform state data instead of backend configuration

Test plan

  • Unit tests added for new error detection
  • All existing tests pass
  • Real-world scenario tested manually

Fixes #37953

@vietcgi vietcgi requested a review from a team as a code owner December 13, 2025 11:49
@crw
Copy link
Contributor

crw commented Dec 16, 2025

Hi @vietcgi, we agree this is an issue, however, at triage the consensus is that we should seek a different solution. Specifically, disallow the local backend from saving state files in the .terraform folder. This would be achieved when validating the local backend’s config, prevents users creating the situation in the first place. This solution would give the team more freedom around evolving backend state files in future Terraform versions.

Please feel free to open a new PR with the above solution! We would be happy to review it. Feel free to comment if you have any questions. Thanks!

@crw crw closed this Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

produce a better error message when the stored backend configuration is corrupted

2 participants