Skip to content

Conversation

@SarahFrench
Copy link
Member

@SarahFrench SarahFrench commented Oct 20, 2025

This PR enables E2E testing with pluggable state storage:

  • Implements PSS support in the grpcwrap package, which is needed to allow provider-like code in Core to behave like it's a real separate provider plugin.
  • Implements an inmem and fs state store in the v6 version of terraform-provider-simple
    • Note: the filesystem PSS implementation doesn't include locking 🙈
  • Adds E2E tests using the two PSS implementations, showing an init followed by an apply command.

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 Oct 20, 2025
Comment on lines +23 to +30
// InMemStoreSingle allows 'storing' state in memory for the purpose of testing.
//
// "Single" reflects the fact that this implementation does not use any global scope vars
// in its implementation, unlike the current inmem backend. HOWEVER, you can test whether locking
// blocks multiple clients trying to access the same state at once by creating multiple instances
// of backend.Backend that wrap the same provider.Interface instance.
type InMemStoreSingle struct {
states stateMap
locks lockMap
Copy link
Member Author

Choose a reason for hiding this comment

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

For context, the inmem backend uses these global vars:

// we keep the states and locks in package-level variables, so that they can be
// accessed from multiple instances of the backend. This better emulates
// backend instances accessing a single remote data store.
var (
states stateMap
locks lockMap
)

Like the code comment says, multiple backends can attempt to access the same state by using the same providers.Interface instance to create them.

@SarahFrench SarahFrench changed the title PSS : Add inmem state storage implementation to the builtin terraform provider PSS : Add inmem state storage implementation to the builtin terraform provider, update grpcwrap package, use PSS implementation in E2E test Oct 24, 2025
@SarahFrench SarahFrench force-pushed the pss/add-builtin-inmem-state-storage-implementation branch from a4887d9 to ef6dc39 Compare October 24, 2025 11:04
Comment on lines 110 to 111
run: |
TF_ACC=1 go test -v ./internal/command/e2etest
TF_TEST_EXPERIMENT=1 TF_ACC=1 go test -v ./internal/command/e2etest
Copy link
Member Author

Choose a reason for hiding this comment

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

Something to bear in mind is that E2E tests also run in the context of the build workflow. I think it'd best to avoid enabling experiments to leak to that workflow, and instead have experimental tests skipped when running in that context.

@SarahFrench SarahFrench force-pushed the pss/add-builtin-inmem-state-storage-implementation branch 2 times, most recently from 0f01ff6 to 2fadb1e Compare October 24, 2025 11:38
@SarahFrench SarahFrench changed the title PSS : Add inmem state storage implementation to the builtin terraform provider, update grpcwrap package, use PSS implementation in E2E test PSS : Add fs and inmem state storage implementationd to the builtin simplev6 provider, update grpcwrap package, use PSS implementation in E2E test Oct 30, 2025
…to make relationship to (Meta).Backend more obvious.
…tations, pass through requests to matching store based on type name.
… implementation; add embeddable unimplementedProviderInterface struct
…orm provider. Stop people using it unless TF_ACC is set.
@SarahFrench SarahFrench force-pushed the pss/add-builtin-inmem-state-storage-implementation branch from 727ae19 to 8f77b19 Compare November 3, 2025 11:05
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