github.com/mohanarpit/terraform@v0.6.16-0.20160909104007-291f29853544/terraform/eval_context.go (about)

     1  package terraform
     2  
     3  import (
     4  	"sync"
     5  
     6  	"github.com/hashicorp/terraform/config"
     7  )
     8  
     9  // EvalContext is the interface that is given to eval nodes to execute.
    10  type EvalContext interface {
    11  	// Path is the current module path.
    12  	Path() []string
    13  
    14  	// Hook is used to call hook methods. The callback is called for each
    15  	// hook and should return the hook action to take and the error.
    16  	Hook(func(Hook) (HookAction, error)) error
    17  
    18  	// Input is the UIInput object for interacting with the UI.
    19  	Input() UIInput
    20  
    21  	// InitProvider initializes the provider with the given name and
    22  	// returns the implementation of the resource provider or an error.
    23  	//
    24  	// It is an error to initialize the same provider more than once.
    25  	InitProvider(string) (ResourceProvider, error)
    26  
    27  	// Provider gets the provider instance with the given name (already
    28  	// initialized) or returns nil if the provider isn't initialized.
    29  	Provider(string) ResourceProvider
    30  
    31  	// CloseProvider closes provider connections that aren't needed anymore.
    32  	CloseProvider(string) error
    33  
    34  	// ConfigureProvider configures the provider with the given
    35  	// configuration. This is a separate context call because this call
    36  	// is used to store the provider configuration for inheritance lookups
    37  	// with ParentProviderConfig().
    38  	ConfigureProvider(string, *ResourceConfig) error
    39  	SetProviderConfig(string, *ResourceConfig) error
    40  	ParentProviderConfig(string) *ResourceConfig
    41  
    42  	// ProviderInput and SetProviderInput are used to configure providers
    43  	// from user input.
    44  	ProviderInput(string) map[string]interface{}
    45  	SetProviderInput(string, map[string]interface{})
    46  
    47  	// InitProvisioner initializes the provisioner with the given name and
    48  	// returns the implementation of the resource provisioner or an error.
    49  	//
    50  	// It is an error to initialize the same provisioner more than once.
    51  	InitProvisioner(string) (ResourceProvisioner, error)
    52  
    53  	// Provisioner gets the provisioner instance with the given name (already
    54  	// initialized) or returns nil if the provisioner isn't initialized.
    55  	Provisioner(string) ResourceProvisioner
    56  
    57  	// CloseProvisioner closes provisioner connections that aren't needed
    58  	// anymore.
    59  	CloseProvisioner(string) error
    60  
    61  	// Interpolate takes the given raw configuration and completes
    62  	// the interpolations, returning the processed ResourceConfig.
    63  	//
    64  	// The resource argument is optional. If given, it is the resource
    65  	// that is currently being acted upon.
    66  	Interpolate(*config.RawConfig, *Resource) (*ResourceConfig, error)
    67  
    68  	// SetVariables sets the variables for the module within
    69  	// this context with the name n. This function call is additive:
    70  	// the second parameter is merged with any previous call.
    71  	SetVariables(string, map[string]interface{})
    72  
    73  	// Diff returns the global diff as well as the lock that should
    74  	// be used to modify that diff.
    75  	Diff() (*Diff, *sync.RWMutex)
    76  
    77  	// State returns the global state as well as the lock that should
    78  	// be used to modify that state.
    79  	State() (*State, *sync.RWMutex)
    80  }