Allow omitting AWS account parameter while fetching secrets#1392
Merged
djmb merged 5 commits intobasecamp:mainfrom Feb 4, 2025
Merged
Allow omitting AWS account parameter while fetching secrets#1392djmb merged 5 commits intobasecamp:mainfrom
djmb merged 5 commits intobasecamp:mainfrom
Conversation
Contributor
Author
|
@djmb Thanks for running CI, I've gone ahead and fixed the formatting issue. Could we re-run the workflows? Should all pass now hopefully 😄 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using OIDC in GHA to assume a role to execute commands via AWS cli, you do not have a profile.
For instance, running
aws configure listafter using OIDC:You don't get any profile.
Also you'd expect
kamal secrets fetch --adapter aws_secrets_managerto use whatever profile is exported asAWS_DEFAULT_PROFILE, even if it's pointing to something other than the actual profile nameddefaultif it exists.Solution
When calling
aws secretsmanager batch-get-secret-value, it's not actually required to pass an account id. If omitted, it'll follow the CLI's general precedence order for determining what account to use.So, we can modify the adapter to allow omitting the account option and defaulting it to
nil. Then, we can only add the argument conditionally if passed in.This will correctly enable use cases like deployment via GHA and OIDC.