Skip to content

Commit 4feaa94

Browse files
committed
Reorder resources in cdk stack
1 parent 3bcdc5a commit 4feaa94

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

packages/cdk/stacks/EpsAssistMeStack.ts

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -175,14 +175,8 @@ export class EpsAssistMeStack extends Stack {
175175
})
176176

177177
// ==== OpenSearch Vector Store ====
178-
const osCollection = new ops.CfnCollection(this, "OsCollection", {
179-
name: "eps-assist-vector-db",
180-
description: "EPS Assist Vector Store",
181-
type: "VECTORSEARCH"
182-
})
183-
184178
// OpenSearch encryption policy (AWS-owned key)
185-
new ops.CfnSecurityPolicy(this, "OsEncryptionPolicy", {
179+
const osEncryptionPolicy = new ops.CfnSecurityPolicy(this, "OsEncryptionPolicy", {
186180
name: "eps-assist-encryption-policy",
187181
type: "encryption",
188182
policy: JSON.stringify({
@@ -191,6 +185,16 @@ export class EpsAssistMeStack extends Stack {
191185
})
192186
})
193187

188+
// Create the collection after the encryption policy
189+
const osCollection = new ops.CfnCollection(this, "OsCollection", {
190+
name: "eps-assist-vector-db",
191+
description: "EPS Assist Vector Store",
192+
type: "VECTORSEARCH"
193+
})
194+
195+
// Add explicit dependency to ensure correct creation order
196+
osCollection.addDependency(osEncryptionPolicy)
197+
194198
// OpenSearch network policy (allow public access for demo purposes)
195199
new ops.CfnSecurityPolicy(this, "OsNetworkPolicy", {
196200
name: "eps-assist-network-policy",

0 commit comments

Comments
 (0)