You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/cicd/deploying_with_github_actions.md
+159-9Lines changed: 159 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,9 @@
2
2
3
3
The deployment flow for Github Actions is such that when a Pull Request is created/changed an action will generate a Terraform plan and attach it as a comment to the Pull Request. In order to ensure the consistency of the plan, branch protections should be added to the master branch such that a pull request can only be merged against the latest master commit
4
4
5
-
These settings are (at least):
5
+
## Github Repository Settings
6
+
7
+
Apply these settings to your repository and default branch:
6
8
7
9
- Settings -> Pull Requests
8
10
- Check **Allow merge commits**
@@ -16,9 +18,21 @@ These settings are (at least):
16
18
- Add the name of your GH Actions workflow to *Status checks that are required*
17
19
- Check **Include administrators**
18
20
19
-
Once these settings are applied to your repo. Add a workflow file to your code.
20
-
This example shows how to automatically add plan comments to your pull requests.
21
-
This uses a standard Github action for generating a terraform plan. The documentation for this action is available [here](https://github.com/RSS-Engineering/terraform/blob/main/gh_actions/attach_plan_to_pr/README.md)
21
+
## Actions
22
+
23
+
There several workflows that you can add to properly manage your project.
24
+
25
+
*NOTE:* These workflows require that credentials be added to your repo to access
26
+
your infrastructure. While these examples assume an AWS environment, it is not a
27
+
requirement. Any cloud provider that can be configured via environment variables
28
+
will be compatible.
29
+
30
+
### Code Validation and Terraform Planning
31
+
32
+
This workflow uses a standard action for validating terraform code and generating
33
+
a terraform plan. The documentation for this action is available [here](https://github.com/RSS-Engineering/terraform/blob/main/gh_actions/attach_plan_to_pr/README.md).
34
+
This is also a good place to add additional static analysis to your project. It
35
+
can be manually invoked to apply to any branch or a number of environments.
22
36
23
37
```yaml
24
38
name: Validate Pull Request
@@ -28,6 +42,16 @@ on:
28
42
paths-ignore:
29
43
- 'docs/**'
30
44
- 'README.md'
45
+
workflow_dispatch:
46
+
inputs:
47
+
env:
48
+
description: 'Plan for Environment'
49
+
required: true
50
+
default: 'staging'
51
+
type: choice
52
+
options:
53
+
- prod
54
+
- staging
31
55
32
56
jobs:
33
57
terraform:
@@ -38,21 +62,147 @@ jobs:
38
62
- name: Checkout Repository
39
63
uses: actions/checkout@v2
40
64
65
+
# This step is only necessary to switch between multiple environments.
0 commit comments