opensearch.ComposableIndexTemplate
Explore with Pulumi AI
Provides an Composable index template resource. This resource uses the /_index_template
endpoint of the API that is available since version 2.0.0. Use opensearch.IndexTemplate
if you are using older versions or if you want to keep using legacy Index Templates.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as opensearch from "@pulumi/opensearch";
const template1 = new opensearch.ComposableIndexTemplate("template1", {body: `{
"index_patterns": ["te*", "bar*"],
"template": {
"settings": {
"index": {
"number_of_shards": "1"
}
},
"mappings": {
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z yyyy"
}
}
},
"aliases": {
"mydata": { }
}
},
"priority": 200,
"version": 3
}
`});
import pulumi
import pulumi_opensearch as opensearch
template1 = opensearch.ComposableIndexTemplate("template1", body="""{
"index_patterns": ["te*", "bar*"],
"template": {
"settings": {
"index": {
"number_of_shards": "1"
}
},
"mappings": {
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z yyyy"
}
}
},
"aliases": {
"mydata": { }
}
},
"priority": 200,
"version": 3
}
""")
package main
import (
"github.com/pulumi/pulumi-terraform-provider/sdks/go/opensearch/v2/opensearch"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := opensearch.NewComposableIndexTemplate(ctx, "template1", &opensearch.ComposableIndexTemplateArgs{
Body: pulumi.String(`{
"index_patterns": ["te*", "bar*"],
"template": {
"settings": {
"index": {
"number_of_shards": "1"
}
},
"mappings": {
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z yyyy"
}
}
},
"aliases": {
"mydata": { }
}
},
"priority": 200,
"version": 3
}
`),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Opensearch = Pulumi.Opensearch;
return await Deployment.RunAsync(() =>
{
var template1 = new Opensearch.ComposableIndexTemplate("template1", new()
{
Body = @"{
""index_patterns"": [""te*"", ""bar*""],
""template"": {
""settings"": {
""index"": {
""number_of_shards"": ""1""
}
},
""mappings"": {
""properties"": {
""host_name"": {
""type"": ""keyword""
},
""created_at"": {
""type"": ""date"",
""format"": ""EEE MMM dd HH:mm:ss Z yyyy""
}
}
},
""aliases"": {
""mydata"": { }
}
},
""priority"": 200,
""version"": 3
}
",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.opensearch.ComposableIndexTemplate;
import com.pulumi.opensearch.ComposableIndexTemplateArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var template1 = new ComposableIndexTemplate("template1", ComposableIndexTemplateArgs.builder()
.body("""
{
"index_patterns": ["te*", "bar*"],
"template": {
"settings": {
"index": {
"number_of_shards": "1"
}
},
"mappings": {
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z yyyy"
}
}
},
"aliases": {
"mydata": { }
}
},
"priority": 200,
"version": 3
}
""")
.build());
}
}
resources:
template1:
type: opensearch:ComposableIndexTemplate
properties:
body: |+
{
"index_patterns": ["te*", "bar*"],
"template": {
"settings": {
"index": {
"number_of_shards": "1"
}
},
"mappings": {
"properties": {
"host_name": {
"type": "keyword"
},
"created_at": {
"type": "date",
"format": "EEE MMM dd HH:mm:ss Z yyyy"
}
}
},
"aliases": {
"mydata": { }
}
},
"priority": 200,
"version": 3
}
Create ComposableIndexTemplate Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ComposableIndexTemplate(name: string, args: ComposableIndexTemplateArgs, opts?: CustomResourceOptions);
@overload
def ComposableIndexTemplate(resource_name: str,
args: ComposableIndexTemplateArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ComposableIndexTemplate(resource_name: str,
opts: Optional[ResourceOptions] = None,
body: Optional[str] = None,
composable_index_template_id: Optional[str] = None,
name: Optional[str] = None)
func NewComposableIndexTemplate(ctx *Context, name string, args ComposableIndexTemplateArgs, opts ...ResourceOption) (*ComposableIndexTemplate, error)
public ComposableIndexTemplate(string name, ComposableIndexTemplateArgs args, CustomResourceOptions? opts = null)
public ComposableIndexTemplate(String name, ComposableIndexTemplateArgs args)
public ComposableIndexTemplate(String name, ComposableIndexTemplateArgs args, CustomResourceOptions options)
type: opensearch:ComposableIndexTemplate
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args ComposableIndexTemplateArgs
- 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 ComposableIndexTemplateArgs
- 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 ComposableIndexTemplateArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ComposableIndexTemplateArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ComposableIndexTemplateArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var composableIndexTemplateResource = new Opensearch.ComposableIndexTemplate("composableIndexTemplateResource", new()
{
Body = "string",
ComposableIndexTemplateId = "string",
Name = "string",
});
example, err := opensearch.NewComposableIndexTemplate(ctx, "composableIndexTemplateResource", &opensearch.ComposableIndexTemplateArgs{
Body: pulumi.String("string"),
ComposableIndexTemplateId: pulumi.String("string"),
Name: pulumi.String("string"),
})
var composableIndexTemplateResource = new ComposableIndexTemplate("composableIndexTemplateResource", ComposableIndexTemplateArgs.builder()
.body("string")
.composableIndexTemplateId("string")
.name("string")
.build());
composable_index_template_resource = opensearch.ComposableIndexTemplate("composableIndexTemplateResource",
body="string",
composable_index_template_id="string",
name="string")
const composableIndexTemplateResource = new opensearch.ComposableIndexTemplate("composableIndexTemplateResource", {
body: "string",
composableIndexTemplateId: "string",
name: "string",
});
type: opensearch:ComposableIndexTemplate
properties:
body: string
composableIndexTemplateId: string
name: string
ComposableIndexTemplate Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
The ComposableIndexTemplate resource accepts the following input properties:
- Body string
- The JSON body of the index template.
- Composable
Index stringTemplate Id - The ID of this resource.
- Name string
- The name of the index template.
- Body string
- The JSON body of the index template.
- Composable
Index stringTemplate Id - The ID of this resource.
- Name string
- The name of the index template.
- body String
- The JSON body of the index template.
- composable
Index StringTemplate Id - The ID of this resource.
- name String
- The name of the index template.
- body string
- The JSON body of the index template.
- composable
Index stringTemplate Id - The ID of this resource.
- name string
- The name of the index template.
- body str
- The JSON body of the index template.
- composable_
index_ strtemplate_ id - The ID of this resource.
- name str
- The name of the index template.
- body String
- The JSON body of the index template.
- composable
Index StringTemplate Id - The ID of this resource.
- name String
- The name of the index template.
Outputs
All input properties are implicitly available as output properties. Additionally, the ComposableIndexTemplate resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing ComposableIndexTemplate Resource
Get an existing ComposableIndexTemplate 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?: ComposableIndexTemplateState, opts?: CustomResourceOptions): ComposableIndexTemplate
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
body: Optional[str] = None,
composable_index_template_id: Optional[str] = None,
name: Optional[str] = None) -> ComposableIndexTemplate
func GetComposableIndexTemplate(ctx *Context, name string, id IDInput, state *ComposableIndexTemplateState, opts ...ResourceOption) (*ComposableIndexTemplate, error)
public static ComposableIndexTemplate Get(string name, Input<string> id, ComposableIndexTemplateState? state, CustomResourceOptions? opts = null)
public static ComposableIndexTemplate get(String name, Output<String> id, ComposableIndexTemplateState state, CustomResourceOptions options)
resources: _: type: opensearch:ComposableIndexTemplate get: id: ${id}
- 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.
- Body string
- The JSON body of the index template.
- Composable
Index stringTemplate Id - The ID of this resource.
- Name string
- The name of the index template.
- Body string
- The JSON body of the index template.
- Composable
Index stringTemplate Id - The ID of this resource.
- Name string
- The name of the index template.
- body String
- The JSON body of the index template.
- composable
Index StringTemplate Id - The ID of this resource.
- name String
- The name of the index template.
- body string
- The JSON body of the index template.
- composable
Index stringTemplate Id - The ID of this resource.
- name string
- The name of the index template.
- body str
- The JSON body of the index template.
- composable_
index_ strtemplate_ id - The ID of this resource.
- name str
- The name of the index template.
- body String
- The JSON body of the index template.
- composable
Index StringTemplate Id - The ID of this resource.
- name String
- The name of the index template.
Import
$ pulumi import opensearch:index/composableIndexTemplate:ComposableIndexTemplate template_1 template_1
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- opensearch opensearch-project/terraform-provider-opensearch
- License
- Notes
- This Pulumi package is based on the
opensearch
Terraform Provider.