Skip to content

Commit

Permalink
only run hcl2json over .tf files
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisns committed Mar 31, 2022
1 parent 72f9838 commit 68a9033
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ if compgen -G "./*.tf" > /dev/null; then
echo "Found Terraform files"

echo "Checking policy version..."
hcl2tojson -s . /tmp/hcl2tojson
mkdir /tmp/tf
cp -r * /tmp/tf
hcl2tojson -s /tmp/tf /tmp/hcl2tojson

FETCHED_POLICY_VERSION=$(jq -n '[inputs]' /tmp/hcl2tojson/*.json | jq -r 'map(select(.variable))[].variable|map(select(.["mycompany.com/policy-version"]))[0]["mycompany.com/policy-version"].default[0]')
POLICY_VERSION="${FETCHED_POLICY_VERSION:=$POLICY_VERSION}"
Expand Down

0 comments on commit 68a9033

Please sign in to comment.