Skip to content

Commit

Permalink
fix(aws-kms): add output value when exporting an encryption key (#1036)
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamBoxall authored and Elad Ben-Israel committed Oct 30, 2018
1 parent 8f4c2ab commit cb490be
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 19 deletions.
6 changes: 6 additions & 0 deletions packages/@aws-cdk/aws-kinesis/test/test.stream.ts
Original file line number Diff line number Diff line change
Expand Up @@ -953,6 +953,12 @@ export = {
},
"Outputs": {
"MyStreamKeyKeyArn967BCB03": {
"Value": {
"Fn::GetAtt": [
"MyStreamKey76F3300E",
"Arn"
]
},
"Export": {
"Name": "MyStreamKeyKeyArn967BCB03"
}
Expand Down
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-kms/lib/key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export abstract class EncryptionKeyRef extends Construct {
*/
public export(): EncryptionKeyRefProps {
return {
keyArn: new Output(this, 'KeyArn').makeImportValue().toString()
keyArn: new Output(this, 'KeyArn', { value: this.keyArn }).makeImportValue().toString()
};
}
}
Expand Down
42 changes: 24 additions & 18 deletions packages/@aws-cdk/aws-kms/test/test.key.ts
Original file line number Diff line number Diff line change
Expand Up @@ -304,29 +304,35 @@ export = {

expect(stack1).toMatch({
Resources: {
MyKey6AB29FA6: {
Type: "AWS::KMS::Key",
Properties: {
KeyPolicy: {
Statement: [
{
Effect: "Allow",
Resource: "*"
}
],
Version: "2012-10-17"
MyKey6AB29FA6: {
Type: "AWS::KMS::Key",
Properties: {
KeyPolicy: {
Statement: [
{
Effect: "Allow",
Resource: "*"
}
],
Version: "2012-10-17"
}
},
DeletionPolicy: "Retain"
}
},
DeletionPolicy: "Retain"
}
},
Outputs: {
MyKeyKeyArn317F1332: {
Export: {
Name: "MyKeyKeyArn317F1332"
MyKeyKeyArn317F1332: {
Value: {
"Fn::GetAtt": [
"MyKey6AB29FA6",
"Arn"
]
},
Export: {
Name: "MyKeyKeyArn317F1332"
}
}
}
}
});

const stack2 = new Stack();
Expand Down

0 comments on commit cb490be

Please sign in to comment.