@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 */
@@ -3431,11 +3431,12 @@ class JaypieInfrastructureStack extends JaypieStack {
3431
3431
  class JaypieMigration extends constructs.Construct {
3432
3432
  constructor(scope, id, props) {
3433
3433
  super(scope, id);
3434
- const { code, dependencies = [], handler = "index.handler", secrets = [], tables = [], } = props;
3434
+ const { code, dependencies = [], environment, handler = "index.handler", secrets = [], tables = [], } = props;
3435
3435
  // Migration Lambda — 5 minute timeout for long-running migrations
3436
3436
  this.lambda = new JaypieLambda(this, "MigrationLambda", {
3437
3437
  code,
3438
3438
  description: "DynamoDB migration custom resource",
3439
+ environment,
3439
3440
  handler,
3440
3441
  roleTag: CDK$2.ROLE.PROCESSING,
3441
3442
  secrets,
@@ -3446,8 +3447,13 @@ class JaypieMigration extends constructs.Construct {
3446
3447
  const provider = new cr__namespace.Provider(this, "MigrationProvider", {
3447
3448
  onEventHandler: this.lambda,
3448
3449
  });
3449
- // Custom Resource that triggers on every deploy
3450
+ // Custom Resource that triggers on every deploy.
3451
+ // deployNonce forces CloudFormation to re-invoke the custom resource
3452
+ // even when only Lambda code changes (issue #261).
3450
3453
  const resource = new cdk__namespace.CustomResource(this, "MigrationResource", {
3454
+ properties: {
3455
+ deployNonce: Date.now().toString(),
3456
+ },
3451
3457
  serviceToken: provider.serviceToken,
3452
3458
  });
3453
3459
  // Ensure dependencies are created before the migration runs