Skip to content

Conversation

@SarahFrench
Copy link
Member

@SarahFrench SarahFrench commented Oct 31, 2025

(Stacked on top of #37790, due to needing simple6 implementations of PSS for E2E testing)

This PR introduces a bunch of testing to show that the workspace commands work in combination with pluggable state storage. There is both an integration test and an E2E test showing that PSS can be used in the context of this sequence of actions:

  • Running init to create a default workspace
  • Creating a custom workspace
  • Listing all workspaces present
  • Selecting a different workspace
  • Showing the selected workspace
  • Deleting a workspace

In this PR I also updated how workspace new is implemented. This new code comment explains how the command previously achieved creating a new workspace:

// Create the new workspace
//
// In local, remote and remote-state backends obtaining a state manager
// creates an empty state file for the new workspace as a side-effect.
//
// The cloud backend also has logic in StateMgr for creating projects and
// workspaces if they don't already exist.
sMgr, sDiags := b.StateMgr(workspace)

Pluggable state stores intentionally don't have side-effects in the same way, and instead Terraform is expected to create the state file explicitly. I've updated the workspace new command to identify when PSS is in use and to only attempt to create the state file when that's the case. Due to this there isn't an issue of state files being 'created twice' etc when PSS isn't 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.

@SarahFrench SarahFrench force-pushed the pss/add-builtin-inmem-state-storage-implementation branch from 727ae19 to 8f77b19 Compare November 3, 2025 11:05
@SarahFrench SarahFrench force-pushed the pss/make-worspace-new-work-with-pss branch from 3226e68 to 345fef9 Compare November 3, 2025 11:06
@SarahFrench SarahFrench added the no-changelog-needed Add this to your PR if the change does not require a changelog entry label Nov 3, 2025
@SarahFrench SarahFrench force-pushed the pss/add-builtin-inmem-state-storage-implementation branch from 8f77b19 to 316d5b5 Compare November 6, 2025 12:40
@SarahFrench SarahFrench force-pushed the pss/make-worspace-new-work-with-pss branch from 165b8a4 to d371f7a Compare November 6, 2025 15:10
@SarahFrench SarahFrench force-pushed the pss/make-worspace-new-work-with-pss branch from af8745d to 1e07af1 Compare November 7, 2025 11:24
We still need an E2E test for this, to ensure that the GRPC-related packages pass all the expected data between core and the provider.
Comment on lines 1842 to 1845
protoReq := &proto6.DeleteState_Request{
TypeName: r.TypeName,
StateId: r.StateId,
}
Copy link
Member Author

Choose a reason for hiding this comment

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

Found a bug during this work 🐛

@SarahFrench SarahFrench changed the title Update the workspace new subcommand to work with PSS, add E2E test. PSS: Update the workspace new subcommand to work with PSS, add E2E and integration tests for using workspace commands with PSS. Nov 7, 2025
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 imagined that future E2E tests related to PSS would all go in this file.

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