@jaypie/constructs 1.2.38 → 1.2.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -8,6 +8,8 @@ export interface JaypieMigrationProps {
|
|
|
8
8
|
code: lambda.Code | string;
|
|
9
9
|
/** Constructs that must be created before the migration runs */
|
|
10
10
|
dependencies?: Construct[];
|
|
11
|
+
/** Environment variables for the migration Lambda */
|
|
12
|
+
environment?: Record<string, string> | (Record<string, string> | string)[];
|
|
11
13
|
/** Lambda handler entry point */
|
|
12
14
|
handler?: string;
|
|
13
15
|
/** Secrets to make available to the migration Lambda */
|
package/dist/esm/index.js
CHANGED
|
@@ -3395,11 +3395,12 @@ class JaypieInfrastructureStack extends JaypieStack {
|
|
|
3395
3395
|
class JaypieMigration extends Construct {
|
|
3396
3396
|
constructor(scope, id, props) {
|
|
3397
3397
|
super(scope, id);
|
|
3398
|
-
const { code, dependencies = [], handler = "index.handler", secrets = [], tables = [], } = props;
|
|
3398
|
+
const { code, dependencies = [], environment, handler = "index.handler", secrets = [], tables = [], } = props;
|
|
3399
3399
|
// Migration Lambda — 5 minute timeout for long-running migrations
|
|
3400
3400
|
this.lambda = new JaypieLambda(this, "MigrationLambda", {
|
|
3401
3401
|
code,
|
|
3402
3402
|
description: "DynamoDB migration custom resource",
|
|
3403
|
+
environment,
|
|
3403
3404
|
handler,
|
|
3404
3405
|
roleTag: CDK$2.ROLE.PROCESSING,
|
|
3405
3406
|
secrets,
|
|
@@ -3410,8 +3411,13 @@ class JaypieMigration extends Construct {
|
|
|
3410
3411
|
const provider = new cr.Provider(this, "MigrationProvider", {
|
|
3411
3412
|
onEventHandler: this.lambda,
|
|
3412
3413
|
});
|
|
3413
|
-
// Custom Resource that triggers on every deploy
|
|
3414
|
+
// Custom Resource that triggers on every deploy.
|
|
3415
|
+
// deployNonce forces CloudFormation to re-invoke the custom resource
|
|
3416
|
+
// even when only Lambda code changes (issue #261).
|
|
3414
3417
|
const resource = new cdk.CustomResource(this, "MigrationResource", {
|
|
3418
|
+
properties: {
|
|
3419
|
+
deployNonce: Date.now().toString(),
|
|
3420
|
+
},
|
|
3415
3421
|
serviceToken: provider.serviceToken,
|
|
3416
3422
|
});
|
|
3417
3423
|
// Ensure dependencies are created before the migration runs
|