-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Open
Labels
@aws-cdk/aws-dynamodbRelated to Amazon DynamoDBRelated to Amazon DynamoDBbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp0
Description
Describe the bug
After upgrading aws-cdk-lib from v2.207.0 to v2.222.0+, a DynamoDB Table construct started creating resource-based policies that include service principals, this caused the deployment to fail
Versions tested
- v2.220.0: No issues
- v2.222.0: Build fails with dependency cycle error: "Template is undeployable, these resources have a dependency cycle"
- v2.234.1: Dependency cycle resolved, but deployment fails with: Resource handler returned message: "One or more parameter values were invalid: Invalid policy document: Policy contains invalid service principal (Service: DynamoDb, Status Code: 400)"
Possibly related PRs
- feat(core):
IEnvironmentAwareinterface to retrieve a construct's environment #35817 - fix(dynamodb): addToResourcePolicy has no effect #35554
Regression Issue
- Select this option if this issue appears to be a regression.
Last Known Working CDK Library Version
v2.220.0
Expected Behavior
DynamoDB Table construct should not generate resource-based policies with invalid service principals after upgrading CDK versions
Current Behavior
The synthesized template includes an invalid service principal in the DDB resource-based policy, it caused cfn deployment to fail.
Reproduction Steps
- Create a DynamoDB Table with
grantReadWriteDatausing aServicePrincipal:
const table = new Table(this, 'MyTable', {
tableName: 'my-table',
partitionKey: {
name: 'pk',
type: AttributeType.STRING,
},
sortKey: {
name: 'sk',
type: AttributeType.STRING,
},
encryption: TableEncryption.CUSTOMER_MANAGED,
billingMode: BillingMode.PAY_PER_REQUEST,
removalPolicy: RemovalPolicy.RETAIN,
pointInTimeRecovery: true,
});
table.grantReadWriteData(new ServicePrincipal('myservice.amazonaws.com'));
- deploy with
aws-cdk-libv2.222.0 or later.
Possible Solution
No response
Additional Information/Context
No response
AWS CDK Library version (aws-cdk-lib)
2.222.0
AWS CDK CLI version
2.1030.0
Node.js Version
v20.18.3
OS
macOS 15.7.4
Language
TypeScript
Language Version
No response
Other information
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
@aws-cdk/aws-dynamodbRelated to Amazon DynamoDBRelated to Amazon DynamoDBbugThis issue is a bug.This issue is a bug.effort/mediumMedium work item – several days of effortMedium work item – several days of effortp0