コード例 #1
0
ファイル: config.go プロジェクト: GeorgeErickson/terraform-1
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
	}
}
コード例 #2
0
ファイル: config.go プロジェクト: koding/koding
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()
	}
}
コード例 #3
0
ファイル: config.go プロジェクト: koding/koding
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()
	}
}
コード例 #4
0
ファイル: plugins.go プロジェクト: apparentlymart/terraflex
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()
}