In the RefArch Gruntwork pipelines.yml, why are plan and deploy bundled in the same job?
[r:terraform-aws-ci-pipeline-example](https://github.com/gruntwork-io/terraform-aws-ci-pipeline-example) The Gruntworks pipe for the ref arch has plan and deploy steps bundled in the same job. This causes plan to be run when merging against master, even if it was ran moments ago when pushing the changes against the branch. For large plans, this creates a big overhead in terms of time. For example: 1. Create PR, push changes. Pipeline runs plan, it takes 30min. 2. Merge PR. Pipeline runs plan, it takes 30min. Then pipe runs deploy, takes another 30mins. Why are we running plan again when merging? We already know the plan, it ran as a result of creating the PR in the first place. Wouldn't it make more sense to have these steps split into separate jobs? For longer plans, the time savings could be huge when merging. --- <ins datetime="2023-01-13T18:46:46Z"> <p><a href="https://support.gruntwork.io/hc/requests/109794">Tracked in ticket #109794</a></p> </ins>
One of our engineers responded internally with the following: > Terraform will run plan under the hood whenever you run apply - unless you give it the path to a saved plan output. It needs to do this in order to have the latest plan before applying. To fully answer this question, we need confirm that this is the same behavior that occurs with the ECS Deploy Runner's (Gruntwork Pipelines') internal usage for deploying new Reference Architectures. I'll also add that you're encouraged to re-configure the pipelines configurations however you'd like. If you want to pass a plan output between steps to avoid running plan again, you could use something like [CircleCI Artifacts](https://circleci.com/docs/artifacts/) or [GitHub Actions Artifacts](https://docs.github.com/en/actions/using-workflows/storing-workflow-data-as-artifacts). Once we've completed the internal research, we'll update this thread again.