diff --git a/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts b/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts index 5d38902414514..a9127cabf957a 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/lib/table.ts @@ -1630,7 +1630,7 @@ export class Table extends TableBase { } if (encryptionType !== TableEncryption.CUSTOMER_MANAGED && props.encryptionKey) { - throw new Error('`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${encryptionType})`'); + throw new Error(`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${encryptionType})`); } if (encryptionType === TableEncryption.CUSTOMER_MANAGED && props.replicationRegions) { diff --git a/packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts b/packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts index 51ff5d58a01eb..39598ee4f588a 100644 --- a/packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts +++ b/packages/aws-cdk-lib/aws-dynamodb/test/dynamodb.test.ts @@ -466,7 +466,7 @@ test('fails if encryption key is used with AWS managed CMK', () => { partitionKey: TABLE_PARTITION_KEY, encryption: TableEncryption.AWS_MANAGED, encryptionKey, - })).toThrow('`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${encryptionType})`'); + })).toThrow(`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${TableEncryption.AWS_MANAGED})`); }); test('fails if encryption key is used with default encryption', () => { @@ -479,7 +479,7 @@ test('fails if encryption key is used with default encryption', () => { partitionKey: TABLE_PARTITION_KEY, encryption: TableEncryption.DEFAULT, encryptionKey, - })).toThrow('`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${encryptionType})`'); + })).toThrow(`encryptionKey cannot be specified unless encryption is set to TableEncryption.CUSTOMER_MANAGED (it was set to ${TableEncryption.DEFAULT})`); }); testDeprecated('fails if encryption key is used with serverSideEncryption', () => {