Skip to content

Commit 935b82f

Browse files
DEV-666 Add Running Plan/Apply Guide (#2208)
* Add Running Plan/Apply Guide * Add Destroying Infrastructure section
1 parent b4334c7 commit 935b82f

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed
Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,46 @@
11
# Running Plan/Apply with Pipelines
22

3-
This page is under construction.
3+
When changes are made to your committed IaC, Pipelines detects these infrastructure changes and runs Terragrunt Plan/Apply on your units. Changes that occur in commits that are included in Pull Requests targeting your [Deploy Branch](/2.0/reference/pipelines/configurations-as-code/api#deploy_branch_name) (e.g. `main` or `master`) will trigger Terragrunt **Plan**. Changes in commits _on_ your [Deploy Branch](/2.0/reference/pipelines/configurations-as-code/api#deploy_branch_name) will trigger a Terragrunt **Apply**.
4+
5+
The recommended workflow when working with Pipelines is to create a new Pull Request with the desired changes, then review the output of Terragrunt Plan to confirm that the resulting infrastructure changes are expected. We recommend enforcing [Branch Protection](/2.0/docs/pipelines/installation/branch-protection/#recommended-settings) and especially the [Require branches to be up to date](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-protected-branches/about-protected-branches#require-status-checks-before-merging) status check on your repository as this will restrict the PR from being merged if the Plan may be out of date.
6+
7+
## Running Plan
8+
9+
To trigger a **Plan**, create an infrastructure change such as adding or modify a `terragrunt.hcl` unit on a new branch, then open a new Pull Request to merge this branch into your Deploy Branch. Once the Pull Request is open Pipelines will add a comment to the PR including the output of the Plan.
10+
11+
![Screenshot of Plan Comment](/img/pipelines/guides/plan-comment.png)
12+
13+
## Running Apply
14+
15+
To run an **Apply**, merge your changes into the Deploy Branch. All commits including Merge commits on the Deploy Branch will trigger an apply if infrastructure changes are detected.
16+
17+
Pipelines will add a comment to the (merged) Pull Request with the output of the Apply.
18+
19+
## Skipping Pipelines Plan/Apply
20+
21+
You may occasionally need to skip Pipelines on particular commits. This can be done by adding one of the [workflow skip messages](https://docs.github.com/en/actions/managing-workflow-runs-and-deployments/managing-workflow-runs/skipping-workflow-runs) such as `[no ci]` into your commit message.
22+
23+
You can also modify the `paths-ignore` filter in `.github/workflows/pipelines.yml` within your repository to exclude an entire directory from triggering Pipelines.
24+
25+
For example, to exclude a directory with the name `local-testing` you would modify the workflow
26+
```hcl title=".github/workflows/pipelines.yml"
27+
on:
28+
push:
29+
branches:
30+
- main
31+
paths-ignore:
32+
# Workflow does not run only if ALL filepaths match the pattern. See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-excluding-paths
33+
- ".github/**"
34+
- "local-testing/**"
35+
pull_request:
36+
types:
37+
- opened
38+
- synchronize
39+
- reopened
40+
paths-ignore:
41+
- "local-testing/**"
42+
```
43+
44+
## Destroying Infrastructure
45+
46+
To **Destroy** infrastructure create a commit deleting the Terragrunt unit. Pipelines will detect the deletion and trigger Terragrunt to run a `plan -destroy` on pull requests or `destroy` on your Deploy Branch. Pipelines automatically checks out the previous committed version of the infrastructure so that Terragrunt can run in the (now deleted) directory.
58.8 KB
Loading

0 commit comments

Comments
 (0)