mirror of
https://github.com/opentofu/opentofu.git
synced 2024-12-26 17:01:04 -06:00
e81162c4e1
This is part of a general effort to move all of Terraform's non-library package surface under internal in order to reinforce that these are for internal use within Terraform only. If you were previously importing packages under this prefix into an external codebase, you could pin to an earlier release tag as an interim solution until you've make a plan to achieve the same functionality some other way.
20 lines
738 B
Go
20 lines
738 B
Go
package provisioners
|
|
|
|
// Factory is a function type that creates a new instance of a resource
|
|
// provisioner, or returns an error if that is impossible.
|
|
type Factory func() (Interface, error)
|
|
|
|
// FactoryFixed is a helper that creates a Factory that just returns some given
|
|
// single provisioner.
|
|
//
|
|
// Unlike usual factories, the exact same instance is returned for each call
|
|
// to the factory and so this must be used in only specialized situations where
|
|
// the caller can take care to either not mutate the given provider at all
|
|
// or to mutate it in ways that will not cause unexpected behavior for others
|
|
// holding the same reference.
|
|
func FactoryFixed(p Interface) Factory {
|
|
return func() (Interface, error) {
|
|
return p, nil
|
|
}
|
|
}
|