Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: Pass Polling Config to iam instance profile step #399

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions builder/common/step_iam_instance_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import (
)

type StepIamInstanceProfile struct {
PollingConfig *AWSPollingConfig
IamInstanceProfile string
SkipProfileValidation bool
TemporaryIamInstanceProfilePolicyDocument *PolicyDocument
Expand Down Expand Up @@ -116,9 +117,13 @@ func (s *StepIamInstanceProfile) Run(ctx context.Context, state multistep.StateB
s.createdRoleName = aws.StringValue(roleResp.Role.RoleName)

log.Printf("[DEBUG] Waiting for temporary role: %s", s.createdInstanceProfileName)
err = iamsvc.WaitUntilRoleExists(&iam.GetRoleInput{
RoleName: aws.String(s.createdRoleName),
})
err = iamsvc.WaitUntilRoleExistsWithContext(
aws.BackgroundContext(),
&iam.GetRoleInput{
RoleName: aws.String(s.createdRoleName),
},
s.PollingConfig.getWaiterOptions()...,
)
if err == nil {
log.Printf("[DEBUG] Found temporary role %s", s.createdRoleName)
} else {
Expand Down
1 change: 1 addition & 0 deletions builder/ebs/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -332,6 +332,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
Ctx: b.config.ctx,
},
&awscommon.StepIamInstanceProfile{
PollingConfig: b.config.PollingConfig,
IamInstanceProfile: b.config.IamInstanceProfile,
SkipProfileValidation: b.config.SkipProfileValidation,
TemporaryIamInstanceProfilePolicyDocument: b.config.TemporaryIamInstanceProfilePolicyDocument,
Expand Down
1 change: 1 addition & 0 deletions builder/ebssurrogate/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
Ctx: b.config.ctx,
},
&awscommon.StepIamInstanceProfile{
PollingConfig: b.config.PollingConfig,
IamInstanceProfile: b.config.IamInstanceProfile,
SkipProfileValidation: b.config.SkipProfileValidation,
TemporaryIamInstanceProfilePolicyDocument: b.config.TemporaryIamInstanceProfilePolicyDocument,
Expand Down
1 change: 1 addition & 0 deletions builder/ebsvolume/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
Ctx: b.config.ctx,
},
&awscommon.StepIamInstanceProfile{
PollingConfig: b.config.PollingConfig,
IamInstanceProfile: b.config.IamInstanceProfile,
SkipProfileValidation: b.config.SkipProfileValidation,
TemporaryIamInstanceProfilePolicyDocument: b.config.TemporaryIamInstanceProfilePolicyDocument,
Expand Down
1 change: 1 addition & 0 deletions builder/instance/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -383,6 +383,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
Ctx: b.config.ctx,
},
&awscommon.StepIamInstanceProfile{
PollingConfig: b.config.PollingConfig,
IamInstanceProfile: b.config.IamInstanceProfile,
SkipProfileValidation: b.config.SkipProfileValidation,
TemporaryIamInstanceProfilePolicyDocument: b.config.TemporaryIamInstanceProfilePolicyDocument,
Expand Down