Skip to content

Commit

Permalink
the archive_file datasource only creates files during plan (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
daryl-mcmillan authored Sep 16, 2021
1 parent 2c97bc3 commit 7783ebb
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
1 change: 1 addition & 0 deletions actions/apply/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ runs:
shell: bash
env:
PLAN_PATH: ${{ steps.download.outputs.artifacts_dir }}/terraform.plan
PLAN_ARTIFACTS: ${{ steps.download.outputs.artifacts_dir }}
ENVIRONMENT: ${{ fromJson(inputs.config).environment }}
7 changes: 7 additions & 0 deletions actions/apply/apply.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,12 @@ EOF
echo "##[group]terraform init"
terraform init -input=false -backend-config="${BACKEND_CONFIG}"
echo "##[endgroup]"

echo "##[group]restore-artifacts"
if [[ -d "${PLAN_ARTIFACTS}/.artifacts" ]]; then
cp -r "${PLAN_ARTIFACTS}/.artifacts" .
fi
echo "##[endgroup]"

terraform show "${PLAN_PATH}"
terraform apply -input=false "${PLAN_PATH}"
4 changes: 4 additions & 0 deletions actions/plan/plan.sh
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,8 @@ case "${PLAN_EXIT_CODE}" in
esac
set -e

if [[ -d .artifacts ]]; then
cp -r .artifacts "${ARTIFACTS_DIR}"
fi

terraform show -json "${ARTIFACTS_DIR}/terraform.plan" > "${ARTIFACTS_DIR}/terraform.plan.json"

0 comments on commit 7783ebb

Please # to comment.