Skip to content

Commit fd0b748

Browse files
Add clarity + further policy_check examples to docs
1 parent f4314e2 commit fd0b748

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

runatlantis.io/docs/policy-checking.md

+30-7
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,36 @@ policies:
4949
source: local
5050
```
5151

52-
`name` - A name of your policy set.
53-
`path` - Path to a policies directory.
54-
`source` - Tells atlantis where to fetch the policies from. Currently you can only host policies locally by using `local`.
52+
- `name` - A name of your policy set.
53+
- `path` - Path to a policies directory. *Note: replace `<CODE_DIRECTORY>` with absolute dir path to conftest policy/policies.*
54+
- `source` - Tells atlantis where to fetch the policies from. Currently you can only host policies locally by using `local`.
55+
56+
By default conftest is configured to only run the `main` package. If you wish to run specific/multiple policies consider passing `--namespace` or `--all-namespaces` to conftest [`extra_args`](https://www.runatlantis.io/docs/custom-workflows.html#adding-extra-arguments-to-terraform-commands).
57+
58+
Example Server Side Repo configuration using `--all-namespaces` and a local src dir.
59+
60+
```
61+
repos:
62+
- id: github.com/myorg/example-repo
63+
policies
64+
owners:
65+
users:
66+
- example-dev
67+
policy_sets:
68+
- name: example-conf-tests
69+
path: /home/atlantis/conftest_policies # Consider seperate vcs & mount into container
70+
source: local
71+
workflows:
72+
custom:
73+
plan:
74+
steps:
75+
- init
76+
- plan
77+
policy_check
78+
steps:
79+
- policy_check
80+
extra_args: ["-p /home/atlantis/conftest_policies/", "--all-namespaces"]
81+
```
5582

5683
### Step 3: Write the policy
5784

@@ -91,8 +118,4 @@ deny[msg] {
91118
92119
```
93120

94-
::: tip Notes
95-
By default conftest is configured to only run the `main` package. If you want to change this behavior [`extra_args`](https://www.runatlantis.io/docs/custom-workflows.html#adding-extra-arguments-to-terraform-commands) can be used to pass in flags to conftest such as `--namespace` or `--all-namespaces`
96-
:::
97-
98121
That's it! Now your Atlantis instance is configured to run policies on your Terraform plans 🎉

0 commit comments

Comments
 (0)