Skip to content

Commit

Permalink
ebs: skip_create_ami skips prevalidation of AMI name (#409)
Browse files Browse the repository at this point in the history
  • Loading branch information
lillarspillars committed Aug 11, 2023
1 parent e261421 commit 10dd914
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions builder/common/step_pre_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ type StepPreValidate struct {
DestAmiName string
ForceDeregister bool
AMISkipBuildRegion bool
AMISkipCreateImage bool
VpcId string
SubnetId string
HasSubnetFilter bool
Expand Down Expand Up @@ -89,6 +90,11 @@ func (s *StepPreValidate) Run(ctx context.Context, state multistep.StateBag) mul
return multistep.ActionContinue
}

if s.AMISkipCreateImage {
ui.Say("skip_create_ami was set; not prevalidating AMI name")
return multistep.ActionContinue
}

ec2conn := state.Get("ec2").(*ec2.EC2)

// Validate VPC settings for non-default VPCs
Expand Down
1 change: 1 addition & 0 deletions builder/ebs/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ func (b *Builder) Run(ctx context.Context, ui packersdk.Ui, hook packersdk.Hook)
DestAmiName: b.config.AMIName,
ForceDeregister: b.config.AMIForceDeregister,
AMISkipBuildRegion: b.config.AMISkipBuildRegion,
AMISkipCreateImage: b.config.AMISkipCreateImage,
VpcId: b.config.VpcId,
SubnetId: b.config.SubnetId,
HasSubnetFilter: !b.config.SubnetFilter.Empty(),
Expand Down

0 comments on commit 10dd914

Please sign in to comment.