Skip to content

Commit cb490be

Browse files
AdamBoxallElad Ben-Israel
authored andcommitted
fix(aws-kms): add output value when exporting an encryption key (#1036)
1 parent 8f4c2ab commit cb490be

File tree

3 files changed

+31
-19
lines changed

3 files changed

+31
-19
lines changed

packages/@aws-cdk/aws-kinesis/test/test.stream.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -953,6 +953,12 @@ export = {
953953
},
954954
"Outputs": {
955955
"MyStreamKeyKeyArn967BCB03": {
956+
"Value": {
957+
"Fn::GetAtt": [
958+
"MyStreamKey76F3300E",
959+
"Arn"
960+
]
961+
},
956962
"Export": {
957963
"Name": "MyStreamKeyKeyArn967BCB03"
958964
}

packages/@aws-cdk/aws-kms/lib/key.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export abstract class EncryptionKeyRef extends Construct {
7575
*/
7676
public export(): EncryptionKeyRefProps {
7777
return {
78-
keyArn: new Output(this, 'KeyArn').makeImportValue().toString()
78+
keyArn: new Output(this, 'KeyArn', { value: this.keyArn }).makeImportValue().toString()
7979
};
8080
}
8181
}

packages/@aws-cdk/aws-kms/test/test.key.ts

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -304,29 +304,35 @@ export = {
304304

305305
expect(stack1).toMatch({
306306
Resources: {
307-
MyKey6AB29FA6: {
308-
Type: "AWS::KMS::Key",
309-
Properties: {
310-
KeyPolicy: {
311-
Statement: [
312-
{
313-
Effect: "Allow",
314-
Resource: "*"
315-
}
316-
],
317-
Version: "2012-10-17"
307+
MyKey6AB29FA6: {
308+
Type: "AWS::KMS::Key",
309+
Properties: {
310+
KeyPolicy: {
311+
Statement: [
312+
{
313+
Effect: "Allow",
314+
Resource: "*"
315+
}
316+
],
317+
Version: "2012-10-17"
318+
}
319+
},
320+
DeletionPolicy: "Retain"
318321
}
319-
},
320-
DeletionPolicy: "Retain"
321-
}
322322
},
323323
Outputs: {
324-
MyKeyKeyArn317F1332: {
325-
Export: {
326-
Name: "MyKeyKeyArn317F1332"
324+
MyKeyKeyArn317F1332: {
325+
Value: {
326+
"Fn::GetAtt": [
327+
"MyKey6AB29FA6",
328+
"Arn"
329+
]
330+
},
331+
Export: {
332+
Name: "MyKeyKeyArn317F1332"
333+
}
327334
}
328335
}
329-
}
330336
});
331337

332338
const stack2 = new Stack();

0 commit comments

Comments
 (0)