Skip to content

Commit b1f7f78

Browse files
authored
revert(dynamodb): use keyId instead of keyArn for TableV2 replica encryption (#35568)
Reverts #35144 #35144 introduced a regression that removes support for cross account keys by only using the keyId instead of keyArn. This PR reverts that change. Closes [#35551](#35551)
1 parent b0ccf81 commit b1f7f78

File tree

3 files changed

+6
-13
lines changed

3 files changed

+6
-13
lines changed

packages/aws-cdk-lib/aws-dynamodb/lib/encryption.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ export abstract class TableEncryptionV2 {
7070

7171
if (replicaRegion === stackRegion) {
7272
return {
73-
kmsMasterKeyId: tableKey.keyId,
73+
kmsMasterKeyId: tableKey.keyArn,
7474
} satisfies CfnGlobalTable.ReplicaSSESpecificationProperty;
7575
}
7676

packages/aws-cdk-lib/aws-dynamodb/test/encryption.test.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -98,20 +98,10 @@ describe('customer managed keys', () => {
9898
test('can render replica SSE specification in deployment region', () => {
9999
// WHEN / THEN
100100
expect(encryption._renderReplicaSseSpecification(stack, stack.region)).toEqual({
101-
kmsMasterKeyId: tableKey.keyId,
101+
kmsMasterKeyId: tableKey.keyArn,
102102
});
103103
});
104104

105-
test('replica SSE specification uses key ID format not ARN format', () => {
106-
// WHEN
107-
const result = encryption._renderReplicaSseSpecification(stack, stack.region);
108-
109-
// THEN
110-
expect(result.kmsMasterKeyId).toBe(tableKey.keyId);
111-
expect(result.kmsMasterKeyId).not.toBe(tableKey.keyArn);
112-
expect(result.kmsMasterKeyId).not.toContain('arn:aws:kms');
113-
});
114-
115105
test('can render replica SSE specification in replica region', () => {
116106
// WHEN / THEN
117107
expect(encryption._renderReplicaSseSpecification(stack, 'us-east-1')).toEqual({

packages/aws-cdk-lib/aws-dynamodb/test/table-v2.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -928,7 +928,10 @@ describe('table', () => {
928928
Region: 'us-west-2',
929929
SSESpecification: {
930930
KMSMasterKeyId: {
931-
Ref: 'Key961B73FD',
931+
'Fn::GetAtt': [
932+
'Key961B73FD',
933+
'Arn',
934+
],
932935
},
933936
},
934937
TableClass: 'STANDARD_INFREQUENT_ACCESS',

0 commit comments

Comments
 (0)