mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-30 10:47:14 -06:00
c814f2da37
This mirrors the change made for providers, so that default values can be inserted into the config by the backend implementation. This is only the interface and method name changes, it does not yet add any default values.
41 lines
1007 B
Go
41 lines
1007 B
Go
package backend
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/configs/configschema"
|
|
"github.com/hashicorp/terraform/states/statemgr"
|
|
"github.com/hashicorp/terraform/tfdiags"
|
|
"github.com/zclconf/go-cty/cty"
|
|
)
|
|
|
|
// Nil is a no-op implementation of Backend.
|
|
//
|
|
// This is useful to embed within another struct to implement all of the
|
|
// backend interface for testing.
|
|
type Nil struct{}
|
|
|
|
func (Nil) ConfigSchema() *configschema.Block {
|
|
return &configschema.Block{}
|
|
}
|
|
|
|
func (Nil) PrepareConfig(v cty.Value) (cty.Value, tfdiags.Diagnostics) {
|
|
return v, nil
|
|
}
|
|
|
|
func (Nil) Configure(cty.Value) tfdiags.Diagnostics {
|
|
return nil
|
|
}
|
|
|
|
func (Nil) StateMgr(string) (statemgr.Full, error) {
|
|
// We must return a non-nil manager to adhere to the interface, so
|
|
// we'll return an in-memory-only one.
|
|
return statemgr.NewFullFake(statemgr.NewTransientInMemory(nil), nil), nil
|
|
}
|
|
|
|
func (Nil) DeleteWorkspace(string) error {
|
|
return nil
|
|
}
|
|
|
|
func (Nil) Workspaces() ([]string, error) {
|
|
return []string{DefaultStateName}, nil
|
|
}
|