Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(aws provider): Don't unwap external_id #18452

Merged
merged 1 commit into from
Sep 1, 2023
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
29 changes: 19 additions & 10 deletions src/aws/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,11 +221,15 @@ impl AwsAuthentication {
));
if let Some(assume_role) = assume_role {
let auth_region = region.clone().map(Region::new).unwrap_or(service_region);
let auth_external_id = external_id.clone().unwrap();
let provider = AssumeRoleProviderBuilder::new(assume_role)
.region(auth_region)
.external_id(auth_external_id)
.build(provider);
let mut builder =
AssumeRoleProviderBuilder::new(assume_role).region(auth_region);

if let Some(external_id) = external_id {
builder = builder.external_id(external_id)
}

let provider = builder.build(provider);

return Ok(SharedCredentialsProvider::new(provider));
}
Ok(provider)
Expand Down Expand Up @@ -253,11 +257,16 @@ impl AwsAuthentication {
..
} => {
let auth_region = region.clone().map(Region::new).unwrap_or(service_region);
let auth_external_id = external_id.clone().unwrap();
let provider = AssumeRoleProviderBuilder::new(assume_role)
.region(auth_region.clone())
.external_id(auth_external_id)
.build(default_credentials_provider(auth_region, *imds).await?);
let mut builder =
AssumeRoleProviderBuilder::new(assume_role).region(auth_region.clone());

if let Some(external_id) = external_id {
builder = builder.external_id(external_id)
}

let provider =
builder.build(default_credentials_provider(auth_region, *imds).await?);

Ok(SharedCredentialsProvider::new(provider))
}
AwsAuthentication::Default { imds, region, .. } => Ok(SharedCredentialsProvider::new(
Expand Down