Merge pull request #122 from svc-design/codex/fix-missing-aws_region-in-credentials

Load AWS region from backend credentials
This commit is contained in:
shenlan 2025-09-30 16:35:36 +08:00 committed by GitHub
commit ecb47a929b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -118,7 +118,11 @@ except yaml.YAMLError as exc:
exports = []
iac_state = find_section(data, "iac_state")
maybe_export("IAC_STATE_BACKEND", select_backend(find_section(iac_state, "backend")), exports)
backend_section = find_section(iac_state, "backend")
maybe_export("IAC_STATE_BACKEND", select_backend(backend_section), exports)
backend_region = find_value(backend_section, "region", "aws_region", "default_region")
maybe_export("AWS_REGION", backend_region, exports)
maybe_export("AWS_DEFAULT_REGION", backend_region, exports)
state_auth = find_section(iac_state, "auth")
maybe_export("AWS_ACCESS_KEY_ID", find_value(state_auth, "ak", "access_key"), exports)