diff options
Diffstat (limited to 'vendor/github.com/hashicorp/terraform/plugin/client.go')
-rw-r--r-- | vendor/github.com/hashicorp/terraform/plugin/client.go | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/github.com/hashicorp/terraform/plugin/client.go b/vendor/github.com/hashicorp/terraform/plugin/client.go new file mode 100644 index 0000000..3a5cb7a --- /dev/null +++ b/vendor/github.com/hashicorp/terraform/plugin/client.go | |||
@@ -0,0 +1,24 @@ | |||
1 | package plugin | ||
2 | |||
3 | import ( | ||
4 | "os/exec" | ||
5 | |||
6 | plugin "github.com/hashicorp/go-plugin" | ||
7 | "github.com/hashicorp/terraform/plugin/discovery" | ||
8 | ) | ||
9 | |||
10 | // ClientConfig returns a configuration object that can be used to instantiate | ||
11 | // a client for the plugin described by the given metadata. | ||
12 | func ClientConfig(m discovery.PluginMeta) *plugin.ClientConfig { | ||
13 | return &plugin.ClientConfig{ | ||
14 | Cmd: exec.Command(m.Path), | ||
15 | HandshakeConfig: Handshake, | ||
16 | Managed: true, | ||
17 | Plugins: PluginMap, | ||
18 | } | ||
19 | } | ||
20 | |||
21 | // Client returns a plugin client for the plugin described by the given metadata. | ||
22 | func Client(m discovery.PluginMeta) *plugin.Client { | ||
23 | return plugin.NewClient(ClientConfig(m)) | ||
24 | } | ||