@@ -129,6 +129,8 @@ export interface ImagePipelineProps {
129129
130130export class ImagePipeline extends Construct {
131131 imageRecipeComponents : imagebuilder . CfnImageRecipe . ComponentConfigurationProperty [ ] ;
132+ readonly pipeline : imagebuilder . CfnImagePipeline ;
133+ readonly builderSnsTopic : sns . Topic ;
132134
133135 constructor ( scope : Construct , id : string , props : ImagePipelineProps ) {
134136 super ( scope , id ) ;
@@ -140,13 +142,13 @@ export class ImagePipeline extends Construct {
140142 const profileName = `${ uid } Profile` ;
141143
142144 // Construct code below
143- const topic = new sns . Topic ( this , 'ImageBuilderTopic' , {
145+ this . builderSnsTopic = new sns . Topic ( this , 'ImageBuilderTopic' , {
144146 displayName : 'Image Builder Notify' ,
145147 masterKey : props . kmsKey ,
146148 } ) ;
147149
148150 if ( props . email != null ) {
149- topic . addSubscription ( new subscriptions . EmailSubscription ( props . email ) ) ;
151+ this . builderSnsTopic . addSubscription ( new subscriptions . EmailSubscription ( props . email ) ) ;
150152 }
151153
152154 const role = new iam . Role ( this , 'Role' , {
@@ -174,15 +176,15 @@ export class ImagePipeline extends Construct {
174176 name : `${ uid } InfraConfig` ,
175177 description : 'Example Infrastructure Configuration for Image Builder' ,
176178 instanceTypes : props . instanceTypes ?? [ 't3.medium' , 'm5.large' , 'm5.xlarge' ] ,
177- snsTopicArn : topic . topicArn ,
179+ snsTopicArn : this . builderSnsTopic . topicArn ,
178180 } ) ;
179181 } else {
180182 infrastructureConfig = new imagebuilder . CfnInfrastructureConfiguration ( this , 'InfrastructureConfiguration' , {
181183 instanceProfileName : profileName ,
182184 name : `${ uid } InfraConfig` ,
183185 description : 'Example Infrastructure Configuration for Image Builder' ,
184186 instanceTypes : props . instanceTypes ?? [ 't3.medium' , 'm5.large' , 'm5.xlarge' ] ,
185- snsTopicArn : topic . topicArn ,
187+ snsTopicArn : this . builderSnsTopic . topicArn ,
186188 securityGroupIds : props . securityGroups ,
187189 subnetId : props . subnetId ,
188190 } ) ;
@@ -325,9 +327,9 @@ export class ImagePipeline extends Construct {
325327 } ,
326328 memorySize : 256 ,
327329 } ) ;
328- amiSsmUpdateLambda . addEventSource ( new SnsEventSource ( topic , { } ) ) ;
330+ amiSsmUpdateLambda . addEventSource ( new SnsEventSource ( this . builderSnsTopic , { } ) ) ;
329331 }
330- new imagebuilder . CfnImagePipeline ( this , 'ImagePipeline' , imagePipelineProps ) ;
332+ this . pipeline = new imagebuilder . CfnImagePipeline ( this , 'ImagePipeline' , imagePipelineProps ) ;
331333 }
332334
333335 /**
0 commit comments