Skip to content

fix(cdk): resolve #37783 by fixing missing top-level sseSpecification…#37982

Open
gingeekrishna wants to merge 2 commits into
aws:mainfrom
gingeekrishna:fix/37783-construct-validation
Open

fix(cdk): resolve #37783 by fixing missing top-level sseSpecification…#37982
gingeekrishna wants to merge 2 commits into
aws:mainfrom
gingeekrishna:fix/37783-construct-validation

Conversation

@gingeekrishna
Copy link
Copy Markdown

… for TableV2MultiAccountReplica

Issue # (if applicable)

Closes #37783 .

Reason for this change

TableV2MultiAccountReplica did not set the top-level SSESpecification when using TableEncryptionV2.customerManagedKey(...). As a result, the generated AWS::DynamoDB::GlobalTable could include replica-level SSE key settings without declaring top-level SSE mode, which causes CloudFormation validation and deployment failure.

Description of changes

Added top-level SSE specification rendering in TableV2MultiAccountReplica:
sseSpecification: props.encryption?._renderSseSpecification()
Kept existing replica-level SSE rendering unchanged.
Updated regression test coverage to assert top-level SSESpecification includes:
SSEEnabled: true
SSEType: KMS

Why this fixes the issue:

GlobalTable encryption mode must be declared at the top level when using KMS encryption. Rendering top-level SSESpecification aligns TableV2MultiAccountReplica behavior with TableV2 and prevents the validation failure.

Alternatives considered:

User-side escape hatch overrides were rejected since they require per-app manual patching and do not fix library behavior.
API changes were rejected as unnecessary and potentially breaking.
Design decisions:

Minimal, backward-compatible change with no public API modifications.
Reused existing encryption rendering helper logic.

Describe any new or updated permissions being added

No new or updated IAM permissions are added.
This change only affects synthesized DynamoDB GlobalTable encryption properties.

Description of how you validated changes

Added/updated unit regression assertions in the DynamoDB TableV2 test suite for multi-account replica custom encryption.
Verified branch contains only the intended code and test changes.
Local focused test execution in this Windows environment encountered Jest discovery/config path issues; regression assertion update is included and scoped to this behavior.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

Copilot AI review requested due to automatic review settings May 23, 2026 22:45
@github-actions github-actions Bot added beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels May 23, 2026
@github-actions
Copy link
Copy Markdown
Contributor

👋 It looks like your PR description references an issue, but not in the expected location.

The issue number must appear in the first section of the description (the first two lines), following the template format:

### Issue # (if applicable)

Closes #123.

Please move your issue reference to the top of the description.

Copy link
Copy Markdown
Collaborator

@aws-cdk-automation aws-cdk-automation left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(This review is outdated)

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes DynamoDB TableV2MultiAccountReplica synthesis for customer-managed KMS encryption by ensuring the generated AWS::DynamoDB::GlobalTable includes the required top-level SSESpecification, preventing CloudFormation validation failures when replica-level KMS key settings are present.

Changes:

  • Render top-level sseSpecification for TableV2MultiAccountReplica using the existing encryption helper (_renderSseSpecification()).
  • Extend the existing regression test to assert SSESpecification includes SSEEnabled: true and SSEType: KMS for the multi-account replica custom-encryption case.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts Adds top-level sseSpecification rendering to TableV2MultiAccountReplica to match required CloudFormation behavior for KMS encryption.
packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts Updates the multi-account replica encryption test to assert presence of top-level SSESpecification (KMS).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

…ryption

Adds regression test coverage for TableV2MultiAccountReplica with
customer-managed encryption, validating that the top-level SSESpecification
is correctly set. This test demonstrates the fix for aws#37783.
@aws-cdk-automation aws-cdk-automation dismissed their stale review May 23, 2026 23:21

✅ Updated pull request passes all PRLinter validations. Dismissing previous PRLinter review.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 13 changed files in this pull request and generated 1 comment.

* b. `export CDK_INTEG_MULTI_ACCOUNT=222222222222`
*
* 3. Run the integ test (from the @aws-cdk-testing/framework-integ/test directory)
* a. `yarn integ aws-dynamodb/test/integ.dynamodb-v2.cross-account-replica-kms.js`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. effort/small Small work item – less than a day of effort p2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TableV2MultiAccountReplica: does not set top-level SSESpecification when using TableEncryptionV2.customerManagedKey(), causing deployment failure

4 participants