aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.68k stars 3.93k forks source link

fix(cli): region specified in `~/.aws/credentials` is ignored #32133

Closed iliapolo closed 21 hours ago

iliapolo commented 1 day ago

We just didn't consider the shared credentials file as returned by the SDK when loading configuration.

Closes #32130.

Checklist


By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license

codecov[bot] commented 1 day ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 77.19%. Comparing base (6b0b1e1) to head (7663a56). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #32133 +/- ## ========================================== + Coverage 77.17% 77.19% +0.02% ========================================== Files 105 105 Lines 7162 7164 +2 Branches 1311 1311 ========================================== + Hits 5527 5530 +3 + Misses 1455 1454 -1 Partials 180 180 ``` | [Flag](https://app.codecov.io/gh/aws/aws-cdk/pull/32133/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws) | Coverage Δ | | |---|---|---| | [suite.unit](https://app.codecov.io/gh/aws/aws-cdk/pull/32133/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws) | `77.19% <100.00%> (+0.02%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws#carryforward-flags-in-the-pull-request-comment) to find out more. | [Components](https://app.codecov.io/gh/aws/aws-cdk/pull/32133/components?src=pr&el=components&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws) | Coverage Δ | | |---|---|---| | [packages/aws-cdk](https://app.codecov.io/gh/aws/aws-cdk/pull/32133/components?src=pr&el=component&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=aws) | `77.19% <100.00%> (+0.02%)` | :arrow_up: |
iliapolo commented 1 day ago

Exemption from integ because unit tests cover the offending code.

rix0rrr commented 1 day ago

AWS CLI does:

No region behaves as follows:

Traditionally, CDK has defaulted to us-east-1 in this case. I'm like 90% sure we used to do that to copy the AWS CLI, I wonder if they changed their behavior when migrating CLIv1 -> CLIv2

Also CDK traditionally had the behavior that if the profile doesn't have a region, we will take the region from the [default] profile, but apparently the CLI doesn't do that.

EDIT: Ohh, AWS CLIv2 now has a magic aws-global region, that they default to.

iliapolo commented 1 day ago

draft until we sort our credentials priority

aws-cdk-automation commented 1 day ago

:arrow_right: PR build request submitted to test-main-pipeline :arrow_left:

A maintainer must now check the pipeline and add the pr-linter/cli-integ-tested label once the pipeline succeeds.

mergify[bot] commented 22 hours ago

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

aws-cdk-automation commented 21 hours ago

AWS CodeBuild CI Report

Powered by github-codebuild-logs, available on the AWS Serverless Application Repository

mergify[bot] commented 21 hours ago

Thank you for contributing! Your pull request will be updated from main and then merged automatically (do not update manually, and be sure to allow changes to be pushed to your fork).

github-actions[bot] commented 21 hours ago

Comments on closed issues and PRs are hard for our team to see. If you need help, please open a new issue that references this one.