We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 789dc9c commit 6805ee8Copy full SHA for 6805ee8
src/index.ts
@@ -329,9 +329,19 @@ export class ImagePipeline extends Construct {
329
new imagebuilder.CfnImagePipeline(this, 'ImagePipeline', imagePipelineProps);
330
}
331
332
+ /**
333
+ * Helper function to hash an object to create unique resource names
334
+ *
335
+ * @param o an object to hash
336
+ * @returns 6 character hash string
337
+ */
338
private hash(o: object): string {
339
+ // Remove any token references that would cause the result to be
340
+ // non-deterministic.
341
+ const cleanString = JSON.stringify(o).replace(/\${[^{]*}/g, '');
342
+
343
return createHash('sha256')
- .update(JSON.stringify(o))
344
+ .update(cleanString)
345
.digest('hex')
346
.toUpperCase()
347
.slice(0, 6);
0 commit comments