Resource: aws_opensearchserverless_lifecycle_policy

Terraform resource for managing an AWS OpenSearch Serverless Lifecycle Policy. See AWS documentation for lifecycle policies.

Example Usage

Basic Usage

resource "aws_opensearchserverless_lifecycle_policy" "example" {
  name = "example"
  type = "retention"
  policy = jsonencode({
    "Rules" : [
      {
        "ResourceType" : "index",
        "Resource" : ["index/autoparts-inventory/*"],
        "MinIndexRetention" : "81d"
      },
      {
        "ResourceType" : "index",
        "Resource" : ["index/sales/orders*"],
        "NoMinIndexRetention" : true
      }
    ]
  })
}

Argument Reference

The following arguments are required:

The following arguments are optional:

Attribute Reference

This resource exports the following attributes in addition to the arguments above:

Import

In Terraform v1.5.0 and later, use an import block to import OpenSearch Serverless Lifecycle Policy using the name and type arguments separated by a slash (/). For example:

import {
  to = aws_opensearchserverless_lifecycle_policy.example
  id = "example/retention"
}

Using terraform import, import OpenSearch Serverless Lifecycle Policy using the name and type arguments separated by a slash (/). For example:

% terraform import aws_opensearchserverless_lifecycle_policy.example example/retention