we don't need to look for region in metadata.

Closes #4615'
This commit is contained in:
Matthew Hooker 2017-06-13 17:35:48 -07:00
parent a215eb15bc
commit 350e8bfe0d
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
1 changed files with 1 additions and 8 deletions

View File

@ -7,7 +7,6 @@ import (
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials" "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/aws/aws-sdk-go/aws/session"
"github.com/hashicorp/packer/template/interpolate" "github.com/hashicorp/packer/template/interpolate"
) )
@ -92,13 +91,7 @@ func (c *AccessConfig) Region() (string, error) {
return c.RawRegion, nil return c.RawRegion, nil
} }
sess := session.New() return "", nil
ec2meta := ec2metadata.New(sess)
identity, err := ec2meta.GetInstanceIdentityDocument()
if err != nil {
return "", err
}
return identity.Region, nil
} }
func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error { func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error {