Beispiel #1
0
func (c *Config) provisionerFactory(path string) terraform.ResourceProvisionerFactory {
	return func() (terraform.ResourceProvisioner, error) {
		// Build the plugin client configuration and init the plugin
		var config plugin.ClientConfig
		config.Cmd = pluginCmd(path)
		config.Managed = true
		client := plugin.NewClient(&config)

		// Request the RPC client and service name from the client
		// so we can build the actual RPC-implemented provider.
		rpcClient, err := client.Client()
		if err != nil {
			return nil, err
		}

		service, err := client.Service()
		if err != nil {
			return nil, err
		}

		return &rpc.ResourceProvisioner{
			Client: rpcClient,
			Name:   service,
		}, nil
	}
}
Beispiel #2
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()
	}
}
Beispiel #3
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()
	}
}
Beispiel #4
0
func (p *Plugins) OpenProvisioner(name string) (terraform.ResourceProvisioner, error) {
	path, ok := p.provisionerNames[name]
	if !ok {
		return nil, fmt.Errorf("No provisioner named %#v", name)
	}

	var config plugin.ClientConfig
	config.Cmd = pluginCmd(path)
	config.Managed = true
	client := plugin.NewClient(&config)

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

	return rpcClient.ResourceProvisioner()
}