Skip to content

Instantly share code, notes, and snippets.

@KyMidd

KyMidd/asdf.sh Secret

Created July 31, 2024 18:22
Show Gist options
  • Save KyMidd/f6b8ef23b229745295b4eacc0f702458 to your computer and use it in GitHub Desktop.
Save KyMidd/f6b8ef23b229745295b4eacc0f702458 to your computer and use it in GitHub Desktop.
# Read the tf.plan file, filter for change line
TERRAFORM_PLAN_OUTPUT=$(terraform show -no-color tf.plan | grep -E 'Your infrastructure matches the configuration|Terraform will perform the following actions' || echo "error")
# Test if read successfully
if [[ "$TERRAFORM_PLAN_OUTPUT" == "error" ]]; then
echo "There was an issue with reading the terraform plan file, continuing to be safe"
else
echo "Terraform plan output file retrieved successfully, checking for changes"
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment