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