Use mainAccount's region as stsRegion
Signed-off-by: Lee Chiang Fong <lee_chiang_fong@tech.gov.sg>
This commit is contained in:
@@ -500,5 +500,21 @@ describe('DefaultAwsCredentialsManager', () => {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('passes mainAccount region to fillInAccountId for account ID lookup during fallback', async () => {
|
||||
const region = 'us-west-2';
|
||||
const configWithRegion = new ConfigReader({
|
||||
aws: {
|
||||
mainAccount: {
|
||||
region,
|
||||
},
|
||||
},
|
||||
});
|
||||
const provider =
|
||||
DefaultAwsCredentialsManager.fromConfig(configWithRegion);
|
||||
await provider.getCredentialProvider({ accountId: '123456789012' });
|
||||
|
||||
expect(await stsMock.call(0).thisValue.config.region()).toEqual(region);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -175,6 +175,7 @@ export class DefaultAwsCredentialsManager implements AwsCredentialsManager {
|
||||
awsConfig.mainAccount,
|
||||
);
|
||||
const mainAccountCredProvider: AwsCredentialProvider = {
|
||||
stsRegion: awsConfig.mainAccount.region,
|
||||
sdkCredentialProvider: mainAccountSdkCredProvider,
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user