Skip to content

Commit

Permalink
enhancement(aws provider): Use FIPS endpoints when configured to do so (
Browse files Browse the repository at this point in the history
#18390)

This uses the default provider for FIPS which checks environment variables and configuration files
for this setting.

Part of: #18382

Signed-off-by: Jesse Szwedko <jesse.szwedko@datadoghq.com>
  • Loading branch information
jszwedko authored Aug 28, 2023
1 parent dd8a0ef commit 02c1b4c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/aws/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,9 @@ pub async fn create_client_and_region<T: ClientBuilder>(
// error up front if later SDK calls will fail due to lack of region configuration
let region = resolve_region(region).await?;

let provider_config =
aws_config::provider_config::ProviderConfig::empty().with_region(Some(region.clone()));

// Build the configuration first.
let mut config_builder = SdkConfig::builder()
.credentials_cache(auth.credentials_cache().await?)
Expand All @@ -179,6 +182,12 @@ pub async fn create_client_and_region<T: ClientBuilder>(
config_builder = config_builder.endpoint_url(endpoint_override);
}

if let Some(use_fips) =
aws_config::default_provider::use_fips::use_fips_provider(&provider_config).await
{
config_builder = config_builder.use_fips(use_fips);
}

let config = config_builder.build();

let client =
Expand Down

0 comments on commit 02c1b4c

Please sign in to comment.