github.com/rstandt/terraform@v0.12.32-0.20230710220336-b1063613405c/provisioners/factory.go (about) 1 package provisioners 2 3 // Factory is a function type that creates a new instance of a resource 4 // provisioner, or returns an error if that is impossible. 5 type Factory func() (Interface, error) 6 7 // FactoryFixed is a helper that creates a Factory that just returns some given 8 // single provisioner. 9 // 10 // Unlike usual factories, the exact same instance is returned for each call 11 // to the factory and so this must be used in only specialized situations where 12 // the caller can take care to either not mutate the given provider at all 13 // or to mutate it in ways that will not cause unexpected behavior for others 14 // holding the same reference. 15 func FactoryFixed(p Interface) Factory { 16 return func() (Interface, error) { 17 return p, nil 18 } 19 }