Skip to content

(opensearch): removalPolicy=SNAPSHOT has same effect as DESTROY #20653

@jtaub

Description

@jtaub

Describe the bug

An OpenSearch Domain created with removalPolicy: RemovalPolicy.SNAPSHOT does not behave any differently than one created with removalPolicy: RemovalPolicy.DESTROY

Expected Behavior

  1. An OpenSearch Domain created with removalPolicy: RemovalPolicy.SNAPSHOT should have its data retained between destructive updates.
  2. An OpenSearch Domain created with removalPolicy: RemovalPolicy.SNAPSHOT should have its data available in S3, Backup, or elsewhere after its Stack has been destroyed.

Current Behavior

  1. An OpenSearch Domain created with removalPolicy: RemovalPolicy.SNAPSHOT will lose all of its data after a destructive update.
  2. An OpenSearch Domain created with removalPolicy: RemovalPolicy.SNAPSHOT will have no snapshots in S3, Backup, or elsewhere after its Stack has been destroyed.

Reproduction Steps

  1. Create a Domain
import {aws_opensearchservice as opensearch, RemovalPolicy, Stack, StackProps} from "aws-cdk-lib"
import {Construct} from "constructs"

export class ReproductionStack extends Stack {
  constructor(scope: Construct, id: string, props?: StackProps) {
    new opensearch.Domain(this, "Domain", {
      removalPolicy: RemovalPolicy.SNAPSHOT,
      encryptionAtRest: {enabled: false}, // for example
      // any other props
  }
}
  1. cdk deploy
  2. Add some data to your Domain.
  3. Create a change which requires "the provider to create a new physical resource", e.g.
      encryptionAtRest: {enabled: true},
  1. cdk deploy

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.27.0 (build 8e89048)

Framework Version

No response

Node.js Version

17.7.2

OS

Windows 10

Language

Typescript

Language Version

4.7.3

Other information

No response

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-opensearchRelated to the @aws-cdk/aws-opensearchservice packagebugThis issue is a bug.effort/smallSmall work item – less than a day of effortp1

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions