@@ -129,6 +129,14 @@ export interface ImagePipelineProps {
129129
130130export class ImagePipeline extends Construct {
131131 imageRecipeComponents : imagebuilder . CfnImageRecipe . ComponentConfigurationProperty [ ] ;
132+ /**
133+ * The internal image pipeline created by this construct.
134+ */
135+ readonly pipeline : imagebuilder . CfnImagePipeline ;
136+ /**
137+ * SNS Topic where the internal ImageBuilder will notify about new builds.
138+ */
139+ readonly builderSnsTopic : sns . Topic ;
132140
133141 constructor ( scope : Construct , id : string , props : ImagePipelineProps ) {
134142 super ( scope , id ) ;
@@ -140,13 +148,13 @@ export class ImagePipeline extends Construct {
140148 const profileName = `${ uid } Profile` ;
141149
142150 // Construct code below
143- const topic = new sns . Topic ( this , 'ImageBuilderTopic' , {
151+ this . builderSnsTopic = new sns . Topic ( this , 'ImageBuilderTopic' , {
144152 displayName : 'Image Builder Notify' ,
145153 masterKey : props . kmsKey ,
146154 } ) ;
147155
148156 if ( props . email != null ) {
149- topic . addSubscription ( new subscriptions . EmailSubscription ( props . email ) ) ;
157+ this . builderSnsTopic . addSubscription ( new subscriptions . EmailSubscription ( props . email ) ) ;
150158 }
151159
152160 const role = new iam . Role ( this , 'Role' , {
@@ -174,15 +182,15 @@ export class ImagePipeline extends Construct {
174182 name : `${ uid } InfraConfig` ,
175183 description : 'Example Infrastructure Configuration for Image Builder' ,
176184 instanceTypes : props . instanceTypes ?? [ 't3.medium' , 'm5.large' , 'm5.xlarge' ] ,
177- snsTopicArn : topic . topicArn ,
185+ snsTopicArn : this . builderSnsTopic . topicArn ,
178186 } ) ;
179187 } else {
180188 infrastructureConfig = new imagebuilder . CfnInfrastructureConfiguration ( this , 'InfrastructureConfiguration' , {
181189 instanceProfileName : profileName ,
182190 name : `${ uid } InfraConfig` ,
183191 description : 'Example Infrastructure Configuration for Image Builder' ,
184192 instanceTypes : props . instanceTypes ?? [ 't3.medium' , 'm5.large' , 'm5.xlarge' ] ,
185- snsTopicArn : topic . topicArn ,
193+ snsTopicArn : this . builderSnsTopic . topicArn ,
186194 securityGroupIds : props . securityGroups ,
187195 subnetId : props . subnetId ,
188196 } ) ;
@@ -325,9 +333,9 @@ export class ImagePipeline extends Construct {
325333 } ,
326334 memorySize : 256 ,
327335 } ) ;
328- amiSsmUpdateLambda . addEventSource ( new SnsEventSource ( topic , { } ) ) ;
336+ amiSsmUpdateLambda . addEventSource ( new SnsEventSource ( this . builderSnsTopic , { } ) ) ;
329337 }
330- new imagebuilder . CfnImagePipeline ( this , 'ImagePipeline' , imagePipelineProps ) ;
338+ this . pipeline = new imagebuilder . CfnImagePipeline ( this , 'ImagePipeline' , imagePipelineProps ) ;
331339 }
332340
333341 /**
0 commit comments