-
Notifications
You must be signed in to change notification settings - Fork 10.1k
PSS: Add stateStoreInitFromConfig
method to Meta
#37723
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
Conversation
// NOTE: the backend version of this method, `backendInitFromConfig`, prompts users for input if any required fields | ||
// are missing from the backend config. In `stateStoreInitFromConfig` we don't do this, and instead users will see an error. | ||
func (m *Meta) stateStoreInitFromConfig(c *configs.StateStore, factory providers.Factory) (backend.Backend, cty.Value, cty.Value, tfdiags.Diagnostics) { |
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.
Highlighting this comment.
The backend equivalent of this method prompts users for input when required fields aren't set. I find this to be an odd feature; is this a first-class feature that gives users a preferable was to pass values into Terraform? If there are missing fields I'd expect an error to happen and users to update their config and/or ENVs.
I'm assuming it's a legacy-ish feature that we wouldn't choose to add now, so I've excluded it from this implementation. If feature request for this comes in future we can act on it.
525fe3b
to
eaf8717
Compare
stateStoreInitFromConfig
method to Meta
stateStoreInitFromConfig
method to Meta
, update savedStateStore
to include chunk size negotiation.
7bc1477
to
f5de2b3
Compare
stateStoreInitFromConfig
method to Meta
, update savedStateStore
to include chunk size negotiation.stateStoreInitFromConfig
method to Meta
…st to assert it's set
…sed in, add unhappy path tests
28af9dd
to
9237ded
Compare
…ides with state stores
… of accepting all BackendOpts This is to avoid confusion, e.g. unnecessary duplication of config being passed in.
…hunk size is negotiated
…rror if the provider doesn't return a chunk size > 0
f5de2b3
to
9304b20
Compare
|
||
func configBodyForTest(t *testing.T, config string) hcl.Body { | ||
t.Helper() | ||
f, diags := hclsyntax.ParseConfig([]byte(config), "", hcl.Pos{Line: 1, Column: 1}) |
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.
f, diags := hclsyntax.ParseConfig([]byte(config), "", hcl.Pos{Line: 1, Column: 1}) | |
f, diags := hclsyntax.ParseConfig([]byte(config), "", hcl.InitialPos) |
https://pkg.go.dev/github.com/hashicorp/hcl/[email protected]#pkg-variables
This PR adds a new
stateStoreInitFromConfig
method that's similar to the existingbackendInitFromConfig
method onMeta
.The
stateStoreInitFromConfig
method added in this PR is used to get abackend.Backend
instance that uses pluggable state storage internally. The returned PSS is configured using the configuration in the TF project, in contrast to thesavedStateStore
method that does the same but uses backend state files for configuring the state store. These methods are both analogous tobackendInitFromConfig
andsavedBackend
.Additionally, this PR adds some test coverage for a related method,
stateStoreConfig
.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