// *** WARNING: this file was generated by the Pulumi Terraform Bridge (tfgen) Tool. *** // *** Do not edit by hand unless you're certain you know what you are doing! *** import * as pulumi from "@pulumi/pulumi"; import { input as inputs, output as outputs } from "./types"; import * as utilities from "./utilities"; /** * Creates or updates an index template. Index templates define settings, mappings, and aliases that can be applied automatically to new indices. See, https://www.elastic.co/guide/en/elasticsearch/reference/current/indices-put-template.html * * ## Example Usage * * ```typescript * import * as pulumi from "@pulumi/pulumi"; * import * as elasticstack from "@pulumi/elasticstack"; * * const myTemplate = new elasticstack.ElasticsearchIndexTemplate("myTemplate", { * priority: 42, * indexPatterns: [ * "logstash*", * "filebeat*", * ], * template: { * aliases: [ * { * name: "my_template_test", * }, * { * name: "another_test", * }, * ], * settings: JSON.stringify({ * number_of_shards: "3", * }), * }, * }); * const myDataStream = new elasticstack.ElasticsearchIndexTemplate("myDataStream", { * indexPatterns: ["stream*"], * dataStream: {}, * }); * ``` * * ## Import * * ```sh * $ pulumi import elasticstack:index/elasticsearchIndexTemplate:ElasticsearchIndexTemplate my_template / * ``` */ export class ElasticsearchIndexTemplate extends pulumi.CustomResource { /** * Get an existing ElasticsearchIndexTemplate resource's state with the given name, ID, and optional extra * properties used to qualify the lookup. * * @param name The _unique_ name of the resulting resource. * @param id The _unique_ provider ID of the resource to lookup. * @param state Any extra arguments used during the lookup. * @param opts Optional settings to control the behavior of the CustomResource. */ public static get(name: string, id: pulumi.Input, state?: ElasticsearchIndexTemplateState, opts?: pulumi.CustomResourceOptions): ElasticsearchIndexTemplate { return new ElasticsearchIndexTemplate(name, state, { ...opts, id: id }); } /** @internal */ public static readonly __pulumiType = 'elasticstack:index/elasticsearchIndexTemplate:ElasticsearchIndexTemplate'; /** * Returns true if the given object is an instance of ElasticsearchIndexTemplate. This is designed to work even * when multiple copies of the Pulumi SDK have been loaded into the same process. */ public static isInstance(obj: any): obj is ElasticsearchIndexTemplate { if (obj === undefined || obj === null) { return false; } return obj['__pulumiType'] === ElasticsearchIndexTemplate.__pulumiType; } /** * An ordered list of component template names. */ public readonly composedOfs!: pulumi.Output; /** * If this object is included, the template is used to create data streams and their backing indices. Supports an empty object. */ public readonly dataStream!: pulumi.Output; /** * Used to establish connection to Elasticsearch server. Overrides environment variables if present. */ public readonly elasticsearchConnection!: pulumi.Output; /** * Internal identifier of the resource */ public /*out*/ readonly id!: pulumi.Output; /** * Array of wildcard (*) expressions used to match the names of data streams and indices during creation. */ public readonly indexPatterns!: pulumi.Output; /** * Optional user metadata about the index template. */ public readonly metadata!: pulumi.Output; /** * Name of the index template to create. */ public readonly name!: pulumi.Output; /** * Priority to determine index template precedence when a new data stream or index is created. */ public readonly priority!: pulumi.Output; /** * Template to be applied. It may optionally include an aliases, mappings, or settings configuration. */ public readonly template!: pulumi.Output; /** * Version number used to manage index templates externally. */ public readonly version!: pulumi.Output; /** * Create a ElasticsearchIndexTemplate resource with the given unique name, arguments, and options. * * @param name The _unique_ name of the resource. * @param args The arguments to use to populate this resource's properties. * @param opts A bag of options that control this resource's behavior. */ constructor(name: string, args: ElasticsearchIndexTemplateArgs, opts?: pulumi.CustomResourceOptions) constructor(name: string, argsOrState?: ElasticsearchIndexTemplateArgs | ElasticsearchIndexTemplateState, opts?: pulumi.CustomResourceOptions) { let resourceInputs: pulumi.Inputs = {}; opts = opts || {}; if (opts.id) { const state = argsOrState as ElasticsearchIndexTemplateState | undefined; resourceInputs["composedOfs"] = state ? state.composedOfs : undefined; resourceInputs["dataStream"] = state ? state.dataStream : undefined; resourceInputs["elasticsearchConnection"] = state ? state.elasticsearchConnection : undefined; resourceInputs["id"] = state ? state.id : undefined; resourceInputs["indexPatterns"] = state ? state.indexPatterns : undefined; resourceInputs["metadata"] = state ? state.metadata : undefined; resourceInputs["name"] = state ? state.name : undefined; resourceInputs["priority"] = state ? state.priority : undefined; resourceInputs["template"] = state ? state.template : undefined; resourceInputs["version"] = state ? state.version : undefined; } else { const args = argsOrState as ElasticsearchIndexTemplateArgs | undefined; if ((!args || args.indexPatterns === undefined) && !opts.urn) { throw new Error("Missing required property 'indexPatterns'"); } resourceInputs["composedOfs"] = args ? args.composedOfs : undefined; resourceInputs["dataStream"] = args ? args.dataStream : undefined; resourceInputs["elasticsearchConnection"] = args ? args.elasticsearchConnection : undefined; resourceInputs["indexPatterns"] = args ? args.indexPatterns : undefined; resourceInputs["metadata"] = args ? args.metadata : undefined; resourceInputs["name"] = args ? args.name : undefined; resourceInputs["priority"] = args ? args.priority : undefined; resourceInputs["template"] = args ? args.template : undefined; resourceInputs["version"] = args ? args.version : undefined; resourceInputs["id"] = undefined /*out*/; } opts = pulumi.mergeOptions(utilities.resourceOptsDefaults(), opts); super(ElasticsearchIndexTemplate.__pulumiType, name, resourceInputs, opts); } } /** * Input properties used for looking up and filtering ElasticsearchIndexTemplate resources. */ export interface ElasticsearchIndexTemplateState { /** * An ordered list of component template names. */ composedOfs?: pulumi.Input[]>; /** * If this object is included, the template is used to create data streams and their backing indices. Supports an empty object. */ dataStream?: pulumi.Input; /** * Used to establish connection to Elasticsearch server. Overrides environment variables if present. */ elasticsearchConnection?: pulumi.Input; /** * Internal identifier of the resource */ id?: pulumi.Input; /** * Array of wildcard (*) expressions used to match the names of data streams and indices during creation. */ indexPatterns?: pulumi.Input[]>; /** * Optional user metadata about the index template. */ metadata?: pulumi.Input; /** * Name of the index template to create. */ name?: pulumi.Input; /** * Priority to determine index template precedence when a new data stream or index is created. */ priority?: pulumi.Input; /** * Template to be applied. It may optionally include an aliases, mappings, or settings configuration. */ template?: pulumi.Input; /** * Version number used to manage index templates externally. */ version?: pulumi.Input; } /** * The set of arguments for constructing a ElasticsearchIndexTemplate resource. */ export interface ElasticsearchIndexTemplateArgs { /** * An ordered list of component template names. */ composedOfs?: pulumi.Input[]>; /** * If this object is included, the template is used to create data streams and their backing indices. Supports an empty object. */ dataStream?: pulumi.Input; /** * Used to establish connection to Elasticsearch server. Overrides environment variables if present. */ elasticsearchConnection?: pulumi.Input; /** * Array of wildcard (*) expressions used to match the names of data streams and indices during creation. */ indexPatterns: pulumi.Input[]>; /** * Optional user metadata about the index template. */ metadata?: pulumi.Input; /** * Name of the index template to create. */ name?: pulumi.Input; /** * Priority to determine index template precedence when a new data stream or index is created. */ priority?: pulumi.Input; /** * Template to be applied. It may optionally include an aliases, mappings, or settings configuration. */ template?: pulumi.Input; /** * Version number used to manage index templates externally. */ version?: pulumi.Input; }