Skip to content

Commit e30d9a1

Browse files
authored
Merge pull request #138 from derrike/fix/kms-key
fix: convert kms key alias to ikey
2 parents 19f53c0 + dbda444 commit e30d9a1

File tree

4 files changed

+17
-26
lines changed

4 files changed

+17
-26
lines changed

API.md

Lines changed: 13 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ Be sure to update the `imageRecipeVersion` property when making updates to your
281281
282282
---
283283
284-
Specify an alias via the `kmsKeyAlias` property which will be used to encrypt the SNS topic.
284+
Specify a KMS Key via the `kmsKey` property which will be used to encrypt the SNS topic.
285285
286286
### Infrastructure Configuration Instance Types
287287

src/index.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ export interface ImagePipelineProps {
7676
*/
7777
readonly parentImage: string;
7878
/**
79-
* KMS Key used to encrypt the SNS topic. Enter an existing KMS Key Alias in your target account/region.
79+
* KMS Key used to encrypt the SNS topic.
8080
*/
81-
readonly kmsKeyAlias: string;
81+
readonly kmsKey?: kms.IKey;
8282
/**
8383
* List of instance types used in the Instance Configuration (Default: [ 't3.medium', 'm5.large', 'm5.xlarge' ])
8484
*/
@@ -151,13 +151,9 @@ export class ImagePipeline extends Construct {
151151
this.imageRecipeComponents = [];
152152

153153
// Construct code below
154-
const kmsKey = kms.Key.fromLookup(this, 'KmsKeyLookup', {
155-
aliasName: props.kmsKeyAlias,
156-
});
157-
158154
const topic = new sns.Topic(this, 'ImageBuilderTopic', {
159155
displayName: 'Image Builder Notify',
160-
masterKey: kmsKey,
156+
masterKey: props.kmsKey,
161157
});
162158

163159
if (props.email != null) {

test/imagepipeline.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ const props: ImagePipelineProps = {
2222
imageRecipe: 'TestImageRecipe',
2323
pipelineName: 'TestImagePipeline',
2424
parentImage: 'ami-04505e74c0741db8d', // Ubuntu Server 20.04 LTS
25-
kmsKeyAlias: 'alias/app1/key',
2625
2726
enableVulnScans: true,
2827
vulnScansRepoName: 'image-builder-vuln-scans',
@@ -45,7 +44,6 @@ const propsWithNetworking: ImagePipelineProps = {
4544
imageRecipe: 'TestImageRecipe',
4645
pipelineName: 'TestImagePipeline',
4746
parentImage: 'ami-04505e74c0741db8d', // Ubuntu Server 20.04 LTS
48-
kmsKeyAlias: 'alias/app1/key',
4947
securityGroups: ['sg-12345678'],
5048
subnetId: 'subnet-12345678',
5149
};
@@ -63,7 +61,6 @@ const propsWithVolumeConfig: ImagePipelineProps = {
6361
imageRecipe: 'TestImageRecipe',
6462
pipelineName: 'TestImagePipeline',
6563
parentImage: 'ami-04505e74c0741db8d', // Ubuntu Server 20.04 LTS
66-
kmsKeyAlias: 'alias/app1/key',
6764
securityGroups: ['sg-12345678'],
6865
subnetId: 'subnet-12345678',
6966
ebsVolumeConfigurations: [

0 commit comments

Comments
 (0)