diff --git a/builder/amazon/chroot/step_register_ami.go b/builder/amazon/chroot/step_register_ami.go index 8f7622c0d..c3dc75f1d 100644 --- a/builder/amazon/chroot/step_register_ami.go +++ b/builder/amazon/chroot/step_register_ami.go @@ -82,7 +82,7 @@ func buildBaseRegisterOpts(config *Config, sourceImage *ec2.Image, rootVolumeSiz generatingNewBlockDeviceMappings := config.FromScratch || len(config.AMIMappings) > 0 if generatingNewBlockDeviceMappings { - mappings = config.AMIMappings.Build() + mappings = config.AMIMappings.BuildEC2BlockDeviceMappings() rootDeviceName = config.RootDeviceName } else { // If config.FromScratch is false, source image must be set diff --git a/builder/amazon/common/block_device.go b/builder/amazon/common/block_device.go index a5b7c2421..058b01935 100644 --- a/builder/amazon/common/block_device.go +++ b/builder/amazon/common/block_device.go @@ -58,7 +58,7 @@ type BlockDevice struct { type BlockDevices []BlockDevice -func (bds BlockDevices) Build() []*ec2.BlockDeviceMapping { +func (bds BlockDevices) BuildEC2BlockDeviceMappings() []*ec2.BlockDeviceMapping { var blockDevices []*ec2.BlockDeviceMapping for _, blockDevice := range bds { diff --git a/builder/amazon/common/block_device_test.go b/builder/amazon/common/block_device_test.go index 583a5fd27..143e7e462 100644 --- a/builder/amazon/common/block_device_test.go +++ b/builder/amazon/common/block_device_test.go @@ -151,13 +151,13 @@ func TestBlockDevice(t *testing.T) { expected := []*ec2.BlockDeviceMapping{tc.Result} - amiResults := amiBlockDevices.Build() + amiResults := amiBlockDevices.BuildEC2BlockDeviceMappings() if !reflect.DeepEqual(expected, amiResults) { t.Fatalf("Bad block device, \nexpected: %#v\n\ngot: %#v", expected, amiResults) } - launchResults := launchBlockDevices.Build() + launchResults := launchBlockDevices.BuildEC2BlockDeviceMappings() if !reflect.DeepEqual(expected, launchResults) { t.Fatalf("Bad block device, \nexpected: %#v\n\ngot: %#v", expected, launchResults) diff --git a/builder/amazon/common/step_run_source_instance.go b/builder/amazon/common/step_run_source_instance.go index 80db014fb..6af509f92 100644 --- a/builder/amazon/common/step_run_source_instance.go +++ b/builder/amazon/common/step_run_source_instance.go @@ -21,7 +21,7 @@ import ( type StepRunSourceInstance struct { AssociatePublicIpAddress bool - LaunchMappings BlockDevices + LaunchMappings BlockDevices Comm *communicator.Config Ctx interpolate.Context Debug bool @@ -111,7 +111,7 @@ func (s *StepRunSourceInstance) Run(ctx context.Context, state multistep.StateBa MaxCount: aws.Int64(1), MinCount: aws.Int64(1), IamInstanceProfile: &ec2.IamInstanceProfileSpecification{Name: &s.IamInstanceProfile}, - BlockDeviceMappings: s.LaunchMappings.Build(), + BlockDeviceMappings: s.LaunchMappings.BuildEC2BlockDeviceMappings(), Placement: &ec2.Placement{AvailabilityZone: &az}, EbsOptimized: &s.EbsOptimized, } diff --git a/builder/amazon/common/step_run_spot_instance.go b/builder/amazon/common/step_run_spot_instance.go index 7f0224099..8961e4430 100644 --- a/builder/amazon/common/step_run_spot_instance.go +++ b/builder/amazon/common/step_run_spot_instance.go @@ -106,7 +106,7 @@ func (s *StepRunSpotInstance) CreateTemplateData(userData *string, az string, // LaunchTemplateEbsBlockDeviceRequest structs are themselves // identical except for the struct's name, so you can cast one directly // into the other. - blockDeviceMappings := s.LaunchMappings.Build() + blockDeviceMappings := s.LaunchMappings.BuildEC2BlockDeviceMappings() var launchMappingRequests []*ec2.LaunchTemplateBlockDeviceMappingRequest for _, mapping := range blockDeviceMappings { launchRequest := &ec2.LaunchTemplateBlockDeviceMappingRequest{ diff --git a/builder/amazon/ebs/step_create_ami.go b/builder/amazon/ebs/step_create_ami.go index fafc9ab26..9d0fd4811 100644 --- a/builder/amazon/ebs/step_create_ami.go +++ b/builder/amazon/ebs/step_create_ami.go @@ -35,7 +35,7 @@ func (s *stepCreateAMI) Run(ctx context.Context, state multistep.StateBag) multi createOpts := &ec2.CreateImageInput{ InstanceId: instance.InstanceId, Name: &amiName, - BlockDeviceMappings: config.AMIMappings.Build(), + BlockDeviceMappings: config.AMIMappings.BuildEC2BlockDeviceMappings(), } createResp, err := ec2conn.CreateImage(createOpts) diff --git a/builder/amazon/ebssurrogate/builder.go b/builder/amazon/ebssurrogate/builder.go index e07b47cdf..860204499 100644 --- a/builder/amazon/ebssurrogate/builder.go +++ b/builder/amazon/ebssurrogate/builder.go @@ -198,8 +198,8 @@ func (b *Builder) Run(ctx context.Context, ui packer.Ui, hook packer.Hook) (pack } } - amiDevices := b.config.AMIMappings.Build() - launchDevices := b.config.LaunchMappings.Build() + amiDevices := b.config.AMIMappings.BuildEC2BlockDeviceMappings() + launchDevices := b.config.LaunchMappings.BuildEC2BlockDeviceMappings() // Build the steps steps := []multistep.Step{ diff --git a/builder/amazon/instance/step_register_ami.go b/builder/amazon/instance/step_register_ami.go index 1ad99fe70..9bb6795dc 100644 --- a/builder/amazon/instance/step_register_ami.go +++ b/builder/amazon/instance/step_register_ami.go @@ -26,7 +26,7 @@ func (s *StepRegisterAMI) Run(ctx context.Context, state multistep.StateBag) mul registerOpts := &ec2.RegisterImageInput{ ImageLocation: &manifestPath, Name: aws.String(config.AMIName), - BlockDeviceMappings: config.AMIMappings.Build(), + BlockDeviceMappings: config.AMIMappings.BuildEC2BlockDeviceMappings(), } if config.AMIVirtType != "" {