Пример #1
0
func (c *Config) provisionerFactory(path string) terraform.ResourceProvisionerFactory {
	// Build the plugin client configuration and init the plugin
	var config plugin.ClientConfig
	config.Cmd = pluginCmd(path)
	config.Managed = true
	client := plugin.NewClient(&config)

	return func() (terraform.ResourceProvisioner, error) {
		rpcClient, err := client.Client()
		if err != nil {
			return nil, err
		}

		return rpcClient.ResourceProvisioner()
	}
}
Пример #2
0
func (c *Config) providerFactory(path string) terraform.ResourceProviderFactory {
	// Build the plugin client configuration and init the plugin
	var config plugin.ClientConfig
	config.Cmd = pluginCmd(path)
	config.Managed = true
	client := plugin.NewClient(&config)

	return func() (terraform.ResourceProvider, error) {
		// Request the RPC client so we can get the provider
		// so we can build the actual RPC-implemented provider.
		rpcClient, err := client.Client()
		if err != nil {
			return nil, err
		}

		return rpcClient.ResourceProvider()
	}
}