Skip to content

Commit d496d16

Browse files
notes and telemetry info added
1 parent b05573d commit d496d16

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

src/snowflake/connector/platform_detection.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -429,6 +429,21 @@ def is_github_action():
429429
)
430430

431431

432+
def is_aws_wif_outbound_token_enabled():
433+
"""
434+
Check if AWS WIF outbound token is enabled via environment variable.
435+
436+
Returns:
437+
_DetectionState: DETECTED if ENABLE_AWS_WIF_OUTBOUND_TOKEN env var is true,
438+
NOT_DETECTED otherwise.
439+
"""
440+
return (
441+
_DetectionState.DETECTED
442+
if os.environ.get("ENABLE_AWS_WIF_OUTBOUND_TOKEN", "false").lower() == "true"
443+
else _DetectionState.NOT_DETECTED
444+
)
445+
446+
432447
@cache
433448
def detect_platforms(
434449
platform_detection_timeout_seconds: float | None,
@@ -490,6 +505,7 @@ def detect_platforms(
490505
"is_gce_cloud_run_service": is_gcp_cloud_run_service(),
491506
"is_gce_cloud_run_job": is_gcp_cloud_run_job(),
492507
"is_github_action": is_github_action(),
508+
"is_aws_wif_outbound_token_enabled": is_aws_wif_outbound_token_enabled(),
493509
}
494510

495511
# Run network-calling functions in parallel

src/snowflake/connector/wif_util.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,8 @@ def create_aws_attestation(
195195
)
196196
region = get_aws_region()
197197
partition = session.get_partition_for_region(region)
198+
# TODO: Remove this environment variable check once AWS WIF outbound token is fully released
199+
# and make it the default behavior (SNOW-2919437)
198200
if os.environ.get("ENABLE_AWS_WIF_OUTBOUND_TOKEN", "false").lower() == "true":
199201
sts_client = session.client("sts")
200202
response = sts_client.get_web_identity_token(

0 commit comments

Comments
 (0)