victorskl / yawsso

Yet Another AWS SSO - sync up AWS CLI v2 SSO login session to legacy CLI v1 credentials
MIT License
302 stars 26 forks source link

Allow execution of the Python script when the region of one AWS account is different from sso_region. #61

Closed dalvarezquiroga closed 2 years ago

dalvarezquiroga commented 2 years ago

Hello @victorskl !

First of all thanks for your plugin :-) I installed and use this script, login to SSO is woking fine but I always receive one message from the Terminal and I was confused with this reason:

Region mismatch with source_profile AWS SSO region. Skip syncing profile

Some context --> I'm using SSO that I have configured in AWS eu-west-1 (Ireland) but I want to do login in other account in ap-southeast-1 (Singapore) using ROLE assumed.

I take a look inside the Python script and I know what happened, for some reason you put a condition, when the region of one AWS account is different from sso_region you will see the previous "Error message" I only remove this lines and it works for me.

Please, if you consider correct the change add to your branch and create new release.

############ COMMIT ############################################################################ Change the cli.py to allow the execution of the Python script when the region of one AWS account is different from sso_region. ################################################################################################

dalvarezquiroga commented 2 years ago

@victorskl I don't know why the test are failing but I can confirm you that it works 👍 I just deployed an stack using serverless in Singapore when my SSO is configured in Ireland. You can modify manually the cli.py and see.

imagen

victorskl commented 2 years ago

Yup; test is failing because currently yawsso source profile syncing behaviour assume such that; from the target (e.g. Singapore) to source (e.g. Ireland) profile have to be in the same region -- which obviously not the case for your setup.

I have no problem supporting cross regions use case, if that what community need; such as yours change request here. As per your PR; by simply removing those same regions enforcing check lines could do the trick.

Thanks for following up with screenshot that show that it works. I will make final QA check; then I can follow up with fixing test (i.e. tl;dr you can leave that with me).

I can release this with v1.0.0 milestone which ETA in 2 weeks time along with other changes need.

HTH

victorskl commented 2 years ago

I did QA check. The patch work. I will merge this and then, I will follow up fixing unit test. FYI.