Commit graph

4 commits

Author SHA1 Message Date
Radek Simko
0fe906fa8c make copyrightfix 2026-02-17 13:56:34 +00:00
Sarah French
d02a1ed1b7
PSS: Make the state storage provider's config stateful (backend state, planfiles) (#37286) 2025-07-08 15:32:27 +01:00
Sarah French
2349481b23
Update data stored in plan files to enable using PSS with saved plans (#37246)
* Implement `ForPlan` method on `StateStoreConfigState`, add `Planner` interface

* Rename `ForPlan` method to `Plan`

* Allow plan files to contain information about state stores

* Add code needed for representing a state store in the Plan struct, which is used when handling plan files

* Add ability to read/write either a backend or state store's data in a plan file. Add some test coverage.

* Update plan's `ProviderAddrs` method to include the provider used for PSS, if present

* Split interfaces

* Apply feedback from code review

* Refactor `SetVersion` to use appropriate constructor

* Split `ProviderAddrs` method test into two

* Fix method call after rename

* Fix test

* Remove change to `(p *Plan) ProviderAddrs()`

We may re-add this when we implement PSS for use during apply commands with plan files

* Remove changes to test, now that the plan doesn't report the provider used for PSS anymore.
2025-06-30 11:39:15 +01:00
Sarah French
2559f0a3db
Update backend state file so it can describe PSS state (#37179)
* Split code for backend state file vs backend state

* Rename BackendState to BackendConfigState

* Spelling error

* Add `StateStorageConfigState` struct as new implementation of new `ConfigState[T any]` interface.

* Split tests for backend state file vs backend config state structs

* Rename StateStorageConfigState to StateStoreConfigState

* Clarify test name, add comments

* Add tests for StateStoreConfigState methods

* Add test showing state_store in JSON is parsed correctly

* Add detection of malformed backend state files that contain both backend and state_store fields

* Add validation that stops a backend state file being written if it will contain state for both backend and state_store blocks

* Rename `state_storage` to `state_store`

* Rename `state_storage` to `state_store` in filenames

* Move`ConfigState` to its own file

* Fix test name, remove whitespace

* Update `StateStoreConfigState` comment using review suggestion

* Update error message to no longer allude to the environment TF is being run in

* Update the state_store state to use `version.Version` and an adapted version of `tfaddr.Provider` for marshalling version and source data

* Update test helper so it doesn't accidentally supply validation in tests

* Add protection against saving an empty backend state file

* Remove direct testing of (s *Source) MarshalText() and UnmarshalText() methods

* Add Validate method to StateStoreConfigState, use in backend state encoding logic

* Refactor to use new features in registry dependency
2025-06-11 14:10:26 +00:00