mirror of
https://github.com/opentofu/opentofu.git
synced 2025-01-06 22:23:43 -06:00
8a070ddef0
Backends are a mechanism that allow abstracting the behavior of Terraform CLI from the actual core. This allows us to slip in special behavior such as state loading, remote operations, etc.
32 lines
715 B
Go
32 lines
715 B
Go
package backend
|
|
|
|
import (
|
|
"github.com/hashicorp/terraform/state"
|
|
"github.com/hashicorp/terraform/terraform"
|
|
)
|
|
|
|
// 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) Input(
|
|
ui terraform.UIInput,
|
|
c *terraform.ResourceConfig) (*terraform.ResourceConfig, error) {
|
|
return c, nil
|
|
}
|
|
|
|
func (Nil) Validate(*terraform.ResourceConfig) ([]string, []error) {
|
|
return nil, nil
|
|
}
|
|
|
|
func (Nil) Configure(*terraform.ResourceConfig) error {
|
|
return nil
|
|
}
|
|
|
|
func (Nil) State() (state.State, error) {
|
|
// We have to return a non-nil state to adhere to the interface
|
|
return &state.InmemState{}, nil
|
|
}
|