github.com/paybyphone/terraform@v0.9.5-0.20170613192930-9706042ddd51/plugin/client.go (about) 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 }