diff --git a/zsh/.local/share/zsh/functions/aws-list-records b/zsh/.local/share/zsh/functions/aws-list-records new file mode 100644 index 0000000..ae41a00 --- /dev/null +++ b/zsh/.local/share/zsh/functions/aws-list-records @@ -0,0 +1,14 @@ +aws-list-records() { + # list route53 hosted zone ids and names, select the zone id using fzf + local zone_id + zone_id=$(aws route53 list-hosted-zones \ + | jq -r '.HostedZones[] | "\(.Id | split("/")[2]) \(.Name)"' \ + | fzf --header="$(printf '%-21s %s' 'Zone ID' 'Name')" \ + | awk '{print $1}') + + [[ -z "$zone_id" ]] && return 1 + + printf "# zone id: %s\n" "$zone_id" + aws route53 list-resource-record-sets --hosted-zone-id "$zone_id" | \ + jq -r '.ResourceRecordSets[] | "\(.Name)\t\(.Type)\t\(.ResourceRecords[]?.Value)"' +} diff --git a/zsh/.local/share/zsh/functions/aws-logout b/zsh/.local/share/zsh/functions/aws-logout new file mode 100644 index 0000000..eb267f4 --- /dev/null +++ b/zsh/.local/share/zsh/functions/aws-logout @@ -0,0 +1,3 @@ +aws-logout() { + unset AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN AWS_ENVIRONMENT +} diff --git a/zsh/.zshrc b/zsh/.zshrc index cc9e72f..adf15da 100644 --- a/zsh/.zshrc +++ b/zsh/.zshrc @@ -88,10 +88,10 @@ if [ -e $HOME/cfa-work/.zshrc ]; then . $HOME/cfa-work/.zshrc fi -for env in $HOME/.okta/.env $HOME/.config/aws/.env $HOME/.config/github/.env $HOME/.config/aichat/.env; do - if [ -r $env ]; then - export $(xargs < $env) - fi +for env in $HOME/.config/*/.env; do + if [ -r "$env" ]; then + export $(xargs < "$env") + fi done # command line completion @@ -131,5 +131,3 @@ zstyle :compinstall filename '~/.zshrc' #zstyle :compinstall filename '~/.zshrc' #compinit - -complete -o nospace -C /home/cli/dotfiles/zsh/.local/bin/tofu tofu