-
Couldn't load subscription status.
- Fork 10.1k
PSS : Add inmem state storage implementation to the builtin terraform provider, update grpcwrap package, use PSS implementation in E2E test
#37790
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…nfig parsing needs to be explicitly added
… can use already parsed config
…eds to be refactored
…in use within operations backend
| // 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 |
There was a problem hiding this comment.
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:
terraform/internal/backend/remote-state/inmem/backend.go
Lines 24 to 30 in efb2a1c
| // 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.
…to make relationship to (Meta).Backend more obvious.
inmem state storage implementation to the builtin terraform providerinmem state storage implementation to the builtin terraform provider, update grpcwrap package, use PSS implementation in E2E test
…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.
…pace state already.
a4887d9 to
ef6dc39
Compare
| run: | | ||
| TF_ACC=1 go test -v ./internal/command/e2etest | ||
| TF_TEST_EXPERIMENT=1 TF_ACC=1 go test -v ./internal/command/e2etest |
There was a problem hiding this comment.
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.
…n terraform provider
…they can be reused.
15b80f9 to
0f01ff6
Compare
…ther work to allow PSS to be used with other commands.
This provider is not accessible to users so it's unnecessary.
0f01ff6 to
2fadb1e
Compare
This PR copies a bunch of code from the existing
inmembackend and uses it to create aninmemversion of a pluggable state store in the builtinterraformprovider.This will only be accessible if a user has TF_ACC set in their environment, which is a standard ENV for enabling test-specific behaviour or actions. This won't fully block a user from accessing the state store, but it provides more friction than the current inmem backend, which is just not documented.
I'm sharing this work for feedback before adding it to terraform-provider-simple6, for E2E testing
Target Release
N/A
Rollback Plan
Changes to Security Controls
Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.
CHANGELOG entry