diff --git a/builder/amazon/ebs/step_cleanup_volumes.go b/builder/amazon/common/step_cleanup_volumes.go similarity index 90% rename from builder/amazon/ebs/step_cleanup_volumes.go rename to builder/amazon/common/step_cleanup_volumes.go index 3fd0de64f..f805681bf 100644 --- a/builder/amazon/ebs/step_cleanup_volumes.go +++ b/builder/amazon/common/step_cleanup_volumes.go @@ -1,4 +1,4 @@ -package ebs +package common import ( "context" @@ -6,7 +6,6 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/service/ec2" - "github.com/hashicorp/packer/builder/amazon/common" "github.com/hashicorp/packer/helper/multistep" "github.com/hashicorp/packer/packer" ) @@ -14,16 +13,16 @@ import ( // stepCleanupVolumes cleans up any orphaned volumes that were not designated to // remain after termination of the instance. These volumes are typically ones // that are marked as "delete on terminate:false" in the source_ami of a build. -type stepCleanupVolumes struct { - BlockDevices common.BlockDevices +type StepCleanupVolumes struct { + BlockDevices BlockDevices } -func (s *stepCleanupVolumes) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { +func (s *StepCleanupVolumes) Run(_ context.Context, state multistep.StateBag) multistep.StepAction { // stepCleanupVolumes is for Cleanup only return multistep.ActionContinue } -func (s *stepCleanupVolumes) Cleanup(state multistep.StateBag) { +func (s *StepCleanupVolumes) Cleanup(state multistep.StateBag) { ec2conn := state.Get("ec2").(*ec2.EC2) instanceRaw := state.Get("instance") var instance *ec2.Instance diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go index bd10ad36a..f2c0bcbec 100644 --- a/builder/amazon/ebs/builder.go +++ b/builder/amazon/ebs/builder.go @@ -191,7 +191,7 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe VpcId: b.config.VpcId, TemporarySGSourceCidr: b.config.TemporarySGSourceCidr, }, - &stepCleanupVolumes{ + &awscommon.StepCleanupVolumes{ BlockDevices: b.config.BlockDevices, }, instanceStep, diff --git a/builder/amazon/ebssurrogate/builder.go b/builder/amazon/ebssurrogate/builder.go index 9642c1a83..e9cc8ad7d 100644 --- a/builder/amazon/ebssurrogate/builder.go +++ b/builder/amazon/ebssurrogate/builder.go @@ -208,6 +208,9 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe VpcId: b.config.VpcId, TemporarySGSourceCidr: b.config.TemporarySGSourceCidr, }, + &awscommon.StepCleanupVolumes{ + BlockDevices: b.config.BlockDevices, + }, instanceStep, &awscommon.StepGetPassword{ Debug: b.config.PackerDebug,