Skip to content

Instantly share code, notes, and snippets.

@carl-alberto
Created October 9, 2021 11:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save carl-alberto/174f02e9abf78d2926b86cdd4327b93f to your computer and use it in GitHub Desktop.
Save carl-alberto/174f02e9abf78d2926b86cdd4327b93f to your computer and use it in GitHub Desktop.
Terminus list all domains in an org
#!/bin/bash
# usage sh listdomains.sh ORGUUID
# Exit on error
set -e
# Stash org UUID
#ORG_UUID="99da9da0-46f1-4346-8bef-03325d645b5c"
VARNAME=$1
# Stash list of all Pantheon sites in the org
#PANTHEON_SITES="$(terminus org:site:list -n ${ORG_UUID} --format=list --field=Name)"
PANTHEON_SITES="$(terminus org:site:list -n ${VARNAME} --format=list --field=Name)"
# Loop through each site in the list
while read -r PANTHEON_SITE_NAME; do
echo $PANTHEON_SITE_NAME
terminus site:info --format list --fields id -- $PANTHEON_SITE_NAME
terminus domain:list --format csv --fields id,primary $PANTHEON_SITE_NAME.live
echo '--------------------'
done <<< "$PANTHEON_SITES"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment