aws: unwrap AccessConfig.region func

* it was used only in the Session() call.
* default region guessing from metadata should happen in the SDK, not 'manually'
This commit is contained in:
Adrien Delorme 2019-01-25 13:02:42 +01:00
parent 54af9951a8
commit 335f442b51
1 changed files with 3 additions and 9 deletions

View File

@ -54,8 +54,9 @@ func (c *AccessConfig) Session() (*session.Session, error) {
// retries are exponentially backed off.
config = config.WithMaxRetries(8)
region, _ := c.region()
config = config.WithRegion(region)
if c.RawRegion != "" {
config = config.WithRegion(c.RawRegion)
}
if c.CustomEndpointEc2 != "" {
config = config.WithEndpoint(c.CustomEndpointEc2)
@ -139,13 +140,6 @@ func (c *AccessConfig) metadataRegion() (string, error) {
return ec2meta.Region()
}
func (c *AccessConfig) region() (string, error) {
if c.RawRegion != "" {
return c.RawRegion, nil
}
return c.metadataRegion()
}
func (c *AccessConfig) Prepare(ctx *interpolate.Context) []error {
var errs []error