Skip to content

Conversation

@SarahFrench
Copy link
Member

@SarahFrench SarahFrench commented Dec 2, 2025

This PR follows #37956

Whereas that PR allowed a plan operation to produce a plan file that described a state store, this PR enables apply operations that use a plan file to configure a state store using the data stored in the plan.

This new feature is tested by integration tests and an E2E test that shows the full init-plan-apply workflow when a pluggable state store is in use.

Target Release

1.15.x

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.

…ng it to prepare a Local backend that uses the state store
…quired providers, if PSS is in use.

See the code comment added in this commit. This addition does not impact an apply command as the missing provider will be detected before this code is executed. However I'm making this change so that the method is still accurate is being able to return a complete list of providers needed by the plan.
…or state store config when getting a backend from a planfile
…der is launched and the state store is configured
@SarahFrench SarahFrench force-pushed the pss/state-store-from-plan-file branch from df01aae to 75e2e46 Compare December 11, 2025 15:54
@SarahFrench SarahFrench marked this pull request as ready for review December 15, 2025 18:25
@SarahFrench SarahFrench requested a review from a team as a code owner December 15, 2025 18:25
radeksimko
radeksimko previously approved these changes Dec 17, 2025
Comment on lines 410 to 414
suggestions := slices.Sorted(maps.Keys(resp.StateStores))
suggestion := didyoumean.NameSuggestion(settings.Type, suggestions)
if suggestion != "" {
suggestion = fmt.Sprintf(" Did you mean %q?", suggestion)
}
Copy link
Member

Choose a reason for hiding this comment

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

Wouldn't users hit this earlier when producing the plan? 🤔

I'm just trying to understand how realistic it is to have a typo'd state store name inside the plan file and how would users address it.

Copy link
Member Author

@SarahFrench SarahFrench Dec 17, 2025

Choose a reason for hiding this comment

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

That's true, this is an artefact of me copy code from elsewhere. I think once we've got most of the init code in place for PSS we'd be able to identify places where we can pull repeated code into reusable methods etc, but the different contexts (from backend state, from config, from plan, etc) might have different needs.

For now I'll remove this from here as I agree it's unlikely to be relevant in the context of a state store from a plan - 50145af

address := addrs.AbsProviderConfig{
Module: addrs.RootModule, // A state_store block is only ever in the root module
Provider: *p.StateStore.Provider.Source,
// Alias: aliases are not permitted when using a provider for PSS.
Copy link
Member

Choose a reason for hiding this comment

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

Nitpick: Do we actually validate this? 🤔 We can address in a separate PR if not.

Copy link
Member Author

Choose a reason for hiding this comment

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

There is some validation here:

if provider.AliasRange != nil {
// This block is in its own namespace in the state_store block; aliases are irrelevant
return nil, append(diags, &hcl.Diagnostic{
Severity: hcl.DiagError,
Summary: "Unexpected provider alias",
Detail: "Aliases are disallowed in the 'provider' block in the 'state_store' block",
Subject: provider.AliasRange,
})
}

But I think there isn't any test coverage for that - I can make a ticket for that

…ile using PSS doesn't match the resources available in the project
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.

2 participants