1. Packages
  2. Elasticstack Provider
  3. API Docs
  4. ElasticsearchIndexTemplateIlmAttachment
Viewing docs for elasticstack 0.14.3
published on Tuesday, Mar 3, 2026 by elastic
elasticstack logo
Viewing docs for elasticstack 0.14.3
published on Tuesday, Mar 3, 2026 by elastic

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as elasticstack from "@pulumi/elasticstack";
    
    // Create an ILM policy
    const retention90d = new elasticstack.ElasticsearchIndexLifecycle("retention_90d", {
        name: "90-days-retention",
        hot: {
            rollover: {
                maxAge: "7d",
            },
        },
        "delete": {
            minAge: "90d",
            "delete": {},
        },
    });
    // Attach the ILM policy to a Fleet-managed template
    const logsSystem = new elasticstack.ElasticsearchIndexTemplateIlmAttachment("logs_system", {
        indexTemplate: "logs-system.syslog",
        lifecycleName: retention90d.name,
    });
    
    import pulumi
    import pulumi_elasticstack as elasticstack
    
    # Create an ILM policy
    retention90d = elasticstack.ElasticsearchIndexLifecycle("retention_90d",
        name="90-days-retention",
        hot={
            "rollover": {
                "max_age": "7d",
            },
        },
        delete={
            "min_age": "90d",
            "delete": {},
        })
    # Attach the ILM policy to a Fleet-managed template
    logs_system = elasticstack.ElasticsearchIndexTemplateIlmAttachment("logs_system",
        index_template="logs-system.syslog",
        lifecycle_name=retention90d.name)
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/elasticstack/elasticstack"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create an ILM policy
    		retention90d, err := elasticstack.NewElasticsearchIndexLifecycle(ctx, "retention_90d", &elasticstack.ElasticsearchIndexLifecycleArgs{
    			Name: pulumi.String("90-days-retention"),
    			Hot: &elasticstack.ElasticsearchIndexLifecycleHotArgs{
    				Rollover: &elasticstack.ElasticsearchIndexLifecycleHotRolloverArgs{
    					MaxAge: pulumi.String("7d"),
    				},
    			},
    			Delete: &elasticstack.ElasticsearchIndexLifecycleDeleteArgs{
    				MinAge: pulumi.String("90d"),
    				Delete: &elasticstack.ElasticsearchIndexLifecycleDeleteDeleteArgs{},
    			},
    		})
    		if err != nil {
    			return err
    		}
    		// Attach the ILM policy to a Fleet-managed template
    		_, err = elasticstack.NewElasticsearchIndexTemplateIlmAttachment(ctx, "logs_system", &elasticstack.ElasticsearchIndexTemplateIlmAttachmentArgs{
    			IndexTemplate: pulumi.String("logs-system.syslog"),
    			LifecycleName: retention90d.Name,
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using Elasticstack = Pulumi.Elasticstack;
    
    return await Deployment.RunAsync(() => 
    {
        // Create an ILM policy
        var retention90d = new Elasticstack.ElasticsearchIndexLifecycle("retention_90d", new()
        {
            Name = "90-days-retention",
            Hot = new Elasticstack.Inputs.ElasticsearchIndexLifecycleHotArgs
            {
                Rollover = new Elasticstack.Inputs.ElasticsearchIndexLifecycleHotRolloverArgs
                {
                    MaxAge = "7d",
                },
            },
            Delete = new Elasticstack.Inputs.ElasticsearchIndexLifecycleDeleteArgs
            {
                MinAge = "90d",
                Delete = null,
            },
        });
    
        // Attach the ILM policy to a Fleet-managed template
        var logsSystem = new Elasticstack.ElasticsearchIndexTemplateIlmAttachment("logs_system", new()
        {
            IndexTemplate = "logs-system.syslog",
            LifecycleName = retention90d.Name,
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.elasticstack.ElasticsearchIndexLifecycle;
    import com.pulumi.elasticstack.ElasticsearchIndexLifecycleArgs;
    import com.pulumi.elasticstack.inputs.ElasticsearchIndexLifecycleHotArgs;
    import com.pulumi.elasticstack.inputs.ElasticsearchIndexLifecycleHotRolloverArgs;
    import com.pulumi.elasticstack.inputs.ElasticsearchIndexLifecycleDeleteArgs;
    import com.pulumi.elasticstack.inputs.ElasticsearchIndexLifecycleDeleteDeleteArgs;
    import com.pulumi.elasticstack.ElasticsearchIndexTemplateIlmAttachment;
    import com.pulumi.elasticstack.ElasticsearchIndexTemplateIlmAttachmentArgs;
    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) {
            // Create an ILM policy
            var retention90d = new ElasticsearchIndexLifecycle("retention90d", ElasticsearchIndexLifecycleArgs.builder()
                .name("90-days-retention")
                .hot(ElasticsearchIndexLifecycleHotArgs.builder()
                    .rollover(ElasticsearchIndexLifecycleHotRolloverArgs.builder()
                        .maxAge("7d")
                        .build())
                    .build())
                .delete(ElasticsearchIndexLifecycleDeleteArgs.builder()
                    .minAge("90d")
                    .delete(ElasticsearchIndexLifecycleDeleteDeleteArgs.builder()
                        .build())
                    .build())
                .build());
    
            // Attach the ILM policy to a Fleet-managed template
            var logsSystem = new ElasticsearchIndexTemplateIlmAttachment("logsSystem", ElasticsearchIndexTemplateIlmAttachmentArgs.builder()
                .indexTemplate("logs-system.syslog")
                .lifecycleName(retention90d.name())
                .build());
    
        }
    }
    
    resources:
      # Create an ILM policy
      retention90d:
        type: elasticstack:ElasticsearchIndexLifecycle
        name: retention_90d
        properties:
          name: 90-days-retention
          hot:
            rollover:
              maxAge: 7d
          delete:
            minAge: 90d
            delete: {}
      # Attach the ILM policy to a Fleet-managed template
      logsSystem:
        type: elasticstack:ElasticsearchIndexTemplateIlmAttachment
        name: logs_system
        properties:
          indexTemplate: logs-system.syslog
          lifecycleName: ${retention90d.name}
    

    Create ElasticsearchIndexTemplateIlmAttachment Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new ElasticsearchIndexTemplateIlmAttachment(name: string, args: ElasticsearchIndexTemplateIlmAttachmentArgs, opts?: CustomResourceOptions);
    @overload
    def ElasticsearchIndexTemplateIlmAttachment(resource_name: str,
                                                args: ElasticsearchIndexTemplateIlmAttachmentArgs,
                                                opts: Optional[ResourceOptions] = None)
    
    @overload
    def ElasticsearchIndexTemplateIlmAttachment(resource_name: str,
                                                opts: Optional[ResourceOptions] = None,
                                                index_template: Optional[str] = None,
                                                lifecycle_name: Optional[str] = None)
    func NewElasticsearchIndexTemplateIlmAttachment(ctx *Context, name string, args ElasticsearchIndexTemplateIlmAttachmentArgs, opts ...ResourceOption) (*ElasticsearchIndexTemplateIlmAttachment, error)
    public ElasticsearchIndexTemplateIlmAttachment(string name, ElasticsearchIndexTemplateIlmAttachmentArgs args, CustomResourceOptions? opts = null)
    public ElasticsearchIndexTemplateIlmAttachment(String name, ElasticsearchIndexTemplateIlmAttachmentArgs args)
    public ElasticsearchIndexTemplateIlmAttachment(String name, ElasticsearchIndexTemplateIlmAttachmentArgs args, CustomResourceOptions options)
    
    type: elasticstack:ElasticsearchIndexTemplateIlmAttachment
    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 ElasticsearchIndexTemplateIlmAttachmentArgs
    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 ElasticsearchIndexTemplateIlmAttachmentArgs
    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 ElasticsearchIndexTemplateIlmAttachmentArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ElasticsearchIndexTemplateIlmAttachmentArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ElasticsearchIndexTemplateIlmAttachmentArgs
    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 elasticsearchIndexTemplateIlmAttachmentResource = new Elasticstack.ElasticsearchIndexTemplateIlmAttachment("elasticsearchIndexTemplateIlmAttachmentResource", new()
    {
        IndexTemplate = "string",
        LifecycleName = "string",
    });
    
    example, err := elasticstack.NewElasticsearchIndexTemplateIlmAttachment(ctx, "elasticsearchIndexTemplateIlmAttachmentResource", &elasticstack.ElasticsearchIndexTemplateIlmAttachmentArgs{
    	IndexTemplate: pulumi.String("string"),
    	LifecycleName: pulumi.String("string"),
    })
    
    var elasticsearchIndexTemplateIlmAttachmentResource = new ElasticsearchIndexTemplateIlmAttachment("elasticsearchIndexTemplateIlmAttachmentResource", ElasticsearchIndexTemplateIlmAttachmentArgs.builder()
        .indexTemplate("string")
        .lifecycleName("string")
        .build());
    
    elasticsearch_index_template_ilm_attachment_resource = elasticstack.ElasticsearchIndexTemplateIlmAttachment("elasticsearchIndexTemplateIlmAttachmentResource",
        index_template="string",
        lifecycle_name="string")
    
    const elasticsearchIndexTemplateIlmAttachmentResource = new elasticstack.ElasticsearchIndexTemplateIlmAttachment("elasticsearchIndexTemplateIlmAttachmentResource", {
        indexTemplate: "string",
        lifecycleName: "string",
    });
    
    type: elasticstack:ElasticsearchIndexTemplateIlmAttachment
    properties:
        indexTemplate: string
        lifecycleName: string
    

    ElasticsearchIndexTemplateIlmAttachment 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 ElasticsearchIndexTemplateIlmAttachment resource accepts the following input properties:

    IndexTemplate string
    Name of the index template to attach the ILM policy to. For Fleet-managed templates, this is typically the template name (e.g., 'logs-system.syslog').
    LifecycleName string
    Name of the ILM policy to attach to the index template.
    IndexTemplate string
    Name of the index template to attach the ILM policy to. For Fleet-managed templates, this is typically the template name (e.g., 'logs-system.syslog').
    LifecycleName string
    Name of the ILM policy to attach to the index template.
    indexTemplate String
    Name of the index template to attach the ILM policy to. For Fleet-managed templates, this is typically the template name (e.g., 'logs-system.syslog').
    lifecycleName String
    Name of the ILM policy to attach to the index template.
    indexTemplate string
    Name of the index template to attach the ILM policy to. For Fleet-managed templates, this is typically the template name (e.g., 'logs-system.syslog').
    lifecycleName string
    Name of the ILM policy to attach to the index template.
    index_template str
    Name of the index template to attach the ILM policy to. For Fleet-managed templates, this is typically the template name (e.g., 'logs-system.syslog').
    lifecycle_name str
    Name of the ILM policy to attach to the index template.
    indexTemplate String
    Name of the index template to attach the ILM policy to. For Fleet-managed templates, this is typically the template name (e.g., 'logs-system.syslog').
    lifecycleName String
    Name of the ILM policy to attach to the index template.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the ElasticsearchIndexTemplateIlmAttachment 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 ElasticsearchIndexTemplateIlmAttachment Resource

    Get an existing ElasticsearchIndexTemplateIlmAttachment 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?: ElasticsearchIndexTemplateIlmAttachmentState, opts?: CustomResourceOptions): ElasticsearchIndexTemplateIlmAttachment
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            index_template: Optional[str] = None,
            lifecycle_name: Optional[str] = None) -> ElasticsearchIndexTemplateIlmAttachment
    func GetElasticsearchIndexTemplateIlmAttachment(ctx *Context, name string, id IDInput, state *ElasticsearchIndexTemplateIlmAttachmentState, opts ...ResourceOption) (*ElasticsearchIndexTemplateIlmAttachment, error)
    public static ElasticsearchIndexTemplateIlmAttachment Get(string name, Input<string> id, ElasticsearchIndexTemplateIlmAttachmentState? state, CustomResourceOptions? opts = null)
    public static ElasticsearchIndexTemplateIlmAttachment get(String name, Output<String> id, ElasticsearchIndexTemplateIlmAttachmentState state, CustomResourceOptions options)
    resources:  _:    type: elasticstack:ElasticsearchIndexTemplateIlmAttachment    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.
    The following state arguments are supported:
    IndexTemplate string
    Name of the index template to attach the ILM policy to. For Fleet-managed templates, this is typically the template name (e.g., 'logs-system.syslog').
    LifecycleName string
    Name of the ILM policy to attach to the index template.
    IndexTemplate string
    Name of the index template to attach the ILM policy to. For Fleet-managed templates, this is typically the template name (e.g., 'logs-system.syslog').
    LifecycleName string
    Name of the ILM policy to attach to the index template.
    indexTemplate String
    Name of the index template to attach the ILM policy to. For Fleet-managed templates, this is typically the template name (e.g., 'logs-system.syslog').
    lifecycleName String
    Name of the ILM policy to attach to the index template.
    indexTemplate string
    Name of the index template to attach the ILM policy to. For Fleet-managed templates, this is typically the template name (e.g., 'logs-system.syslog').
    lifecycleName string
    Name of the ILM policy to attach to the index template.
    index_template str
    Name of the index template to attach the ILM policy to. For Fleet-managed templates, this is typically the template name (e.g., 'logs-system.syslog').
    lifecycle_name str
    Name of the ILM policy to attach to the index template.
    indexTemplate String
    Name of the index template to attach the ILM policy to. For Fleet-managed templates, this is typically the template name (e.g., 'logs-system.syslog').
    lifecycleName String
    Name of the ILM policy to attach to the index template.

    Import

    The pulumi import command can be used, for example:

    $ pulumi import elasticstack:index/elasticsearchIndexTemplateIlmAttachment:ElasticsearchIndexTemplateIlmAttachment logs_system <cluster_uuid>/logs-system.syslog@custom
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    elasticstack elastic/terraform-provider-elasticstack
    License
    Notes
    This Pulumi package is based on the elasticstack Terraform Provider.
    elasticstack logo
    Viewing docs for elasticstack 0.14.3
    published on Tuesday, Mar 3, 2026 by elastic
      Try Pulumi Cloud free. Your team will thank you.