aws-vault icon indicating copy to clipboard operation
aws-vault copied to clipboard

Support custom env variables

Open stephengroat opened this issue 7 years ago • 4 comments

Looking to see if there's any interest in support custom environment variables, i.e. FOO=bar

Primary use is for TF_VAR_foo. There's a few terraform providers (i.e. Github, etc.) that use user-scoped keys instead of globally scoped keys (global keys could be used in kms with chamber or another shared keystore, but the user-scoped keys should probably be kept locally)

is there any interest in a feature like this if a pr is made or is aws-vault soley going to focus on aws creds (completely valid as well)? also, thanks for all the great work!

stephengroat avatar Feb 13 '18 01:02 stephengroat

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Jun 23 '19 23:06 stale[bot]

News?

goldmont avatar Apr 09 '21 11:04 goldmont

Any update on this?

jmvbxx avatar Feb 06 '23 13:02 jmvbxx

As a workaround (and if you're using fish), you can set an environment variable based on the name of the profile while invoking aws-vault exec. Simply create a file ~/.config/fish/functions/aws-vault.fish with the following content, and you're done:

function aws-vault --wraps aws-vault --description 'alias aws-vault=aws-vault'
  set --local argv_nooptions (string match --invert -- '-*' $argv)
  if set --query argv_nooptions[2]; and [ $argv_nooptions[1] = exec ]
	set --local profile $argv_nooptions[2]
	set --export KUBECONFIG $HOME/.kube/config-$profile
  end 
  command aws-vault $argv  
end

Here the name of the profile gets appended to the name of the kubectl config file, so you don't have to update the kubectl config each time a different aws-vault profile is used.

teake avatar Mar 08 '24 10:03 teake