2015-02-03 19:46:11 -06:00
|
|
|
package terraform
|
|
|
|
|
|
|
|
import (
|
2015-02-11 10:48:45 -06:00
|
|
|
"sync"
|
|
|
|
|
2015-02-03 19:46:11 -06:00
|
|
|
"github.com/hashicorp/terraform/config"
|
|
|
|
)
|
|
|
|
|
|
|
|
// EvalContext is the interface that is given to eval nodes to execute.
|
|
|
|
type EvalContext interface {
|
2015-02-08 16:00:13 -06:00
|
|
|
// Path is the current module path.
|
|
|
|
Path() []string
|
|
|
|
|
2015-02-11 15:43:07 -06:00
|
|
|
// Hook is used to call hook methods. The callback is called for each
|
|
|
|
// hook and should return the hook action to take and the error.
|
|
|
|
Hook(func(Hook) (HookAction, error)) error
|
|
|
|
|
2015-02-13 19:59:54 -06:00
|
|
|
// Input is the UIInput object for interacting with the UI.
|
|
|
|
Input() UIInput
|
|
|
|
|
2015-02-03 19:46:11 -06:00
|
|
|
// InitProvider initializes the provider with the given name and
|
|
|
|
// returns the implementation of the resource provider or an error.
|
|
|
|
//
|
|
|
|
// It is an error to initialize the same provider more than once.
|
|
|
|
InitProvider(string) (ResourceProvider, error)
|
|
|
|
|
|
|
|
// Provider gets the provider instance with the given name (already
|
|
|
|
// initialized) or returns nil if the provider isn't initialized.
|
|
|
|
Provider(string) ResourceProvider
|
|
|
|
|
2015-06-19 14:52:50 -05:00
|
|
|
// CloseProvider closes provider connections that aren't needed anymore.
|
|
|
|
CloseProvider(string) error
|
|
|
|
|
2015-02-10 01:32:28 -06:00
|
|
|
// ConfigureProvider configures the provider with the given
|
|
|
|
// configuration. This is a separate context call because this call
|
|
|
|
// is used to store the provider configuration for inheritance lookups
|
|
|
|
// with ParentProviderConfig().
|
|
|
|
ConfigureProvider(string, *ResourceConfig) error
|
2015-04-09 10:48:08 -05:00
|
|
|
SetProviderConfig(string, *ResourceConfig) error
|
2015-02-10 01:32:28 -06:00
|
|
|
ParentProviderConfig(string) *ResourceConfig
|
|
|
|
|
2015-02-13 19:59:54 -06:00
|
|
|
// ProviderInput and SetProviderInput are used to configure providers
|
|
|
|
// from user input.
|
|
|
|
ProviderInput(string) map[string]interface{}
|
|
|
|
SetProviderInput(string, map[string]interface{})
|
|
|
|
|
2015-02-09 13:15:54 -06:00
|
|
|
// InitProvisioner initializes the provisioner with the given name and
|
|
|
|
// returns the implementation of the resource provisioner or an error.
|
|
|
|
//
|
|
|
|
// It is an error to initialize the same provisioner more than once.
|
|
|
|
InitProvisioner(string) (ResourceProvisioner, error)
|
|
|
|
|
|
|
|
// Provisioner gets the provisioner instance with the given name (already
|
|
|
|
// initialized) or returns nil if the provisioner isn't initialized.
|
|
|
|
Provisioner(string) ResourceProvisioner
|
|
|
|
|
2015-06-19 14:52:50 -05:00
|
|
|
// CloseProvisioner closes provisioner connections that aren't needed
|
|
|
|
// anymore.
|
|
|
|
CloseProvisioner(string) error
|
|
|
|
|
2015-02-03 19:46:11 -06:00
|
|
|
// Interpolate takes the given raw configuration and completes
|
|
|
|
// the interpolations, returning the processed ResourceConfig.
|
2015-02-05 19:09:57 -06:00
|
|
|
//
|
|
|
|
// The resource argument is optional. If given, it is the resource
|
|
|
|
// that is currently being acted upon.
|
|
|
|
Interpolate(*config.RawConfig, *Resource) (*ResourceConfig, error)
|
2015-02-11 10:48:45 -06:00
|
|
|
|
2015-05-01 18:29:19 -05:00
|
|
|
// SetVariables sets the variables for the module within
|
|
|
|
// this context with the name n. This function call is additive:
|
|
|
|
// the second parameter is merged with any previous call.
|
|
|
|
SetVariables(string, map[string]string)
|
2015-02-11 19:01:08 -06:00
|
|
|
|
2015-02-11 17:22:03 -06:00
|
|
|
// Diff returns the global diff as well as the lock that should
|
|
|
|
// be used to modify that diff.
|
|
|
|
Diff() (*Diff, *sync.RWMutex)
|
|
|
|
|
2015-02-11 10:48:45 -06:00
|
|
|
// State returns the global state as well as the lock that should
|
|
|
|
// be used to modify that state.
|
|
|
|
State() (*State, *sync.RWMutex)
|
2015-02-03 19:46:11 -06:00
|
|
|
}
|