Skip to content

Conversation

@SarahFrench
Copy link
Member

@SarahFrench SarahFrench commented Nov 28, 2025

This PR is blocked by review of #37946, #37956, and #37957

Follows #37248

This PR adds validation to stop Terraform writing or using a planfile that has incomplete descriptions of the backend or state store configuration.

Target Release

N/A

Rollback Plan

  • If a change needs to be reverted, we will roll out an update to the code within 7 days.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

CHANGELOG entry

  • This change is user-facing and I added a changelog entry.
  • This change is not user-facing.

@SarahFrench SarahFrench added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Nov 28, 2025
@github-actions

This comment was marked as outdated.

@SarahFrench SarahFrench force-pushed the pss/update-how-operations-use-backend-config-state branch from 94d4233 to 9a018e9 Compare November 28, 2025 12:25
@SarahFrench SarahFrench force-pushed the pss/update-how-operations-use-backend-config-state branch from 9a018e9 to d16ebe6 Compare November 28, 2025 12:47
@SarahFrench SarahFrench force-pushed the pss/validate-backend-state-store-config-in-plans branch from b44b360 to c6922ef Compare November 28, 2025 12:55
@SarahFrench SarahFrench force-pushed the pss/update-how-operations-use-backend-config-state branch from d16ebe6 to f795158 Compare November 28, 2025 16:16
@SarahFrench SarahFrench force-pushed the pss/validate-backend-state-store-config-in-plans branch from c6922ef to e3f20b8 Compare December 2, 2025 13:37
…Backend, so the planfile's Backend struct isn't flagged as empty.
…f a backend or state store is complete

The alternative approach would be to change the existing `Backend` field in the `Plan` struct to be a pointer. I'm open to either option, but the approach of using an `Empty` method matches existing work in the `workdir` package when inspecting the backend state file, and that seems a similar use-case to inspecting the plan file.
…e store is complete when reading or writing a plan file
@SarahFrench SarahFrench force-pushed the pss/validate-backend-state-store-config-in-plans branch from e3f20b8 to 45bac84 Compare December 18, 2025 15:07
@SarahFrench SarahFrench changed the base branch from pss/update-how-operations-use-backend-config-state to main December 18, 2025 15:08
Comment on lines 113 to 114
func Test_writeTfplan_validation(t *testing.T) {
cases := map[string]struct {
Copy link
Member Author

@SarahFrench SarahFrench Dec 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Needs cases covering the Backend validation, but backend validation covered in internal/plans/plan_test.go also.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog-needed Add this to your PR if the change does not require a changelog entry

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant