github.com/nicgrayson/terraform@v0.4.3-0.20150415203910-c4de50829380/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 // ConfigureProvider configures the provider with the given 32 // configuration. This is a separate context call because this call 33 // is used to store the provider configuration for inheritance lookups 34 // with ParentProviderConfig(). 35 ConfigureProvider(string, *ResourceConfig) error 36 SetProviderConfig(string, *ResourceConfig) error 37 ParentProviderConfig(string) *ResourceConfig 38 39 // ProviderInput and SetProviderInput are used to configure providers 40 // from user input. 41 ProviderInput(string) map[string]interface{} 42 SetProviderInput(string, map[string]interface{}) 43 44 // InitProvisioner initializes the provisioner with the given name and 45 // returns the implementation of the resource provisioner or an error. 46 // 47 // It is an error to initialize the same provisioner more than once. 48 InitProvisioner(string) (ResourceProvisioner, error) 49 50 // Provisioner gets the provisioner instance with the given name (already 51 // initialized) or returns nil if the provisioner isn't initialized. 52 Provisioner(string) ResourceProvisioner 53 54 // Interpolate takes the given raw configuration and completes 55 // the interpolations, returning the processed ResourceConfig. 56 // 57 // The resource argument is optional. If given, it is the resource 58 // that is currently being acted upon. 59 Interpolate(*config.RawConfig, *Resource) (*ResourceConfig, error) 60 61 // SetVariables sets the variables for interpolation. These variables 62 // should not have a "var." prefix. For example: "var.foo" should be 63 // "foo" as the key. 64 SetVariables(map[string]string) 65 66 // Diff returns the global diff as well as the lock that should 67 // be used to modify that diff. 68 Diff() (*Diff, *sync.RWMutex) 69 70 // State returns the global state as well as the lock that should 71 // be used to modify that state. 72 State() (*State, *sync.RWMutex) 73 }