github.com/nicgrayson/terraform@v0.4.3-0.20150415203910-c4de50829380/terraform/resource_provisioner.go (about) 1 package terraform 2 3 // ResourceProvisioner is an interface that must be implemented by any 4 // resource provisioner: the thing that initializes resources in 5 // a Terraform configuration. 6 type ResourceProvisioner interface { 7 // Validate is called once at the beginning with the raw 8 // configuration (no interpolation done) and can return a list of warnings 9 // and/or errors. 10 // 11 // This is called once per resource. 12 // 13 // This should not assume any of the values in the resource configuration 14 // are valid since it is possible they have to be interpolated still. 15 // The primary use case of this call is to check that the required keys 16 // are set and that the general structure is correct. 17 Validate(*ResourceConfig) ([]string, []error) 18 19 // Apply runs the provisioner on a specific resource and returns the new 20 // resource state along with an error. Instead of a diff, the ResourceConfig 21 // is provided since provisioners only run after a resource has been 22 // newly created. 23 Apply(UIOutput, *InstanceState, *ResourceConfig) error 24 } 25 26 // ResourceProvisionerFactory is a function type that creates a new instance 27 // of a resource provisioner. 28 type ResourceProvisionerFactory func() (ResourceProvisioner, error)