How to send Terraform plan output to a Slack Channel

Hi @barywhyte !

My guess is the output will need to be formatted in some capacity to allow the cURL to accept the values. I actually sort of ran into a similar situation when setting up the following guide:

It’s using our CircleCI Slack orb, not a cURL, but you’ll see I needed to massage the output a bit to get it into the right format:

      sed -i 's/\r$//g' slack_response.txt
      SLACK_MESSAGE=$(cat slack_response.txt | tail -n 10 | sed '$!s/$/\\n/' | tr -d '\n')

With the above in mind, you’ll likely need to do something similar to the terraform output before you can pass it along. I think it essentially just needs to be formatted into valid JSON for that cURL to accept it.

I hope the above helps and if I can assist with anything else please let me know!

Regards,
-Nick