Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
5 changes: 3 additions & 2 deletions packages/aws-cdk-lib/aws-dynamodb/lib/table-v2.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,6 +564,7 @@ export class TableV2 extends TableBaseV2 {
this.hasSortKey = props.sortKey !== undefined;
this.region = this.stack.region;
this.tags = new TagManager(TagType.STANDARD, CfnGlobalTable.CFN_RESOURCE_TYPE_NAME);
this.resourcePolicy = props.resourcePolicy;

this.encryption = props.encryption;
this.encryptionKey = this.encryption?.tableKey;
Expand Down Expand Up @@ -737,8 +738,8 @@ export class TableV2 extends TableBaseV2 {
* @see https://github.com/aws/aws-cdk/blob/main/packages/%40aws-cdk/cx-api/FEATURE_FLAGS.md
*/
const resourcePolicy = FeatureFlags.of(this).isEnabled(cxapi.DYNAMODB_TABLEV2_RESOURCE_POLICY_PER_REPLICA)
? (props.region === this.region ? this.tableOptions.resourcePolicy : props.resourcePolicy) || undefined
: props.resourcePolicy ?? this.tableOptions.resourcePolicy;
? (props.region === this.region ? this.tableOptions.resourcePolicy : this.resourcePolicy) || undefined
: this.resourcePolicy ?? this.tableOptions.resourcePolicy;

const propTags: Record<string, string> = (props.tags ?? []).reduce((p, item) =>
({ ...p, [item.key]: item.value }), {},
Expand Down
10 changes: 5 additions & 5 deletions packages/aws-cdk-lib/aws-dynamodb/lib/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1207,6 +1207,8 @@ export class Table extends TableBase {
}
this.validateProvisioning(props);

this.resourcePolicy = props.resourcePolicy;

const kinesisStreamSpecification = props.kinesisStream
? {
streamArn: props.kinesisStream.streamArn,
Expand Down Expand Up @@ -1241,9 +1243,7 @@ export class Table extends TableBase {
kinesisStreamSpecification: kinesisStreamSpecification,
deletionProtectionEnabled: props.deletionProtection,
importSourceSpecification: this.renderImportSourceSpecification(props.importSource),
resourcePolicy: props.resourcePolicy
? { policyDocument: props.resourcePolicy }
: undefined,
resourcePolicy: Lazy.any( { produce: () => this.resourcePolicy ? { policyDocument: this.resourcePolicy } : undefined }),
warmThroughput: props.warmThroughput?? undefined,
});
this.table.applyRemovalPolicy(props.removalPolicy);
Expand Down Expand Up @@ -1662,8 +1662,8 @@ export class Table extends TableBase {
const isCompleteHandlerPolicy = new SourceTableAttachedPolicy(this, provider.isCompleteHandler.role!);

// Permissions in the source region
this.grant(onEventHandlerPolicy, 'dynamodb:*');
this.grant(isCompleteHandlerPolicy, 'dynamodb:DescribeTable');
onEventHandlerPolicy.grantPrincipal.addToPrincipalPolicy(new iam.PolicyStatement({ actions: ['dynamodb:*'], resources: [this.tableArn] }));
isCompleteHandlerPolicy.grantPrincipal.addToPrincipalPolicy(new iam.PolicyStatement({ actions: ['dynamodb:DescribeTable'], resources: [this.tableArn] }));

let previousRegion: CustomResource | undefined;
let previousRegionCondition: CfnCondition | undefined;
Expand Down
2 changes: 1 addition & 1 deletion packages/aws-cdk/lib/cli/parse-command-line-arguments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ export function parseCommandLineArguments(args: Array<string>): any {
type: 'string',
alias: 'l',
desc: 'The language to be used for the new project (default can be configured in ~/.cdk.json)',
choices: ['csharp', 'fsharp', 'go', 'java', 'javascript', 'python', 'typescript'],
choices: ['app.iml', 'csharp', 'fsharp', 'go', 'java', 'javascript', 'python', 'typescript'],
})
.option('list', {
default: undefined,
Expand Down
Loading