ElasticCloud (EC)

v0.4.1 published on Monday, May 16, 2022 by Pulumi

DeploymentExtension

Provides an Elastic Cloud extension resource, which allows extensions to be created, updated, and deleted.

Extensions allow users of Elastic Cloud to use custom plugins, scripts, or dictionaries to enhance the core functionality of Elasticsearch. Before you install an extension, be sure to check out the supported and official Elasticsearch plugins already available.

Example Usage

With extension file

using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using Pulumi;
using ElasticCloud = Pulumi.ElasticCloud;

class MyStack : Stack
{
	private static string ComputeFileBase64Sha256(string path) {
		var fileData = Encoding.UTF8.GetBytes(File.ReadAllText(path));
		var hashData = SHA256.Create().ComputeHash(fileData);
		return Convert.ToBase64String(hashData);
	}

    public MyStack()
    {
        var filePath = "/path/to/plugin.zip";
        var exampleExtension = new ElasticCloud.DeploymentExtension("exampleExtension", new ElasticCloud.DeploymentExtensionArgs
        {
            Description = "my extension",
            Version = "*",
            ExtensionType = "bundle",
            FilePath = filePath,
            FileHash = ComputeFileBase64Sha256(filePath),
        });
    }

}
package main

import (
	"crypto/sha256"
	"fmt"
	"io/ioutil"

	"github.com/pulumi/pulumi-ec/sdk/go/ec"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func filebase64sha256OrPanic(path string) pulumi.StringPtrInput {
	if fileData, err := ioutil.ReadFile(path); err == nil {
		hashedData := sha256.Sum256([]byte(fileData))
		return pulumi.String(base64.StdEncoding.EncodeToString(hashedData[:]))
	} else {
		panic(err.Error())
	}
}

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		filePath := "/path/to/plugin.zip"
		_, err := ec.NewDeploymentExtension(ctx, "exampleExtension", &ec.DeploymentExtensionArgs{
			Description:   pulumi.String("my extension"),
			Version:       pulumi.String("*"),
			ExtensionType: pulumi.String("bundle"),
			FilePath:      pulumi.String(filePath),
			FileHash:      filebase64sha256OrPanic(filePath),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import base64
import hashlib
import pulumi_ec as ec

def computeFilebase64sha256(path):
	fileData = open(path).read().encode()
	hashedData = hashlib.sha256(fileData.encode()).digest()
	return base64.b64encode(hashedData).decode()

file_path = "/path/to/plugin.zip"
example_extension = ec.DeploymentExtension("exampleExtension",
    description="my extension",
    version="*",
    extension_type="bundle",
    file_path=file_path,
    file_hash=computeFilebase64sha256(file_path))
import * as pulumi from "@pulumi/pulumi";
import * as crypto from "crypto";
import * as ec from "@pulumi/ec";
import * from "fs";

func computeFilebase64sha256(path string) string {
	const fileData = Buffer.from(fs.readFileSync(path), 'binary')
	return crypto.createHash('sha256').update(fileData).digest('hex')
}

const filePath = "/path/to/plugin.zip";
const exampleExtension = new ec.DeploymentExtension("exampleExtension", {
    description: "my extension",
    version: "*",
    extensionType: "bundle",
    filePath: filePath,
    fileHash: computeFilebase64sha256(filePath),
});

Coming soon!

With download URL

using Pulumi;
using ElasticCloud = Pulumi.ElasticCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleExtension = new ElasticCloud.DeploymentExtension("exampleExtension", new ElasticCloud.DeploymentExtensionArgs
        {
            Description = "my extension",
            DownloadUrl = "https://example.net",
            ExtensionType = "bundle",
            Version = "*",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-ec/sdk/go/ec"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := ec.NewDeploymentExtension(ctx, "exampleExtension", &ec.DeploymentExtensionArgs{
			Description:   pulumi.String("my extension"),
			DownloadUrl:   pulumi.String("https://example.net"),
			ExtensionType: pulumi.String("bundle"),
			Version:       pulumi.String("*"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_ec as ec

example_extension = ec.DeploymentExtension("exampleExtension",
    description="my extension",
    download_url="https://example.net",
    extension_type="bundle",
    version="*")
import * as pulumi from "@pulumi/pulumi";
import * as ec from "@pulumi/ec";

const exampleExtension = new ec.DeploymentExtension("example_extension", {
    description: "my extension",
    downloadUrl: "https://example.net",
    extensionType: "bundle",
    version: "*",
});

Coming soon!

Using extension in ec.Deployment

using Pulumi;
using ElasticCloud = Pulumi.ElasticCloud;

class MyStack : Stack
{
    public MyStack()
    {
        var exampleExtension = new ElasticCloud.DeploymentExtension("exampleExtension", new ElasticCloud.DeploymentExtensionArgs
        {
            Description = "my extension",
            Version = "*",
            ExtensionType = "bundle",
            DownloadUrl = "https://example.net",
        });
        var latest = Output.Create(ElasticCloud.GetStack.InvokeAsync(new ElasticCloud.GetStackArgs
        {
            VersionRegex = "latest",
            Region = "us-east-1",
        }));
        var withExtension = new ElasticCloud.Deployment("withExtension", new ElasticCloud.DeploymentArgs
        {
            Region = "us-east-1",
            Version = latest.Apply(latest => latest.Version),
            DeploymentTemplateId = "aws-io-optimized-v2",
            Elasticsearch = new ElasticCloud.Inputs.DeploymentElasticsearchArgs
            {
                Extensions = 
                {
                    new ElasticCloud.Inputs.DeploymentElasticsearchExtensionArgs
                    {
                        Name = exampleExtension.Name,
                        Type = "bundle",
                        Version = latest.Apply(latest => latest.Version),
                        Url = exampleExtension.Url,
                    },
                },
            },
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-ec/sdk/go/ec"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		exampleExtension, err := ec.NewDeploymentExtension(ctx, "exampleExtension", &ec.DeploymentExtensionArgs{
			Description:   pulumi.String("my extension"),
			Version:       pulumi.String("*"),
			ExtensionType: pulumi.String("bundle"),
			DownloadUrl:   pulumi.String("https://example.net"),
		})
		if err != nil {
			return err
		}
		latest, err := ec.GetStack(ctx, &GetStackArgs{
			VersionRegex: "latest",
			Region:       "us-east-1",
		}, nil)
		if err != nil {
			return err
		}
		_, err = ec.NewDeployment(ctx, "withExtension", &ec.DeploymentArgs{
			Region:               pulumi.String("us-east-1"),
			Version:              pulumi.String(latest.Version),
			DeploymentTemplateId: pulumi.String("aws-io-optimized-v2"),
			Elasticsearch: &DeploymentElasticsearchArgs{
				Extensions: DeploymentElasticsearchExtensionArray{
					&DeploymentElasticsearchExtensionArgs{
						Name:    exampleExtension.Name,
						Type:    pulumi.String("bundle"),
						Version: pulumi.String(latest.Version),
						Url:     exampleExtension.Url,
					},
				},
			},
		})
		if err != nil {
			return err
		}
		return nil
	})
}

Coming soon!

import pulumi
import pulumi_ec as ec

example_extension = ec.DeploymentExtension("exampleExtension",
    description="my extension",
    version="*",
    extension_type="bundle",
    download_url="https://example.net")
latest = ec.get_stack(version_regex="latest",
    region="us-east-1")
with_extension = ec.Deployment("withExtension",
    region="us-east-1",
    version=latest.version,
    deployment_template_id="aws-io-optimized-v2",
    elasticsearch=ec.DeploymentElasticsearchArgs(
        extensions=[ec.DeploymentElasticsearchExtensionArgs(
            name=example_extension.name,
            type="bundle",
            version=latest.version,
            url=example_extension.url,
        )],
    ))
import * as pulumi from "@pulumi/pulumi";
import * as ec from "@pulumi/ec";

const exampleExtension = new ec.DeploymentExtension("exampleExtension", {
    description: "my extension",
    version: "*",
    extensionType: "bundle",
    downloadUrl: "https://example.net",
});
const latest = ec.getStack({
    versionRegex: "latest",
    region: "us-east-1",
});
const withExtension = new ec.Deployment("withExtension", {
    region: "us-east-1",
    version: latest.then(latest => latest.version),
    deploymentTemplateId: "aws-io-optimized-v2",
    elasticsearch: {
        extensions: [{
            name: exampleExtension.name,
            type: "bundle",
            version: latest.then(latest => latest.version),
            url: exampleExtension.url,
        }],
    },
});

Coming soon!

Create a DeploymentExtension Resource

new DeploymentExtension(name: string, args: DeploymentExtensionArgs, opts?: CustomResourceOptions);
@overload
def DeploymentExtension(resource_name: str,
                        opts: Optional[ResourceOptions] = None,
                        description: Optional[str] = None,
                        download_url: Optional[str] = None,
                        extension_type: Optional[str] = None,
                        file_hash: Optional[str] = None,
                        file_path: Optional[str] = None,
                        name: Optional[str] = None,
                        version: Optional[str] = None)
@overload
def DeploymentExtension(resource_name: str,
                        args: DeploymentExtensionArgs,
                        opts: Optional[ResourceOptions] = None)
func NewDeploymentExtension(ctx *Context, name string, args DeploymentExtensionArgs, opts ...ResourceOption) (*DeploymentExtension, error)
public DeploymentExtension(string name, DeploymentExtensionArgs args, CustomResourceOptions? opts = null)
public DeploymentExtension(String name, DeploymentExtensionArgs args)
public DeploymentExtension(String name, DeploymentExtensionArgs args, CustomResourceOptions options)
type: ec:DeploymentExtension
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

name string
The unique name of the resource.
args DeploymentExtensionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name str
The unique name of the resource.
args DeploymentExtensionArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name string
The unique name of the resource.
args DeploymentExtensionArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args DeploymentExtensionArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name String
The unique name of the resource.
args DeploymentExtensionArgs
The arguments to resource properties.
options CustomResourceOptions
Bag of options to control resource's behavior.

DeploymentExtension Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.

Inputs

The DeploymentExtension resource accepts the following input properties:

ExtensionType string

bundle or plugin allowed. A bundle will usually contain a dictionary or script, where a plugin is compiled from source.

Version string

Elastic stack version, a numeric version for plugins, e.g. 2.3.0 should be set. Major version e.g. 2.*, or wildcards e.g. * for bundles.

Description string

Description of the extension.

DownloadUrl string

The URL to download the extension archive.

FileHash string

Hash value of the file. If it is changed, the file is reuploaded.

FilePath string

File path of the extension uploaded.

Name string

Name of the extension.

ExtensionType string

bundle or plugin allowed. A bundle will usually contain a dictionary or script, where a plugin is compiled from source.

Version string

Elastic stack version, a numeric version for plugins, e.g. 2.3.0 should be set. Major version e.g. 2.*, or wildcards e.g. * for bundles.

Description string

Description of the extension.

DownloadUrl string

The URL to download the extension archive.

FileHash string

Hash value of the file. If it is changed, the file is reuploaded.

FilePath string

File path of the extension uploaded.

Name string

Name of the extension.

extensionType String

bundle or plugin allowed. A bundle will usually contain a dictionary or script, where a plugin is compiled from source.

version String

Elastic stack version, a numeric version for plugins, e.g. 2.3.0 should be set. Major version e.g. 2.*, or wildcards e.g. * for bundles.

description String

Description of the extension.

downloadUrl String

The URL to download the extension archive.

fileHash String

Hash value of the file. If it is changed, the file is reuploaded.

filePath String

File path of the extension uploaded.

name String

Name of the extension.

extensionType string

bundle or plugin allowed. A bundle will usually contain a dictionary or script, where a plugin is compiled from source.

version string

Elastic stack version, a numeric version for plugins, e.g. 2.3.0 should be set. Major version e.g. 2.*, or wildcards e.g. * for bundles.

description string

Description of the extension.

downloadUrl string

The URL to download the extension archive.

fileHash string

Hash value of the file. If it is changed, the file is reuploaded.

filePath string

File path of the extension uploaded.

name string

Name of the extension.

extension_type str

bundle or plugin allowed. A bundle will usually contain a dictionary or script, where a plugin is compiled from source.

version str

Elastic stack version, a numeric version for plugins, e.g. 2.3.0 should be set. Major version e.g. 2.*, or wildcards e.g. * for bundles.

description str

Description of the extension.

download_url str

The URL to download the extension archive.

file_hash str

Hash value of the file. If it is changed, the file is reuploaded.

file_path str

File path of the extension uploaded.

name str

Name of the extension.

extensionType String

bundle or plugin allowed. A bundle will usually contain a dictionary or script, where a plugin is compiled from source.

version String

Elastic stack version, a numeric version for plugins, e.g. 2.3.0 should be set. Major version e.g. 2.*, or wildcards e.g. * for bundles.

description String

Description of the extension.

downloadUrl String

The URL to download the extension archive.

fileHash String

Hash value of the file. If it is changed, the file is reuploaded.

filePath String

File path of the extension uploaded.

name String

Name of the extension.

Outputs

All input properties are implicitly available as output properties. Additionally, the DeploymentExtension resource produces the following output properties:

Id string

The provider-assigned unique ID for this managed resource.

LastModified string

The datetime the extension was last modified.

Size int

The extension file size in bytes.

Url string

The extension URL to be used in the plan.

Id string

The provider-assigned unique ID for this managed resource.

LastModified string

The datetime the extension was last modified.

Size int

The extension file size in bytes.

Url string

The extension URL to be used in the plan.

id String

The provider-assigned unique ID for this managed resource.

lastModified String

The datetime the extension was last modified.

size Integer

The extension file size in bytes.

url String

The extension URL to be used in the plan.

id string

The provider-assigned unique ID for this managed resource.

lastModified string

The datetime the extension was last modified.

size number

The extension file size in bytes.

url string

The extension URL to be used in the plan.

id str

The provider-assigned unique ID for this managed resource.

last_modified str

The datetime the extension was last modified.

size int

The extension file size in bytes.

url str

The extension URL to be used in the plan.

id String

The provider-assigned unique ID for this managed resource.

lastModified String

The datetime the extension was last modified.

size Number

The extension file size in bytes.

url String

The extension URL to be used in the plan.

Look up an Existing DeploymentExtension Resource

Get an existing DeploymentExtension resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.

public static get(name: string, id: Input<ID>, state?: DeploymentExtensionState, opts?: CustomResourceOptions): DeploymentExtension
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        description: Optional[str] = None,
        download_url: Optional[str] = None,
        extension_type: Optional[str] = None,
        file_hash: Optional[str] = None,
        file_path: Optional[str] = None,
        last_modified: Optional[str] = None,
        name: Optional[str] = None,
        size: Optional[int] = None,
        url: Optional[str] = None,
        version: Optional[str] = None) -> DeploymentExtension
func GetDeploymentExtension(ctx *Context, name string, id IDInput, state *DeploymentExtensionState, opts ...ResourceOption) (*DeploymentExtension, error)
public static DeploymentExtension Get(string name, Input<string> id, DeploymentExtensionState? state, CustomResourceOptions? opts = null)
public static DeploymentExtension get(String name, Output<String> id, DeploymentExtensionState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
resource_name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
name
The unique name of the resulting resource.
id
The unique provider ID of the resource to lookup.
state
Any extra arguments used during the lookup.
opts
A bag of options that control this resource's behavior.
The following state arguments are supported:
Description string

Description of the extension.

DownloadUrl string

The URL to download the extension archive.

ExtensionType string

bundle or plugin allowed. A bundle will usually contain a dictionary or script, where a plugin is compiled from source.

FileHash string

Hash value of the file. If it is changed, the file is reuploaded.

FilePath string

File path of the extension uploaded.

LastModified string

The datetime the extension was last modified.

Name string

Name of the extension.

Size int

The extension file size in bytes.

Url string

The extension URL to be used in the plan.

Version string

Elastic stack version, a numeric version for plugins, e.g. 2.3.0 should be set. Major version e.g. 2.*, or wildcards e.g. * for bundles.

Description string

Description of the extension.

DownloadUrl string

The URL to download the extension archive.

ExtensionType string

bundle or plugin allowed. A bundle will usually contain a dictionary or script, where a plugin is compiled from source.

FileHash string

Hash value of the file. If it is changed, the file is reuploaded.

FilePath string

File path of the extension uploaded.

LastModified string

The datetime the extension was last modified.

Name string

Name of the extension.

Size int

The extension file size in bytes.

Url string

The extension URL to be used in the plan.

Version string

Elastic stack version, a numeric version for plugins, e.g. 2.3.0 should be set. Major version e.g. 2.*, or wildcards e.g. * for bundles.

description String

Description of the extension.

downloadUrl String

The URL to download the extension archive.

extensionType String

bundle or plugin allowed. A bundle will usually contain a dictionary or script, where a plugin is compiled from source.

fileHash String

Hash value of the file. If it is changed, the file is reuploaded.

filePath String

File path of the extension uploaded.

lastModified String

The datetime the extension was last modified.

name String

Name of the extension.

size Integer

The extension file size in bytes.

url String

The extension URL to be used in the plan.

version String

Elastic stack version, a numeric version for plugins, e.g. 2.3.0 should be set. Major version e.g. 2.*, or wildcards e.g. * for bundles.

description string

Description of the extension.

downloadUrl string

The URL to download the extension archive.

extensionType string

bundle or plugin allowed. A bundle will usually contain a dictionary or script, where a plugin is compiled from source.

fileHash string

Hash value of the file. If it is changed, the file is reuploaded.

filePath string

File path of the extension uploaded.

lastModified string

The datetime the extension was last modified.

name string

Name of the extension.

size number

The extension file size in bytes.

url string

The extension URL to be used in the plan.

version string

Elastic stack version, a numeric version for plugins, e.g. 2.3.0 should be set. Major version e.g. 2.*, or wildcards e.g. * for bundles.

description str

Description of the extension.

download_url str

The URL to download the extension archive.

extension_type str

bundle or plugin allowed. A bundle will usually contain a dictionary or script, where a plugin is compiled from source.

file_hash str

Hash value of the file. If it is changed, the file is reuploaded.

file_path str

File path of the extension uploaded.

last_modified str

The datetime the extension was last modified.

name str

Name of the extension.

size int

The extension file size in bytes.

url str

The extension URL to be used in the plan.

version str

Elastic stack version, a numeric version for plugins, e.g. 2.3.0 should be set. Major version e.g. 2.*, or wildcards e.g. * for bundles.

description String

Description of the extension.

downloadUrl String

The URL to download the extension archive.

extensionType String

bundle or plugin allowed. A bundle will usually contain a dictionary or script, where a plugin is compiled from source.

fileHash String

Hash value of the file. If it is changed, the file is reuploaded.

filePath String

File path of the extension uploaded.

lastModified String

The datetime the extension was last modified.

name String

Name of the extension.

size Number

The extension file size in bytes.

url String

The extension URL to be used in the plan.

version String

Elastic stack version, a numeric version for plugins, e.g. 2.3.0 should be set. Major version e.g. 2.*, or wildcards e.g. * for bundles.

Import

You can import extensions using the id, for example

 $ pulumi import ec:index/deploymentExtension:DeploymentExtension name 320b7b540dfc967a7a649c18e2fce4ed

Package Details

Repository
https://github.com/pulumi/pulumi-ec
License
Apache-2.0
Notes

This Pulumi package is based on the ec Terraform Provider.