fix(dynamodb): avoid TableGrantsProps deprecation warnings for TableV2 - #38399
Open
deveshsinghal09 wants to merge 1 commit into
Open
fix(dynamodb): avoid TableGrantsProps deprecation warnings for TableV2#38399deveshsinghal09 wants to merge 1 commit into
deveshsinghal09 wants to merge 1 commit into
Conversation
deveshsinghal09
temporarily deployed
to
automation
July 24, 2026 16:55 — with
GitHub Actions
Inactive
deveshsinghal09
temporarily deployed
to
automation
July 24, 2026 16:55 — with
GitHub Actions
Inactive
deveshsinghal09
temporarily deployed
to
automation
July 24, 2026 16:55 — with
GitHub Actions
Inactive
aws-cdk-automation
requested changes
Jul 24, 2026
Collaborator
There was a problem hiding this comment.
The pull request linter fails with the following errors:
❌ Fixes must contain a change to a test file.
❌ Fixes must contain a change to an integration test file and the resulting snapshot.
If you believe this pull request should receive an exemption, please comment and provide a justification. A comment requesting an exemption should contain the text Exemption Request. Additionally, if clarification is needed, add Clarification Request to a comment.
✅ A exemption request has been requested. Please wait for a maintainer's review.
Author
|
Exemption Request: This PR fixes JSII deprecation warnings by removing the explicit passing of deprecated properties. It relies on existing native discovery of those properties, which is already covered by existing unit tests for the package. |
aws-cdk-automation
temporarily deployed
to
automation
July 24, 2026 17:00 — with
GitHub Actions
Inactive
aws-cdk-automation
temporarily deployed
to
automation
July 24, 2026 17:01 — with
GitHub Actions
Inactive
deveshsinghal09
temporarily deployed
to
automation
July 24, 2026 17:03 — with
GitHub Actions
Inactive
TableV2 and TableReplicaV2 were explicitly passing the deprecated encryptedResource and policyResource to TableGrantsProps. This caused warnings during synthesis, especially when TableV2 was used as an event source for lambda. Since TableV2 (via CfnGlobalTable) already natively implements IEncryptedResource (with grantOnKey) and IResourceWithPolicyV2 (with addToResourcePolicy), the IAM framework's native discovery in TableGrants will discover these resources automatically without them needing to be explicitly passed in TableGrantsProps. Fixes aws#37221
deveshsinghal09
force-pushed
the
fix/dynamodb-tablev2-deprecated-warnings
branch
from
July 24, 2026 17:11
5653421 to
fc0bbc1
Compare
deveshsinghal09
temporarily deployed
to
automation
July 24, 2026 17:11 — with
GitHub Actions
Inactive
deveshsinghal09
temporarily deployed
to
automation
July 24, 2026 17:11 — with
GitHub Actions
Inactive
aws-cdk-automation
temporarily deployed
to
automation
July 28, 2026 15:08 — with
GitHub Actions
Inactive
aws-cdk-automation
temporarily deployed
to
automation
July 28, 2026 15:08 — with
GitHub Actions
Inactive
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue # (if applicable)
Closes #37221
Summary
Fixes the
aws-cdk-lib.aws_dynamodb.TableGrantsPropsdeprecation warnings emitted when usingTableV2.Problem
When using
TableV2(for instance, withDynamoEventSource), CDK internally callstable.grantStreamRead()which constructedTableGrantsPropsusing the explicitly deprecatedpolicyResourceandencryptedResourcefields. This produced synthesis warnings that the user could not suppress:Solution
Removed the explicit passing of the deprecated
encryptedResourceandpolicyResourcefromTableV2andTableReplicaV2constructors.Since
TableV2(viaCfnGlobalTable) natively implementsIEncryptedResource(withgrantOnKey) andIResourceWithPolicyV2(withaddToResourcePolicy), the IAM framework's native discovery insideTableGrants(viaiam.EncryptedResources.of(this.table)andiam.ResourceWithPolicies.of(this.table)) will discover these resources automatically without them needing to be explicitly passed.Changes
packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts: RemovedencryptedResourceandpolicyResourcefields when instantiatingTableGrants.