diff --git a/builder/amazon/chroot/builder.go b/builder/amazon/chroot/builder.go index 867f963c9..637b1e40f 100644 --- a/builder/amazon/chroot/builder.go +++ b/builder/amazon/chroot/builder.go @@ -135,17 +135,6 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe session := session.New(config) ec2conn := ec2.New(session) - // If the subnet is specified but not the AZ, try to determine the AZ automatically - if b.config.SubnetId != "" && b.config.AvailabilityZone == "" { - log.Printf("[INFO] Finding AZ for the given subnet '%s'", b.config.SubnetId) - resp, err := ec2conn.DescribeSubnets([]string{b.config.SubnetId}, nil) - if err != nil { - return nil, err - } - b.config.AvailabilityZone = resp.Subnets[0].AvailabilityZone - log.Printf("[INFO] AZ found: '%s'", b.config.AvailabilityZone) - } - wrappedCommand := func(command string) (string, error) { ctx := b.config.ctx ctx.Data = &wrappedCommandTemplate{Command: command} diff --git a/builder/amazon/ebs/builder.go b/builder/amazon/ebs/builder.go index bf55d988c..be6152401 100644 --- a/builder/amazon/ebs/builder.go +++ b/builder/amazon/ebs/builder.go @@ -75,11 +75,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe // If the subnet is specified but not the AZ, try to determine the AZ automatically if b.config.SubnetId != "" && b.config.AvailabilityZone == "" { log.Printf("[INFO] Finding AZ for the given subnet '%s'", b.config.SubnetId) - resp, err := ec2conn.DescribeSubnets([]string{b.config.SubnetId}, nil) + resp, err := ec2conn.DescribeSubnets(&ec2.DescribeSubnetsInput{SubnetIds: []string{b.config.SubnetId}}) if err != nil { return nil, err } - b.config.AvailabilityZone = resp.Subnets[0].AvailabilityZone + b.config.AvailabilityZone = *resp.Subnets[0].AvailabilityZone log.Printf("[INFO] AZ found: '%s'", b.config.AvailabilityZone) } diff --git a/builder/amazon/instance/builder.go b/builder/amazon/instance/builder.go index ee7719e31..c9c1f2012 100644 --- a/builder/amazon/instance/builder.go +++ b/builder/amazon/instance/builder.go @@ -166,11 +166,11 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe // If the subnet is specified but not the AZ, try to determine the AZ automatically if b.config.SubnetId != "" && b.config.AvailabilityZone == "" { log.Printf("[INFO] Finding AZ for the given subnet '%s'", b.config.SubnetId) - resp, err := ec2conn.DescribeSubnets([]string{b.config.SubnetId}, nil) + resp, err := ec2conn.DescribeSubnets(&ec2.DescribeSubnetsInput{SubnetIds: []string{b.config.SubnetId}}) if err != nil { return nil, err } - b.config.AvailabilityZone = resp.Subnets[0].AvailabilityZone + b.config.AvailabilityZone = *resp.Subnets[0].AvailabilityZone log.Printf("[INFO] AZ found: '%s'", b.config.AvailabilityZone) }