Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 11 additions & 12 deletions packages/aws-cdk/lib/api/aws-auth/awscli-compatible.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,12 @@ export class AwsCliCompatible {
public static async credentialChainBuilder(
options: CredentialChainOptions = {},
): Promise<AwsCredentialIdentityProvider> {
const clientConfig = {
requestHandler: AwsCliCompatible.requestHandlerBuilder(options.httpOptions),
customUserAgent: 'aws-cdk',
logger: options.logger,
};

/**
* The previous implementation matched AWS CLI behavior:
*
Expand All @@ -41,16 +47,12 @@ export class AwsCliCompatible {
profile: options.profile,
ignoreCache: true,
mfaCodeProvider: tokenCodeFn,
clientConfig: {
requestHandler: AwsCliCompatible.requestHandlerBuilder(options.httpOptions),
customUserAgent: 'aws-cdk',
logger: options.logger,
},
clientConfig,
logger: options.logger,
});
}

const profile = options.profile || process.env.AWS_PROFILE || process.env.AWS_DEFAULT_PROFILE;
const envProfile = process.env.AWS_PROFILE || process.env.AWS_DEFAULT_PROFILE;

/**
* Env AWS - EnvironmentCredentials with string AWS
Expand All @@ -74,13 +76,10 @@ export class AwsCliCompatible {
* fromInstanceMetadata()
*/
const nodeProviderChain = fromNodeProviderChain({
profile: profile,
clientConfig: {
requestHandler: AwsCliCompatible.requestHandlerBuilder(options.httpOptions),
customUserAgent: 'aws-cdk',
logger: options.logger,
},
profile: envProfile,
clientConfig,
logger: options.logger,
mfaCodeProvider: tokenCodeFn,
ignoreCache: true,
});

Expand Down