we don't need to look for region in metadata.
Closes #4615'
This commit is contained in:
parent
a215eb15bc
commit
350e8bfe0d
|
@ -7,7 +7,6 @@ import (
|
|||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/credentials"
|
||||
"github.com/aws/aws-sdk-go/aws/ec2metadata"
|
||||
"github.com/aws/aws-sdk-go/aws/session"
|
||||
"github.com/hashicorp/packer/template/interpolate"
|
||||
)
|
||||
|
@ -92,13 +91,7 @@ func (c *AccessConfig) Region() (string, error) {
|
|||
return c.RawRegion, nil
|
||||
}
|
||||
|
||||
sess := session.New()
|
||||
ec2meta := ec2metadata.New(sess)
|
||||
identity, err := ec2meta.GetInstanceIdentityDocument()
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return identity.Region, nil
|
||||
return "", nil
|
||||
}
|
||||
|
||||
func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error {
|
||||
|
|
Loading…
Reference in New Issue