Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positive Exit Codes #79

Open
verehfy opened this issue Jul 12, 2023 · 1 comment
Open

Positive Exit Codes #79

verehfy opened this issue Jul 12, 2023 · 1 comment

Comments

@verehfy
Copy link

verehfy commented Jul 12, 2023

Hi there,

A possible enhancement to consider. We use the tool as part of some scripts to simplify running Terraform commands. It would be nice if the saml2aws-auto refresh <group-name> returned a positive exit code if the refresh fails to correctly refresh all roles. This, in turn, would force our scripts to exit rather than continue with invalid AWS tokens.

Hopefully that makes sense. Any additional information I can provide, just let me know.

@Rukenshia
Copy link
Owner

I'm not 100% sure about this - generally the only "failure" scenario for me would be:

  • Invalid Keycloak credentials or configuration
  • Invalid MFA
  • Non-existing group refreshed

Accounts in groups are built to be more tolerant of failures, which is also why the tool ignores failures during the refresh and outputs an error message with it, but I can also see your use case.

I am not sure how I would communicate which group failed to refresh using just exit codes, or is this a case where as soon as any account in the group is not refreshed, you would want to stop running your script?

The easiest method I see would not involve saml2aws-auto and rather run

aws sts get-caller-identity --profile <profile-name>

in your script (and exit on error). That way you can still run your automation/script for all profiles that do have valid credentials and skip the ones which don't.

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

No branches or pull requests

2 participants