Merge pull request #2891 from Banno/fix-upstream-aws-change
aws: build after upstream breaking change
This commit is contained in:
commit
09574c469b
|
@ -9,6 +9,7 @@ import (
|
||||||
"log"
|
"log"
|
||||||
"runtime"
|
"runtime"
|
||||||
|
|
||||||
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
awscommon "github.com/mitchellh/packer/builder/amazon/common"
|
awscommon "github.com/mitchellh/packer/builder/amazon/common"
|
||||||
|
@ -131,7 +132,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ec2conn := ec2.New(config)
|
session := session.New(config)
|
||||||
|
ec2conn := ec2.New(session)
|
||||||
|
|
||||||
wrappedCommand := func(command string) (string, error) {
|
wrappedCommand := func(command string) (string, error) {
|
||||||
ctx := b.config.ctx
|
ctx := b.config.ctx
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/mitchellh/packer/packer"
|
"github.com/mitchellh/packer/packer"
|
||||||
)
|
)
|
||||||
|
@ -72,7 +73,8 @@ func (a *Artifact) Destroy() error {
|
||||||
Credentials: a.Conn.Config.Credentials,
|
Credentials: a.Conn.Config.Credentials,
|
||||||
Region: aws.String(region),
|
Region: aws.String(region),
|
||||||
}
|
}
|
||||||
regionConn := ec2.New(regionConfig)
|
sess := session.New(regionConfig)
|
||||||
|
regionConn := ec2.New(sess)
|
||||||
|
|
||||||
input := &ec2.DeregisterImageInput{
|
input := &ec2.DeregisterImageInput{
|
||||||
ImageId: &imageId,
|
ImageId: &imageId,
|
||||||
|
|
|
@ -6,6 +6,7 @@ import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
|
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
|
@ -87,7 +88,9 @@ func amiRegionCopy(state multistep.StateBag, config *AccessConfig, name string,
|
||||||
}
|
}
|
||||||
awsConfig.Region = aws.String(target)
|
awsConfig.Region = aws.String(target)
|
||||||
|
|
||||||
regionconn := ec2.New(awsConfig)
|
sess := session.New(awsConfig)
|
||||||
|
regionconn := ec2.New(sess)
|
||||||
|
|
||||||
resp, err := regionconn.CopyImage(&ec2.CopyImageInput{
|
resp, err := regionconn.CopyImage(&ec2.CopyImageInput{
|
||||||
SourceRegion: &source,
|
SourceRegion: &source,
|
||||||
SourceImageId: &imageId,
|
SourceImageId: &imageId,
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
"github.com/mitchellh/packer/packer"
|
"github.com/mitchellh/packer/packer"
|
||||||
|
@ -33,11 +34,13 @@ func (s *StepCreateTags) Run(state multistep.StateBag) multistep.StepAction {
|
||||||
|
|
||||||
// Declare list of resources to tag
|
// Declare list of resources to tag
|
||||||
resourceIds := []*string{&ami}
|
resourceIds := []*string{&ami}
|
||||||
|
awsConfig := aws.Config{
|
||||||
regionconn := ec2.New(&aws.Config{
|
|
||||||
Credentials: ec2conn.Config.Credentials,
|
Credentials: ec2conn.Config.Credentials,
|
||||||
Region: aws.String(region),
|
Region: aws.String(region),
|
||||||
})
|
}
|
||||||
|
session := session.New(&awsConfig)
|
||||||
|
|
||||||
|
regionconn := ec2.New(session)
|
||||||
|
|
||||||
// Retrieve image list for given AMI
|
// Retrieve image list for given AMI
|
||||||
imageResp, err := regionconn.DescribeImages(&ec2.DescribeImagesInput{
|
imageResp, err := regionconn.DescribeImages(&ec2.DescribeImagesInput{
|
||||||
|
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/aws/aws-sdk-go/aws"
|
"github.com/aws/aws-sdk-go/aws"
|
||||||
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
"github.com/mitchellh/packer/packer"
|
"github.com/mitchellh/packer/packer"
|
||||||
|
@ -88,10 +89,12 @@ func (s *StepModifyAMIAttributes) Run(state multistep.StateBag) multistep.StepAc
|
||||||
|
|
||||||
for region, ami := range amis {
|
for region, ami := range amis {
|
||||||
ui.Say(fmt.Sprintf("Modifying attributes on AMI (%s)...", ami))
|
ui.Say(fmt.Sprintf("Modifying attributes on AMI (%s)...", ami))
|
||||||
regionconn := ec2.New(&aws.Config{
|
awsConfig := aws.Config{
|
||||||
Credentials: ec2conn.Config.Credentials,
|
Credentials: ec2conn.Config.Credentials,
|
||||||
Region: aws.String(region),
|
Region: aws.String(region),
|
||||||
})
|
}
|
||||||
|
session := session.New(&awsConfig)
|
||||||
|
regionconn := ec2.New(session)
|
||||||
for name, input := range options {
|
for name, input := range options {
|
||||||
ui.Message(fmt.Sprintf("Modifying: %s", name))
|
ui.Message(fmt.Sprintf("Modifying: %s", name))
|
||||||
input.ImageId = &ami
|
input.ImageId = &ami
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
|
|
||||||
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
awscommon "github.com/mitchellh/packer/builder/amazon/common"
|
awscommon "github.com/mitchellh/packer/builder/amazon/common"
|
||||||
|
@ -68,7 +69,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ec2conn := ec2.New(config)
|
session := session.New(config)
|
||||||
|
ec2conn := ec2.New(session)
|
||||||
|
|
||||||
// Setup the state bag and initial state for the steps
|
// Setup the state bag and initial state for the steps
|
||||||
state := new(multistep.BasicStateBag)
|
state := new(multistep.BasicStateBag)
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
"os"
|
"os"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
|
"github.com/aws/aws-sdk-go/aws/session"
|
||||||
"github.com/aws/aws-sdk-go/service/ec2"
|
"github.com/aws/aws-sdk-go/service/ec2"
|
||||||
"github.com/mitchellh/multistep"
|
"github.com/mitchellh/multistep"
|
||||||
awscommon "github.com/mitchellh/packer/builder/amazon/common"
|
awscommon "github.com/mitchellh/packer/builder/amazon/common"
|
||||||
|
@ -159,7 +160,8 @@ func (b *Builder) Run(ui packer.Ui, hook packer.Hook, cache packer.Cache) (packe
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ec2conn := ec2.New(config)
|
session := session.New(config)
|
||||||
|
ec2conn := ec2.New(session)
|
||||||
|
|
||||||
// Setup the state bag and initial state for the steps
|
// Setup the state bag and initial state for the steps
|
||||||
state := new(multistep.BasicStateBag)
|
state := new(multistep.BasicStateBag)
|
||||||
|
|
Loading…
Reference in New Issue