Load AWS region from backend credentials

This commit is contained in:
shenlan 2025-09-30 16:34:08 +08:00
parent 3ff5504e9d
commit 03fafdc5a1

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)