Move CLIConfig instantiation inside of ProfileName check.
This commit is contained in:
parent
883acb18fa
commit
7975c5e336
|
@ -29,12 +29,6 @@ type AccessConfig struct {
|
|||
func (c *AccessConfig) Config() (*aws.Config, error) {
|
||||
var creds *credentials.Credentials
|
||||
|
||||
profile := &CLIConfig{}
|
||||
err := profile.Prepare(c.ProfileName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
region, err := c.Region()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -46,6 +40,11 @@ func (c *AccessConfig) Config() (*aws.Config, error) {
|
|||
}
|
||||
|
||||
if c.ProfileName != "" {
|
||||
profile := &CLIConfig{}
|
||||
err := profile.Prepare(c.ProfileName)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
creds = c.assumeRoleCreds(config, profile)
|
||||
} else {
|
||||
creds = credentials.NewChainCredentials([]credentials.Provider{
|
||||
|
|
Loading…
Reference in New Issue