diff --git a/src/modules/aws.rs b/src/modules/aws.rs index 9ff03a9c..e63a41c8 100644 --- a/src/modules/aws.rs +++ b/src/modules/aws.rs @@ -64,12 +64,13 @@ fn get_aws_region_from_config(context: &Context, aws_profile: Option<&str>) -> O fn get_aws_profile_and_region(context: &Context) -> (Option, Option) { let profile_env_vars = vec!["AWSU_PROFILE", "AWS_VAULT", "AWSUME_PROFILE", "AWS_PROFILE"]; + let region_env_vars = vec!["AWS_REGION", "AWS_DEFAULT_REGION"]; let profile = profile_env_vars .iter() .find_map(|env_var| context.get_env(env_var)); - let region = context - .get_env("AWS_DEFAULT_REGION") - .or_else(|| context.get_env("AWS_REGION")); + let region = region_env_vars + .iter() + .find_map(|env_var| context.get_env(env_var)); match (profile, region) { (Some(p), Some(r)) => (Some(p), Some(r)), (None, Some(r)) => (None, Some(r)), @@ -285,7 +286,7 @@ mod tests { .collect(); let expected = Some(format!( "on {}", - Color::Yellow.bold().paint("☁️ (ap-northeast-1) ") + Color::Yellow.bold().paint("☁️ (ap-northeast-2) ") )); assert_eq!(expected, actual);