Skip to content

Commit a984e29

Browse files
committed
use static values for tags
1 parent b79c7aa commit a984e29

File tree

2 files changed

+20
-15
lines changed

2 files changed

+20
-15
lines changed

packages/cdk/constructs/OpenSearchCollection.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {Construct} from "constructs"
22
import {CfnCollection, CfnSecurityPolicy, CfnAccessPolicy} from "aws-cdk-lib/aws-opensearchserverless"
3+
import {Tags} from "aws-cdk-lib"
34

45
export interface OpenSearchCollectionProps {
56
readonly collectionName: string
@@ -61,17 +62,21 @@ export class OpenSearchCollection extends Construct {
6162
})
6263

6364
// Vector search collection for document embeddings
64-
this.collection = new CfnCollection(this, "Collection", {
65+
const collection = new CfnCollection(this, "Collection", {
6566
name: props.collectionName,
6667
description: "EPS Assist Vector Store",
6768
type: "VECTORSEARCH"
6869
})
6970

71+
// set static values for commit and version tags to stop it being recreated
72+
Tags.of(collection).add("commit", "static_value")
73+
Tags.of(collection).add("version", "static_value")
7074
// Ensure collection waits for all policies
71-
this.collection.addDependency(encryptionPolicy)
72-
this.collection.addDependency(networkPolicy)
73-
this.collection.addDependency(accessPolicy)
75+
collection.addDependency(encryptionPolicy)
76+
collection.addDependency(networkPolicy)
77+
collection.addDependency(accessPolicy)
7478

75-
this.endpoint = `${this.collection.attrId}.${this.collection.stack.region}.aoss.amazonaws.com`
79+
this.endpoint = `${collection.attrId}.${collection.stack.region}.aoss.amazonaws.com`
80+
this.collection = collection
7681
}
7782
}

packages/cdk/stacks/EpsAssistMeStack.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -84,15 +84,15 @@ export class EpsAssistMeStack extends Stack {
8484
const endpoint = openSearchResources.collection.endpoint
8585

8686
// Create VectorKnowledgeBase construct with Bedrock execution role
87-
const vectorKB = new VectorKnowledgeBaseResources(this, "VectorKB", {
88-
stackName: props.stackName,
89-
docsBucket: storage.kbDocsBucket.bucket,
90-
bedrockExecutionRole: bedrockExecutionRole.role,
91-
collectionArn: openSearchResources.collection.collectionArn,
92-
vectorIndexName: VECTOR_INDEX_NAME,
93-
region,
94-
account
95-
})
87+
// const vectorKB = new VectorKnowledgeBaseResources(this, "VectorKB", {
88+
// stackName: props.stackName,
89+
// docsBucket: storage.kbDocsBucket.bucket,
90+
// bedrockExecutionRole: bedrockExecutionRole.role,
91+
// collectionArn: openSearchResources.collection.collectionArn,
92+
// vectorIndexName: VECTOR_INDEX_NAME,
93+
// region,
94+
// account
95+
// })
9696

9797
// Create runtime policies with resource dependencies
9898
// const runtimePolicies = new RuntimePolicies(this, "RuntimePolicies", {
@@ -141,7 +141,7 @@ export class EpsAssistMeStack extends Stack {
141141
})
142142

143143
// Ensure knowledge base waits for vector index
144-
vectorKB.knowledgeBase.node.addDependency(vectorIndex.cfnIndex)
144+
//vectorKB.knowledgeBase.node.addDependency(vectorIndex.cfnIndex)
145145

146146
// Add S3 notification to trigger sync Lambda function
147147
// new S3LambdaNotification(this, "S3LambdaNotification", {

0 commit comments

Comments
 (0)