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: README.md
+40-12Lines changed: 40 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -90,20 +90,42 @@ What this module does not provision:
90
90
91
91
### GitHub Repo Scopes
92
92
93
-
We suggest creating a personal access token for a GitHub bot user with the following scopes:
93
+
This module accepts two GitHub tokens:
94
94
95
-
-`repo`
96
-
*`repo:status`
97
-
*`repo_deployment`
98
-
*`public_repo`
99
-
*`repo:invite`
100
-
-`admin:repo_hook`
101
-
*`write:repo_hook`
102
-
*`read:repo_hook`
95
+
1.`github_oauth_token` with permissions to pull private repos. Used by CodePipeline to clone repos before the build, and by the atlantis server to clone repos and comment on Pull Requests.
**IMPORTANT:** Do not commit this `github_oauth_token` to source control (e.g. via `terraform.tvfars`).
99
+
-`repo`
100
+
*`repo:status`
101
+
*`repo_deployment`
102
+
*`public_repo`
103
+
*`repo:invite`
104
+
105
+
2.`github_webhooks_token` with permissions to create GitHub webhooks.
106
+
Only used by [Terraform GitHub Provider](https://www.terraform.io/docs/providers/github/index.html) when provisioning the module.
107
+
It must be provided either in the `github_webhooks_token` variable, or it can also be sourced from the `GITHUB_TOKEN` environment variable.
108
+
109
+
The token needs the following OAuth scopes:
110
+
111
+
-`admin:repo_hook`
112
+
*`write:repo_hook`
113
+
*`read:repo_hook`
114
+
115
+
We suggest the following steps when creating the tokens and provisioning the module:
116
+
117
+
1. Create a GitHub bot user
118
+
2. Create the two Personal Access Tokens and add them to the bot
119
+
3. In `github.com/<org>/<repo>/settings/collaboration`, create a Team for the bot and add the bot user to it
120
+
4. Give `Admin` permissions to the Team (select it from the dropdown). We need it temporalily to provision GitHub webhooks on the repo
121
+
5. Provision the module with Terraform.
122
+
[Terraform GitHub Provider](https://www.terraform.io/docs/providers/github/index.html) will use the `github_webhooks_token` to create webhooks on the repo
123
+
6. Go to `github.com/<org>/<repo>/settings/hooks` and make sure that two webhooks have been created: one for the CodePipeline with `Releases` events,
124
+
the other is for the `atlantis` server with `Issue comments`, `Pull request reviews`, `Pull requests`, `Pull request review comments` and `Pushes` events
125
+
7.**IMPORTANT:** Remove the `Admin` permissions and add `Read` permissions for the bot Team.
126
+
The CodePipeline and `atlantis` server will use the `github_oauth_token` to clone repos, which does not require escalated privileges
127
+
128
+
**IMPORTANT:** Do not commit the tokens to source control (_e.g._ via `terraform.tvfars`).
107
129
108
130
## Usage
109
131
@@ -120,7 +142,11 @@ Module usage examples:
120
142
-[with Cognito authentication](examples/with_cognito_authentication) - complete example with Cognito authentication
121
143
122
144
123
-
**NOTE:** if no `github_oauth_token` is set, this module attempts to look one up from SSM.
145
+
**NOTE:**
146
+
147
+
If no `github_oauth_token` is set, the module attempts to look one up from SSM.
148
+
149
+
If no `github_webhooks_token` is set, [Terraform GitHub Provider](https://www.terraform.io/docs/providers/github/index.html) attempts to look one up in the `GITHUB_TOKEN` environment variable.
124
150
125
151
```
126
152
module "atlantis" {
@@ -225,6 +251,7 @@ Available targets:
225
251
| build_timeout | How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until timing out any related build that does not get marked as completed. | string |`5`| no |
226
252
| chamber_format | Format to store parameters in SSM, for consumption with chamber | string |`/%s/%s`| no |
227
253
| chamber_service | SSM parameter service name for use with chamber. This is used in chamber_format where /$chamber_service/$parameter would be the default. | string |`atlantis`| no |
254
+
| codepipeline_s3_bucket_force_destroy | A boolean that indicates all objects should be deleted from the CodePipeline artifact store S3 bucket so that the bucket can be destroyed without error | string |`false`| no |
228
255
| container_cpu | Atlantis CPUs per task | string |`256`| no |
229
256
| container_memory | Atlantis memory per task | string |`512`| no |
| enabled | Whether to create the resources. Set to `false` to prevent the module from creating any resources | string |`false`| no |
236
263
| github_oauth_token | GitHub Oauth token. If not provided the token is looked up from SSM. | string | `` | no |
237
264
| github_oauth_token_ssm_name | SSM param name to lookup GitHub OAuth token if not provided | string | `` | no |
265
+
| github_webhooks_token | GitHub OAuth Token with permissions to create webhooks. If not provided, can be sourced from the `GITHUB_TOKEN` environment variable | string | `` | no |
238
266
| healthcheck_path | Healthcheck path | string |`/healthz`| no |
239
267
| hostname | Atlantis URL | string | `` | no |
240
268
| kms_key_id | KMS key ID used to encrypt SSM SecureString parameters | string | `` | no |
Copy file name to clipboardExpand all lines: README.yaml
+38-12Lines changed: 38 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -111,20 +111,42 @@ introduction: |-
111
111
112
112
### GitHub Repo Scopes
113
113
114
-
We suggest creating a personal access token for a GitHub bot user with the following scopes:
114
+
This module accepts two GitHub tokens:
115
115
116
-
- `repo`
117
-
* `repo:status`
118
-
* `repo_deployment`
119
-
* `public_repo`
120
-
* `repo:invite`
121
-
- `admin:repo_hook`
122
-
* `write:repo_hook`
123
-
* `read:repo_hook`
116
+
1. `github_oauth_token` with permissions to pull private repos. Used by CodePipeline to clone repos before the build, and by the atlantis server to clone repos and comment on Pull Requests.
**IMPORTANT:** Do not commit this `github_oauth_token` to source control (e.g. via `terraform.tvfars`).
120
+
- `repo`
121
+
* `repo:status`
122
+
* `repo_deployment`
123
+
* `public_repo`
124
+
* `repo:invite`
125
+
126
+
2. `github_webhooks_token` with permissions to create GitHub webhooks.
127
+
Only used by [Terraform GitHub Provider](https://www.terraform.io/docs/providers/github/index.html) when provisioning the module.
128
+
It must be provided either in the `github_webhooks_token` variable, or it can also be sourced from the `GITHUB_TOKEN` environment variable.
129
+
130
+
The token needs the following OAuth scopes:
131
+
132
+
- `admin:repo_hook`
133
+
* `write:repo_hook`
134
+
* `read:repo_hook`
135
+
136
+
We suggest the following steps when creating the tokens and provisioning the module:
137
+
138
+
1. Create a GitHub bot user
139
+
2. Create the two Personal Access Tokens and add them to the bot
140
+
3. In `github.com/<org>/<repo>/settings/collaboration`, create a Team for the bot and add the bot user to it
141
+
4. Give `Admin` permissions to the Team (select it from the dropdown). We need it temporalily to provision GitHub webhooks on the repo
142
+
5. Provision the module with Terraform.
143
+
[Terraform GitHub Provider](https://www.terraform.io/docs/providers/github/index.html) will use the `github_webhooks_token` to create webhooks on the repo
144
+
6. Go to `github.com/<org>/<repo>/settings/hooks` and make sure that two webhooks have been created: one for the CodePipeline with `Releases` events,
145
+
the other is for the `atlantis` server with `Issue comments`, `Pull request reviews`, `Pull requests`, `Pull request review comments` and `Pushes` events
146
+
7. **IMPORTANT:** Remove the `Admin` permissions and add `Read` permissions for the bot Team.
147
+
The CodePipeline and `atlantis` server will use the `github_oauth_token` to clone repos, which does not require escalated privileges
148
+
149
+
**IMPORTANT:** Do not commit the tokens to source control (_e.g._ via `terraform.tvfars`).
128
150
129
151
# How to use this project
130
152
usage: |-
@@ -136,7 +158,11 @@ usage: |-
136
158
- [with Cognito authentication](examples/with_cognito_authentication) - complete example with Cognito authentication
137
159
138
160
139
-
**NOTE:** if no `github_oauth_token` is set, this module attempts to look one up from SSM.
161
+
**NOTE:**
162
+
163
+
If no `github_oauth_token` is set, the module attempts to look one up from SSM.
164
+
165
+
If no `github_webhooks_token` is set, [Terraform GitHub Provider](https://www.terraform.io/docs/providers/github/index.html) attempts to look one up in the `GITHUB_TOKEN` environment variable.
Copy file name to clipboardExpand all lines: docs/terraform.md
+2Lines changed: 2 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -51,6 +51,7 @@
51
51
| build_timeout | How long in minutes, from 5 to 480 (8 hours), for AWS CodeBuild to wait until timing out any related build that does not get marked as completed. | string |`5`| no |
52
52
| chamber_format | Format to store parameters in SSM, for consumption with chamber | string |`/%s/%s`| no |
53
53
| chamber_service | SSM parameter service name for use with chamber. This is used in chamber_format where /$chamber_service/$parameter would be the default. | string |`atlantis`| no |
54
+
| codepipeline_s3_bucket_force_destroy | A boolean that indicates all objects should be deleted from the CodePipeline artifact store S3 bucket so that the bucket can be destroyed without error | string |`false`| no |
54
55
| container_cpu | Atlantis CPUs per task | string |`256`| no |
55
56
| container_memory | Atlantis memory per task | string |`512`| no |
| enabled | Whether to create the resources. Set to `false` to prevent the module from creating any resources | string |`false`| no |
62
63
| github_oauth_token | GitHub Oauth token. If not provided the token is looked up from SSM. | string | `` | no |
63
64
| github_oauth_token_ssm_name | SSM param name to lookup GitHub OAuth token if not provided | string | `` | no |
65
+
| github_webhooks_token | GitHub OAuth Token with permissions to create webhooks. If not provided, can be sourced from the `GITHUB_TOKEN` environment variable | string | `` | no |
64
66
| healthcheck_path | Healthcheck path | string |`/healthz`| no |
65
67
| hostname | Atlantis URL | string | `` | no |
66
68
| kms_key_id | KMS key ID used to encrypt SSM SecureString parameters | string | `` | no |
description="GitHub OAuth Token with permissions to create webhooks. If not provided, can be sourced from the `GITHUB_TOKEN` environment variable"
50
+
default=""
51
+
}
52
+
47
53
variable"github_oauth_token_ssm_name" {
48
54
type="string"
49
55
description="SSM param name to lookup GitHub OAuth token if not provided"
50
56
default=""
51
57
}
52
58
59
+
variable"codepipeline_s3_bucket_force_destroy" {
60
+
description="A boolean that indicates all objects should be deleted from the CodePipeline artifact store S3 bucket so that the bucket can be destroyed without error"
0 commit comments