1. Packages
  2. Opensearch Provider
  3. API Docs
  4. IsmPolicy
opensearch 2.3.1 published on Monday, Apr 14, 2025 by opensearch-project

opensearch.IsmPolicy

Explore with Pulumi AI

opensearch logo
opensearch 2.3.1 published on Monday, Apr 14, 2025 by opensearch-project

    Provides an OpenSearch Index State Management (ISM) policy. Please refer to the OpenSearch ISM documentation for details.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as fs from "fs";
    import * as opensearch from "@pulumi/opensearch";
    
    // Create an ISM policy
    const cleanup = new opensearch.IsmPolicy("cleanup", {
        policyId: "delete_after_15d",
        body: fs.readFileSync(`${path.module}/policies/delete_after_15d.json`, "utf8"),
    });
    
    import pulumi
    import pulumi_opensearch as opensearch
    
    # Create an ISM policy
    cleanup = opensearch.IsmPolicy("cleanup",
        policy_id="delete_after_15d",
        body=(lambda path: open(path).read())(f"{path['module']}/policies/delete_after_15d.json"))
    
    package main
    
    import (
    	"fmt"
    	"os"
    
    	"github.com/pulumi/pulumi-terraform-provider/sdks/go/opensearch/v2/opensearch"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func readFileOrPanic(path string) pulumi.StringPtrInput {
    	data, err := os.ReadFile(path)
    	if err != nil {
    		panic(err.Error())
    	}
    	return pulumi.String(string(data))
    }
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		// Create an ISM policy
    		_, err := opensearch.NewIsmPolicy(ctx, "cleanup", &opensearch.IsmPolicyArgs{
    			PolicyId: pulumi.String("delete_after_15d"),
    			Body:     pulumi.String(readFileOrPanic(fmt.Sprintf("%v/policies/delete_after_15d.json", path.Module))),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.IO;
    using System.Linq;
    using Pulumi;
    using Opensearch = Pulumi.Opensearch;
    
    return await Deployment.RunAsync(() => 
    {
        // Create an ISM policy
        var cleanup = new Opensearch.IsmPolicy("cleanup", new()
        {
            PolicyId = "delete_after_15d",
            Body = File.ReadAllText($"{path.Module}/policies/delete_after_15d.json"),
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.opensearch.IsmPolicy;
    import com.pulumi.opensearch.IsmPolicyArgs;
    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 ISM policy
            var cleanup = new IsmPolicy("cleanup", IsmPolicyArgs.builder()
                .policyId("delete_after_15d")
                .body(Files.readString(Paths.get(String.format("%s/policies/delete_after_15d.json", path.module()))))
                .build());
    
        }
    }
    
    resources:
      # Create an ISM policy
      cleanup:
        type: opensearch:IsmPolicy
        properties:
          policyId: delete_after_15d
          body:
            fn::readFile: ${path.module}/policies/delete_after_15d.json
    

    Create IsmPolicy Resource

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

    Constructor syntax

    new IsmPolicy(name: string, args: IsmPolicyArgs, opts?: CustomResourceOptions);
    @overload
    def IsmPolicy(resource_name: str,
                  args: IsmPolicyArgs,
                  opts: Optional[ResourceOptions] = None)
    
    @overload
    def IsmPolicy(resource_name: str,
                  opts: Optional[ResourceOptions] = None,
                  body: Optional[str] = None,
                  policy_id: Optional[str] = None,
                  ism_policy_id: Optional[str] = None,
                  primary_term: Optional[float] = None,
                  seq_no: Optional[float] = None)
    func NewIsmPolicy(ctx *Context, name string, args IsmPolicyArgs, opts ...ResourceOption) (*IsmPolicy, error)
    public IsmPolicy(string name, IsmPolicyArgs args, CustomResourceOptions? opts = null)
    public IsmPolicy(String name, IsmPolicyArgs args)
    public IsmPolicy(String name, IsmPolicyArgs args, CustomResourceOptions options)
    
    type: opensearch:IsmPolicy
    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 IsmPolicyArgs
    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 IsmPolicyArgs
    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 IsmPolicyArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args IsmPolicyArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args IsmPolicyArgs
    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 ismPolicyResource = new Opensearch.IsmPolicy("ismPolicyResource", new()
    {
        Body = "string",
        PolicyId = "string",
        IsmPolicyId = "string",
        PrimaryTerm = 0,
        SeqNo = 0,
    });
    
    example, err := opensearch.NewIsmPolicy(ctx, "ismPolicyResource", &opensearch.IsmPolicyArgs{
    	Body:        pulumi.String("string"),
    	PolicyId:    pulumi.String("string"),
    	IsmPolicyId: pulumi.String("string"),
    	PrimaryTerm: pulumi.Float64(0),
    	SeqNo:       pulumi.Float64(0),
    })
    
    var ismPolicyResource = new IsmPolicy("ismPolicyResource", IsmPolicyArgs.builder()
        .body("string")
        .policyId("string")
        .ismPolicyId("string")
        .primaryTerm(0)
        .seqNo(0)
        .build());
    
    ism_policy_resource = opensearch.IsmPolicy("ismPolicyResource",
        body="string",
        policy_id="string",
        ism_policy_id="string",
        primary_term=0,
        seq_no=0)
    
    const ismPolicyResource = new opensearch.IsmPolicy("ismPolicyResource", {
        body: "string",
        policyId: "string",
        ismPolicyId: "string",
        primaryTerm: 0,
        seqNo: 0,
    });
    
    type: opensearch:IsmPolicy
    properties:
        body: string
        ismPolicyId: string
        policyId: string
        primaryTerm: 0
        seqNo: 0
    

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

    Body string
    The policy document.
    PolicyId string
    The id of the ISM policy.
    IsmPolicyId string
    The ID of this resource.
    PrimaryTerm double
    The primary term of the ISM policy version.
    SeqNo double
    The sequence number of the ISM policy version.
    Body string
    The policy document.
    PolicyId string
    The id of the ISM policy.
    IsmPolicyId string
    The ID of this resource.
    PrimaryTerm float64
    The primary term of the ISM policy version.
    SeqNo float64
    The sequence number of the ISM policy version.
    body String
    The policy document.
    policyId String
    The id of the ISM policy.
    ismPolicyId String
    The ID of this resource.
    primaryTerm Double
    The primary term of the ISM policy version.
    seqNo Double
    The sequence number of the ISM policy version.
    body string
    The policy document.
    policyId string
    The id of the ISM policy.
    ismPolicyId string
    The ID of this resource.
    primaryTerm number
    The primary term of the ISM policy version.
    seqNo number
    The sequence number of the ISM policy version.
    body str
    The policy document.
    policy_id str
    The id of the ISM policy.
    ism_policy_id str
    The ID of this resource.
    primary_term float
    The primary term of the ISM policy version.
    seq_no float
    The sequence number of the ISM policy version.
    body String
    The policy document.
    policyId String
    The id of the ISM policy.
    ismPolicyId String
    The ID of this resource.
    primaryTerm Number
    The primary term of the ISM policy version.
    seqNo Number
    The sequence number of the ISM policy version.

    Outputs

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

    Get an existing IsmPolicy 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?: IsmPolicyState, opts?: CustomResourceOptions): IsmPolicy
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            body: Optional[str] = None,
            ism_policy_id: Optional[str] = None,
            policy_id: Optional[str] = None,
            primary_term: Optional[float] = None,
            seq_no: Optional[float] = None) -> IsmPolicy
    func GetIsmPolicy(ctx *Context, name string, id IDInput, state *IsmPolicyState, opts ...ResourceOption) (*IsmPolicy, error)
    public static IsmPolicy Get(string name, Input<string> id, IsmPolicyState? state, CustomResourceOptions? opts = null)
    public static IsmPolicy get(String name, Output<String> id, IsmPolicyState state, CustomResourceOptions options)
    resources:  _:    type: opensearch:IsmPolicy    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:
    Body string
    The policy document.
    IsmPolicyId string
    The ID of this resource.
    PolicyId string
    The id of the ISM policy.
    PrimaryTerm double
    The primary term of the ISM policy version.
    SeqNo double
    The sequence number of the ISM policy version.
    Body string
    The policy document.
    IsmPolicyId string
    The ID of this resource.
    PolicyId string
    The id of the ISM policy.
    PrimaryTerm float64
    The primary term of the ISM policy version.
    SeqNo float64
    The sequence number of the ISM policy version.
    body String
    The policy document.
    ismPolicyId String
    The ID of this resource.
    policyId String
    The id of the ISM policy.
    primaryTerm Double
    The primary term of the ISM policy version.
    seqNo Double
    The sequence number of the ISM policy version.
    body string
    The policy document.
    ismPolicyId string
    The ID of this resource.
    policyId string
    The id of the ISM policy.
    primaryTerm number
    The primary term of the ISM policy version.
    seqNo number
    The sequence number of the ISM policy version.
    body str
    The policy document.
    ism_policy_id str
    The ID of this resource.
    policy_id str
    The id of the ISM policy.
    primary_term float
    The primary term of the ISM policy version.
    seq_no float
    The sequence number of the ISM policy version.
    body String
    The policy document.
    ismPolicyId String
    The ID of this resource.
    policyId String
    The id of the ISM policy.
    primaryTerm Number
    The primary term of the ISM policy version.
    seqNo Number
    The sequence number of the ISM policy version.

    Import

    $ pulumi import opensearch:index/ismPolicy:IsmPolicy cleanup delete_after_15d
    

    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.
    opensearch logo
    opensearch 2.3.1 published on Monday, Apr 14, 2025 by opensearch-project