Closed juanmatias closed 1 year ago
leverage aws sso logout
should only clean the .aws/short_project/cache/token
, and not removing or modifying the .aws/short_project/config
.aws/short_project/config
content when running leverage aws sso configure
Describe the Bug
When using SSO, running the
leverage aws sso logout
command leads to an inconsistent scenario in which the credentials are unusable.When running a Terraform command in a layer the profile used by Terraform is created with credentials got from SSO profiles. In this process the credentials are stored in
credentials
file, and the expiration time is stored inconfig
file.When logging out the credentials file is deleted, also the sso profiles in config file are deleted, but the profile used by Terraform is left in config file.
When running a new Terraform command, Leverage finds the profile in the config file with a valid expiration date, but there are no credentials in credentials file, thus it fails.
Expected Behavior
The profile should be deleted in both credentials and config file so it can be created later when a new Terraform command is run.
Steps to Reproduce
Steps to reproduce the behavior:
leverage aws configure sso
leverage tf init
leverage aws sso logout
leverage aws configure sso
leverage tf init
Environment (please complete the following information):
Anything that will help us triage the bug will help. Here are some ideas:
Additional Context
https://github.com/binbashar/le-docker-leverage-toolbox/blob/83dcaececa06f6f3da85bc7af8fde78b83ff47c2/scripts/aws-sso/aws-sso-logout.sh#L45-L57