diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/provisioners/factory.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/provisioners/factory.go | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/provisioners/factory.go b/vendor/github.com/hashicorp/terraform/provisioners/factory.go new file mode 100644 index 0000000..590b97a --- /dev/null +++ b/vendor/github.com/hashicorp/terraform/provisioners/factory.go | |||
@@ -0,0 +1,19 @@ | |||
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 | } | ||