1
0

switch to awsume

This commit is contained in:
2026-03-22 10:08:38 +01:00
parent 40d247cdd5
commit 0763449f80
4 changed files with 22 additions and 42 deletions

View File

@@ -16,11 +16,20 @@ alias d='dirs -v'
for index ({1..9}) alias "c$index"="cd +${index}"; unset index for index ({1..9}) alias "c$index"="cd +${index}"; unset index
# shfmt:ignore:end # shfmt:ignore:end
alias kpget="keepassxc-cli show -a Password ${KEEPASS_DB}"
function load_gemini() {
export GEMINI_API_KEY=$(kpget "Gemini API Key")
echo "Gemini API Key loaded into environment!"
}
_get_aws_config_path() { _get_aws_config_path() {
local config_path="${AWS_CONFIG_FILE:-$HOME/.aws/config}" local config_path="${AWS_CONFIG_FILE:-$HOME/.aws/config}"
echo "$config_path" echo "$config_path"
} }
alias awsume="source awsume"
# This label will be set in a comment in the ~/.aws/config file right before # This label will be set in a comment in the ~/.aws/config file right before
# the definition of the profile we want to use as the default. # the definition of the profile we want to use as the default.
# The format will be `#[<label value>]` # The format will be `#[<label value>]`
@@ -54,53 +63,24 @@ _get_default_aws_profile() {
echo $profile echo $profile
} }
_terra_cmd() { _awsume_cmd() {
local aws_vault_profile="$(_get_default_aws_profile)" local profile="$(_get_default_aws_profile)"
local cmd_args=()
if [[ -z "$1" ]]; then if [[ -n "$1" ]]; then
echo "Error: Missing required first argument" profile="$1"
echo "Usage: _terra_cmd [terraform|terragrunt] [additional args]"
return 1
fi fi
if [[ "$1" != "terraform" && "$1" != "terragrunt" ]]; then awsume "$profile"
echo "Error: First argument must be either 'terraform' or 'terragrunt'"
echo "Usage: _terra_cmd [terraform|terragrunt] [additional args]"
return 1
fi
# If we get here, the first argument is valid
local -r cmd="$1"
shift
while [[ $# -gt 0 ]]; do
case $1 in
-p | --profile)
if [[ $# -gt 1 ]]; then
aws_vault_profile="$2"
shift 2
else
echo "Error: -p|--profile requires a profile name"
return 1
fi
;;
*)
cmd_args+=("$1")
shift
;;
esac
done
aws-vault exec "$aws_vault_profile" -d 8h -- "$cmd" ${cmd_args[@]}
} }
alias tf="_terra_cmd terraform" alias asm="_awsume_cmd"
alias tf="terraform"
alias tfi="tf init" alias tfi="tf init"
alias tfp="tf plan -lock=false" alias tfp="tf plan -lock=false"
alias tfa="tf apply" alias tfa="tf apply"
alias tfu="tf get -update" alias tfu="tf get -update"
alias tg="_terra_cmd terragrunt" alias tg="terragrunt"
alias tgi="tg init" alias tgi="tg init"
alias tgp="tg plan -lock=false" alias tgp="tg plan -lock=false"
alias tga="tg apply" alias tga="tg apply"

View File

@@ -7,6 +7,8 @@ export SAVEHIST=$HISTSIZE
export CLICOLOR=1 export CLICOLOR=1
export KEEPASS_DB=~/Nextcloud/.keepass/localvault.kdbx
export DOTFILES="$HOME/dotfiles" export DOTFILES="$HOME/dotfiles"
export K9S_CONFIG_DIR="$HOME/.config/k9s" export K9S_CONFIG_DIR="$HOME/.config/k9s"

View File

@@ -138,10 +138,6 @@ function +vi-git-extra() {
fi fi
} }
# Kiro CLI post block. Keep at the bottom of this file.
[[ -f "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.post.zsh" ]] && builtin source "${HOME}/Library/Application Support/kiro-cli/shell/zshrc.post.zsh"
### MANAGED BY RANCHER DESKTOP START (DO NOT EDIT) ### MANAGED BY RANCHER DESKTOP START (DO NOT EDIT)
export PATH="/Users/inaki.dominguez/.rd/bin:$PATH" export PATH="/Users/inaki.dominguez/.rd/bin:$PATH"
### MANAGED BY RANCHER DESKTOP END (DO NOT EDIT) ### MANAGED BY RANCHER DESKTOP END (DO NOT EDIT)

View File

@@ -46,7 +46,9 @@ zstyle ':completion:*:*:*:*:messages' format ' %F{purple} -- %d --%f'
zstyle ':completion:*:*:*:*:warnings' format ' %F{red}-- no matches found --%f' zstyle ':completion:*:*:*:*:warnings' format ' %F{red}-- no matches found --%f'
# zstyle ':completion:*:default' list-prompt '%S%M matches%s' # zstyle ':completion:*:default' list-prompt '%S%M matches%s'
# Colors for files and directory # Colors for files and directory
# shfmt:ignore:start
zstyle ':completion:*:*:*:*:default' list-colors ${(s.:.)LS_COLORS} zstyle ':completion:*:*:*:*:default' list-colors ${(s.:.)LS_COLORS}
# shfmt:ignore:end
# Only display some tags for the command cd # Only display some tags for the command cd
zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories