CircleCI-Public / aws-cli-orb

Install and configure the AWS command-line interface (awscli)
https://circleci.com/orbs/registry/orb/circleci/aws-cli
MIT License
57 stars 51 forks source link

AWS Default Region not making it into [default] #47

Closed davidtwamley closed 4 years ago

davidtwamley commented 4 years ago

https://github.com/CircleCI-Public/aws-cli-orb/blob/17ebc09d831a584c1c54c1f17f3ca7536cb78ce6/src/commands/setup.yml#L84

Generates what appears to be an incorrect ~/.aws/config. You can reproduce it locally like this:

# rename an existing ~/.aws/config so you can put it back after
$ aws configure set region us-west-2 --profile default
$ cat ~/.aws/config
[profile default]
region = us-west-2

According to the AWS Docs the command for default should be set default.region with no profile param. Local commands and correct output look like this:

$ aws configure set default.region us-west-2
$ cat ~/.aws/config
[default]
region = us-west-2
KyleTryon commented 4 years ago

Hello,

We have addressed this bug in our latest minor release. Thank you for reporting this! Please let us know if you continue to experience any further issues with the new release. Happy building!

https://circleci.com/orbs/registry/orb/circleci/aws-cli @1.2.0 released https://github.com/CircleCI-Public/aws-cli-orb/pull/48

davidtwamley commented 4 years ago

I do think this fixes the default case. I wonder if it has broken anyone trying to use a non-default profile though. For instance on local:

$ aws configure set default.region us-west-2 --profile something-not-default
$ cat ~/.aws/config
[default]
region = us-west-2

I think you have to branch based on profile.

if not profile or profile == "default":
    # --profile ignored for default
    aws configure set default.region <region>
else:
    # the old way
    aws configure set region <region> --profile <profile>