Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,65 @@
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
},
"GrantTable13160A8B": {
"Type": "AWS::DynamoDB::Table",
"Properties": {
"AttributeDefinitions": [
{
"AttributeName": "id",
"AttributeType": "S"
}
],
"KeySchema": [
{
"AttributeName": "id",
"KeyType": "HASH"
}
],
"ProvisionedThroughput": {
"ReadCapacityUnits": 5,
"WriteCapacityUnits": 5
},
"ResourcePolicy": {
"PolicyDocument": {
"Statement": [
{
"Action": [
"dynamodb:BatchWriteItem",
"dynamodb:DeleteItem",
"dynamodb:DescribeTable",
"dynamodb:PutItem",
"dynamodb:UpdateItem"
],
"Effect": "Allow",
"Principal": {
"AWS": {
"Fn::Join": [
"",
[
"arn:",
{
"Ref": "AWS::Partition"
},
":iam::",
{
"Ref": "AWS::AccountId"
},
":root"
]
]
}
},
"Resource": "*"
}
],
"Version": "2012-10-17"
}
}
},
"UpdateReplacePolicy": "Delete",
"DeletionPolicy": "Delete"
}
},
"Parameters": {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { IntegTest } from '@aws-cdk/integ-tests-alpha';
export class TestStack extends Stack {
public readonly wildcardTable: dynamodb.Table;
public readonly scopedTable: dynamodb.Table;
public readonly grantTable: dynamodb.Table;

constructor(scope: Construct, id: string, props?: StackProps) {
super(scope, id, props);
Expand Down Expand Up @@ -66,6 +67,22 @@ export class TestStack extends Stack {
// Use CloudFormation intrinsic function to construct table ARN with known table name
resources: [Fn.sub('arn:aws:dynamodb:${AWS::Region}:${AWS::AccountId}:table/my-explicit-scoped-table')],
}));

// TEST 3: Table using grant methods with AccountRootPrincipal
// This validates the fix for issue #35967: circular dependency when using grant methods
// Before fix: grant methods with AccountRootPrincipal caused circular dependency
// After fix: grant methods use resourceSelfArns: ['*'] to avoid circular dependency
this.grantTable = new dynamodb.Table(this, 'GrantTable', {
partitionKey: {
name: 'id',
type: dynamodb.AttributeType.STRING,
},
removalPolicy: RemovalPolicy.DESTROY,
});

// This should NOT cause circular dependency - validates fix for #35967
// Using grantWriteData because it has simpler actions valid for resource policies
this.grantTable.grantWriteData(new iam.AccountRootPrincipal());
}
}

Expand Down
Loading
Loading