Skip to content

Instantly share code, notes, and snippets.

@abuxton
Last active February 3, 2022 16:11
Show Gist options
  • Save abuxton/c072112152c54dfcd53833053f729580 to your computer and use it in GitHub Desktop.
Save abuxton/c072112152c54dfcd53833053f729580 to your computer and use it in GitHub Desktop.
Scrape Globals from Replicated/terraform enterprise install.sh
#!/usr/bin/env sh -x
# script to scrape install.sh from Replicated https://help.replicated.com/docs/native/customer-installations/installing-via-script/
#
# USAGE: bash ./scrape.sh && cat globals.sh
curl https://install.terraform.io/ptfe/stable >install.sh
grep -n -b10 '() {' install.sh | grep -a1 'Globals' > grepped.txt
grep -a1 'Globals' grepped.txt | egrep -e '\b[A-Z_]+\b' | cut -d'#' -f2 | grep '^ ' | sort --unique >> globals.sh
head -n45 install.sh >> globals.sh
rm grepped.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment