Skip to content

Conversation

@ruecarlo
Copy link
Contributor

*Issue #14

Description of changes:

  • Following convention, if the command line arguments does not specify a profile, the code checks the AWS_PROFILE environment variable and if its not empty uses that instead of "default".
  • The sdk session options is now initialised with SharedConfigEnable to support shared configurations from the (~/.aws/config) as described in https://github.com/aws/aws-sdk-go#configuring-credentials

There is currently no testing around the profile flag/env-var, I've done manual testing and verified rest of test cases work. Happy to take pointers on the testing side.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

ruecarlo added 2 commits June 20, 2020 15:29
Following convention, if the command line arguments does not specify
a profile, we check the AWS_PROFILE. The sdk session options is also
initialised with SharedConfigEnable to support shared configurations
from the (~/.aws/config). https://github.com/aws/aws-sdk-go#configuring-credentials
Following convention, if the command line arguments does not specify
a profile, we check the AWS_PROFILE. The sdk session options is also
initialised with SharedConfigEnable to support shared configurations
from the (~/.aws/config). https://github.com/aws/aws-sdk-go#configuring-credentials
@ruecarlo ruecarlo changed the title Feat aws shared cred profile AWS_PROFILE Env Var Support Jun 20, 2020
@codecov-commenter
Copy link

codecov-commenter commented Jun 20, 2020

Codecov Report

Merging #15 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #15   +/-   ##
=======================================
  Coverage   89.60%   89.60%           
=======================================
  Files           7        7           
  Lines         779      779           
=======================================
  Hits          698      698           
  Misses         53       53           
  Partials       28       28           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8c62f4f...0c347c1. Read the comment docs.

Copy link
Contributor

@bwagner5 bwagner5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove unneeded custom region fill in for profiles


if profileName != nil {
sessOpts.Profile = *profileName
if sessOpts.Config.Region == nil {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you delete this block as well? I'm fairly certain this block is no longer needed since the SDK is now doing the work of populating a region in the right precedence.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you are right; Just tested without the block, and read the https://docs.aws.amazon.com/sdk-for-go/api/aws/session/#SharedConfigState carefully; Indeed not needed.

Copy link
Contributor

@bwagner5 bwagner5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm! thanks! 🥳

@bwagner5 bwagner5 merged commit 934973d into aws:master Jun 22, 2020
@ruecarlo ruecarlo deleted the feat-aws-shared-cred-profile branch June 22, 2020 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants