mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 08:51:02 -06:00
a3403f2766
Due to how often the state and plan types are referenced throughout Terraform, there isn't a great way to switch them out gradually. As a consequence, this huge commit gets us from the old world to a _compilable_ new world, but still has a large number of known test failures due to key functionality being stubbed out. The stubs here are for anything that interacts with providers, since we now need to do the follow-up work to similarly replace the old terraform.ResourceProvider interface with its replacement in the new "providers" package. That work, along with work to fix the remaining failing tests, will follow in subsequent commits. The aim here was to replace all references to terraform.State and its downstream types with states.State, terraform.Plan with plans.Plan, state.State with statemgr.State, and switch to the new implementations of the state and plan file formats. However, due to the number of times those types are used, this also ended up affecting numerous other parts of core such as terraform.Hook, the backend.Backend interface, and most of the CLI commands. Just as with 5861dbf3fc49b19587a31816eb06f511ab861bb4 before, I apologize in advance to the person who inevitably just found this huge commit while spelunking through the commit history.
39 lines
906 B
Go
39 lines
906 B
Go
package state
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/states"
|
|
)
|
|
|
|
// LockDisabled implements State and Locker but disables state locking.
|
|
// If State doesn't support locking, this is a no-op. This is useful for
|
|
// easily disabling locking of an existing state or for tests.
|
|
type LockDisabled struct {
|
|
// We can't embed State directly since Go dislikes that a field is
|
|
// State and State interface has a method State
|
|
Inner State
|
|
}
|
|
|
|
func (s *LockDisabled) State() *states.State {
|
|
return s.Inner.State()
|
|
}
|
|
|
|
func (s *LockDisabled) WriteState(v *states.State) error {
|
|
return s.Inner.WriteState(v)
|
|
}
|
|
|
|
func (s *LockDisabled) RefreshState() error {
|
|
return s.Inner.RefreshState()
|
|
}
|
|
|
|
func (s *LockDisabled) PersistState() error {
|
|
return s.Inner.PersistState()
|
|
}
|
|
|
|
func (s *LockDisabled) Lock(info *LockInfo) (string, error) {
|
|
return "", nil
|
|
}
|
|
|
|
func (s *LockDisabled) Unlock(id string) error {
|
|
return nil
|
|
}
|