Skip to content

Conversation

SarahFrench
Copy link
Member

@SarahFrench SarahFrench commented Sep 3, 2025

Description

This PR adds a new savedStateStore method that's similar to the existing savedBackend method on Meta.

The savedBackend method on Meta returns a backend that's configured using the backend state file's contents and isn't influenced by the current config. This method is used during state migration events in init commands, where Terraform needs to have an instance of the old backend, configured the old way, in order to access state to migrate to the new backend's location.

Note: There is a variant called backendFromState that does a similar job but isn't considered in this PR. This variant is specific to users running init commands with -backend=false as a flag.

This PR adds a new savedStateStore method that's similar to the existing savedBackend method on Meta. The method uses only backend state file data to configure and return a backend.Backend instance made using a provider that implements pluggable state storage.

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 changed the title Pss/add saved state store method PSS: Add savedStateStore method to Meta Sep 3, 2025
@SarahFrench SarahFrench added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Sep 3, 2025
Comment on lines +1616 to +1618
// Validate and configure the provider
validateResp := provider.ValidateProviderConfig(providers.ValidateProviderConfigRequest{
Config: providerConfigVal,
Copy link
Member Author

Choose a reason for hiding this comment

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

I believe we don't need to consider marks here as the data is coming from the backend state file (which cannot store marks), but if we were configuring the state store from configuration then we would need to consider marks here. Just flagging for discussion with reviewer(s).

@SarahFrench SarahFrench force-pushed the pss/add-saved-state-store-method branch from 03793cc to 678807b Compare September 5, 2025 09:21
@SarahFrench SarahFrench marked this pull request as ready for review September 8, 2025 16:38
@SarahFrench SarahFrench requested a review from a team as a code owner September 8, 2025 16:38
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