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
2 changes: 1 addition & 1 deletion packages/aws-cdk-lib/aws-dynamodb/lib/encryption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export abstract class TableEncryptionV2 {

if (replicaRegion === stackRegion) {
return {
kmsMasterKeyId: tableKey.keyId,
kmsMasterKeyId: tableKey.keyArn,
} satisfies CfnGlobalTable.ReplicaSSESpecificationProperty;
}

Expand Down
12 changes: 1 addition & 11 deletions packages/aws-cdk-lib/aws-dynamodb/test/encryption.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,10 @@ describe('customer managed keys', () => {
test('can render replica SSE specification in deployment region', () => {
// WHEN / THEN
expect(encryption._renderReplicaSseSpecification(stack, stack.region)).toEqual({
kmsMasterKeyId: tableKey.keyId,
kmsMasterKeyId: tableKey.keyArn,
});
});

test('replica SSE specification uses key ID format not ARN format', () => {
// WHEN
const result = encryption._renderReplicaSseSpecification(stack, stack.region);

// THEN
expect(result.kmsMasterKeyId).toBe(tableKey.keyId);
expect(result.kmsMasterKeyId).not.toBe(tableKey.keyArn);
expect(result.kmsMasterKeyId).not.toContain('arn:aws:kms');
});

test('can render replica SSE specification in replica region', () => {
// WHEN / THEN
expect(encryption._renderReplicaSseSpecification(stack, 'us-east-1')).toEqual({
Expand Down
5 changes: 4 additions & 1 deletion packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,10 @@ describe('table', () => {
Region: 'us-west-2',
SSESpecification: {
KMSMasterKeyId: {
Ref: 'Key961B73FD',
'Fn::GetAtt': [
'Key961B73FD',
'Arn',
],
},
},
TableClass: 'STANDARD_INFREQUENT_ACCESS',
Expand Down
Loading