Skip to content

Commit e79a3b5

Browse files
committed
fix
1 parent 29a050e commit e79a3b5

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

datadog_lambda/api.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,17 @@ def get_api_key() -> str:
101101
elif DD_API_KEY_SSM_NAME:
102102
# SSM endpoints: https://docs.aws.amazon.com/general/latest/gr/ssm.html
103103
fips_endpoint = None
104-
if config.fips_mode_enabled and LAMBDA_REGION in SSM_FIPS_SUPPORTED_REGIONS:
105-
fips_endpoint = f"https://ssm-fips.{LAMBDA_REGION}.amazonaws.com"
106-
else:
107-
if not config.is_gov_region:
108-
# Log warning if FIPS is enabled for a commercial region that does not support SSM FIPS endpoints
109-
logger.warning(
110-
"FIPS mode is enabled but region '%s' does not support SSM FIPS endpoints. Using standard SSM endpoint.",
111-
LAMBDA_REGION,
112-
)
104+
if config.fips_mode_enabled:
105+
if LAMBDA_REGION in SSM_FIPS_SUPPORTED_REGIONS:
106+
fips_endpoint = f"https://ssm-fips.{LAMBDA_REGION}.amazonaws.com"
107+
else:
108+
# Log warning if SSM FIPS endpoint is not supported for commercial region
109+
if not config.is_gov_region:
110+
logger.warning(
111+
"FIPS mode is enabled, but '%s' does not support SSM FIPS endpoints. "
112+
"Using standard SSM endpoint.",
113+
LAMBDA_REGION,
114+
)
113115
ssm_client = _boto3_client("ssm", endpoint_url=fips_endpoint)
114116
api_key = ssm_client.get_parameter(
115117
Name=DD_API_KEY_SSM_NAME, WithDecryption=True

0 commit comments

Comments
 (0)