hashicorp / field-workshops-vault

Slide decks and Instruqt code for Vault Workshops
Mozilla Public License 2.0
57 stars 45 forks source link

IL-720 Quote here-doc delimiter in GitHub Actions #104

Closed thomashashi closed 1 year ago

thomashashi commented 1 year ago

When we do things in GitHub Action Workflows to shove state into json files for parsing later on, e.g.:

cat< state.json ${{ toJSON(github) }} EOF

Bash will attempt to do any expansion of the resultant body as it is writing it to the file. We likely don't want expansion anyways, and in any case when expansion happens it may no longer be valid JSON and cause errors when trying to consume it later on.

If you however do:

cat<<"EOF" > state.json [...]

by quoting any part of the here-doc delimiter, Bash won't do inline expansion.