Skip to content

Commit

Permalink
plan once before apply (#2786)
Browse files Browse the repository at this point in the history
* don't plan before apply

Signed-off-by: Jason Hall <jason@chainguard.dev>

* mega plan

Signed-off-by: Jason Hall <jason@chainguard.dev>

* fix it real good

Signed-off-by: Jason Hall <jason@chainguard.dev>

---------

Signed-off-by: Jason Hall <jason@chainguard.dev>
  • Loading branch information
imjasonh authored Jun 3, 2024
1 parent 72e6c73 commit ad26a6d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/presubmit-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -181,13 +181,10 @@ jobs:
targets=""
for image in ${{ matrix.shard.images }}; do
targets+=' -target='module."${image}"''
echo "::group::Plan for ${image}"
terraform plan -target=module."${image}"
echo "::endgroup::"
done
terraform apply ${targets} -auto-approve --parallelism=$(nproc) -json | tee /tmp/mega-module.tf.json | jq -r '.["@message"]'
terraform plan ${targets} -out=plan.tfplan
terraform apply ${targets} -auto-approve --parallelism=$(nproc) -json plan.tfplan | tee /tmp/mega-module.tf.json | jq -r '.["@message"]'
- name: Collect TF diagnostics
if: ${{ always() }}
Expand Down
7 changes: 2 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,10 @@ jobs:
targets=""
for image in ${{ matrix.shard.images }}; do
targets+=' -target='module."${image}"''
echo "::group::Plan for ${image}"
terraform plan -target=module."${image}"
echo "::endgroup::"
done
terraform apply ${targets} -auto-approve --parallelism=$(nproc) -json | tee /tmp/mega-module.tf.json | jq -r '.["@message"]'
terraform plan ${targets} -out mega-module.tfplan
terraform apply ${targets} -auto-approve --parallelism=$(nproc) -json mega-module.tfplan | tee /tmp/mega-module.tf.json | jq -r '.["@message"]'
- name: Collect TF diagnostics
if: ${{ always() }}
Expand Down

0 comments on commit ad26a6d

Please sign in to comment.