Skip to content

Commit 1385e57

Browse files
refactor: adds removal policies for resource recreation
1 parent dfeaf25 commit 1385e57

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/cdk/resources/VectorIndex.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {VectorCollection} from "@cdklabs/generative-ai-cdk-constructs/lib/cdk-li
44
import {RemovalPolicy} from "aws-cdk-lib"
55

66
export interface VectorIndexProps {
7-
readonly indexName: string
7+
readonly stackName: string
88
readonly collection: VectorCollection
99
}
1010

@@ -15,7 +15,7 @@ export class VectorIndex extends Construct {
1515
constructor(scope: Construct, id: string, props: VectorIndexProps) {
1616
super(scope, id)
1717

18-
this.indexName = props.indexName
18+
this.indexName = `${props.stackName}-index`
1919

2020
const indexMapping: CfnIndex.MappingsProperty = {
2121
properties: {
@@ -54,7 +54,7 @@ export class VectorIndex extends Construct {
5454

5555
const cfnIndex = new CfnIndex(this, "MyCfnIndex", {
5656
collectionEndpoint: props.collection.collectionEndpoint, // Use L2 property
57-
indexName: props.indexName,
57+
indexName: this.indexName,
5858
mappings: indexMapping,
5959
settings: {
6060
index: {

packages/cdk/stacks/EpsAssistMeStack.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export class EpsAssistMeStack extends Stack {
8484
})
8585

8686
const vectorIndex = new VectorIndex(this, "VectorIndex", {
87-
indexName: "eps-assist-os-index",
87+
stackName: props.stackName,
8888
collection: openSearchResources.collection
8989
})
9090

0 commit comments

Comments
 (0)