mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-01 11:47:07 -06:00
5782357c28
The new config loader requires some steps to happen in a different order, particularly in regard to knowing the schema in order to decode the configuration. Here we lean directly on the configschema package, rather than on helper/schema.Backend as before, because it's generally sufficient for our needs here and this prepares us for the helper/schema package later moving out into its own repository to seed a "plugin SDK".
40 lines
881 B
Go
40 lines
881 B
Go
package backend
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/config/configschema"
|
|
"github.com/hashicorp/terraform/state"
|
|
"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) ValidateConfig(cty.Value) tfdiags.Diagnostics {
|
|
return nil
|
|
}
|
|
|
|
func (Nil) Configure(cty.Value) tfdiags.Diagnostics {
|
|
return nil
|
|
}
|
|
|
|
func (Nil) State(string) (state.State, error) {
|
|
// We have to return a non-nil state to adhere to the interface
|
|
return &state.InmemState{}, nil
|
|
}
|
|
|
|
func (Nil) DeleteState(string) error {
|
|
return nil
|
|
}
|
|
|
|
func (Nil) States() ([]string, error) {
|
|
return []string{DefaultStateName}, nil
|
|
}
|