Skip to content

Commit b3642bf

Browse files
authored
Merge pull request #263 from lvthillo/feat-261
fix: use generated profile name
2 parents 4859b0c + 972b863 commit b3642bf

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/index.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,6 @@ export class ImagePipeline extends Construct {
170170
this.imageRecipeComponents = [];
171171

172172
const uid = Names.uniqueId(this);
173-
const profileName = `${uid}Profile`;
174173

175174
// Construct code below
176175
this.builderSnsTopic = new sns.Topic(this, 'ImageBuilderTopic', {
@@ -198,12 +197,11 @@ export class ImagePipeline extends Construct {
198197

199198
const profile = new iam.CfnInstanceProfile(this, 'InstanceProfile', {
200199
roles: [role.roleName],
201-
instanceProfileName: profileName,
202200
});
203201

204202
if (props.securityGroups == null || props.subnetId == null) {
205203
infrastructureConfig = new imagebuilder.CfnInfrastructureConfiguration(this, 'InfrastructureConfiguration', {
206-
instanceProfileName: profileName,
204+
instanceProfileName: profile.ref,
207205
name: `${uid}InfraConfig`,
208206
description: 'Example Infrastructure Configuration for Image Builder',
209207
resourceTags: props.resourceTags,
@@ -212,7 +210,7 @@ export class ImagePipeline extends Construct {
212210
});
213211
} else {
214212
infrastructureConfig = new imagebuilder.CfnInfrastructureConfiguration(this, 'InfrastructureConfiguration', {
215-
instanceProfileName: profileName,
213+
instanceProfileName: profile.ref,
216214
name: `${uid}InfraConfig`,
217215
description: 'Example Infrastructure Configuration for Image Builder',
218216
resourceTags: props.resourceTags,

0 commit comments

Comments
 (0)