github.com/hs0210/hashicorp-terraform@v0.11.12-beta1/backend/nil.go (about)

     1  package backend
     2  
     3  import (
     4  	"github.com/hashicorp/terraform/state"
     5  	"github.com/hashicorp/terraform/terraform"
     6  )
     7  
     8  // Nil is a no-op implementation of Backend.
     9  //
    10  // This is useful to embed within another struct to implement all of the
    11  // backend interface for testing.
    12  type Nil struct{}
    13  
    14  func (Nil) Input(
    15  	ui terraform.UIInput,
    16  	c *terraform.ResourceConfig) (*terraform.ResourceConfig, error) {
    17  	return c, nil
    18  }
    19  
    20  func (Nil) Validate(*terraform.ResourceConfig) ([]string, []error) {
    21  	return nil, nil
    22  }
    23  
    24  func (Nil) Configure(*terraform.ResourceConfig) error {
    25  	return nil
    26  }
    27  
    28  func (Nil) State(string) (state.State, error) {
    29  	// We have to return a non-nil state to adhere to the interface
    30  	return &state.InmemState{}, nil
    31  }
    32  
    33  func (Nil) DeleteState(string) error {
    34  	return nil
    35  }
    36  
    37  func (Nil) States() ([]string, error) {
    38  	return []string{DefaultStateName}, nil
    39  }