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
This Terraform module provisions an AWS CodeBuild Runner project with an attached webhook. Currently, AWS does not support creating Runner Projects via API or CLI. This module is a workaround. Terraform creates a default project and, by applying certain webhooks, it converts the project into a Runner project. This module is useful for teams that want to run GitHub Actions on AWS-managed on-demand compute.
4
+
5
+
---
6
+
7
+
## 🛠️ Prerequisites
8
+
9
+
- A GitHub App **"AWS Connector for GitHub"** successfully installed and configured in your AWS account. [More info on that](https://qnetconfluence.cms.gov/display/ISFCS/Configuring+Github+Runners+using+AWS+CodeBuild)
10
+
- CodeConnection itself can be provisioned via Terraform but requires manual authorization from AWS. The module will fail if the connection is not authorized.
11
+
12
+
13
+
14
+
## ✨ Features
15
+
16
+
- 🚀 Provisions a CodeBuild Runner project using GitHub as the source (via CodeConnections)
17
+
- 📦 Adds default filter groups to capture key events (indirectly creates a runner project without official support)
18
+
- ➕ Supports additional user-supplied filter groups
19
+
- 🧠 Automatically configures `scope_configuration` when applicable (i.e., webhook access at repo level vs org level)
20
+
- 🔁 Defaults to Lambda compute with 2 GB memory, Linux OS, and Node.js runtime
21
+
22
+
---
23
+
24
+
## 📦 Module Usage Examples
25
+
26
+
See the [examples](examples) dir for examples of usage:
1.[Repo-level access with additional webhook filter](examples/repo-webhook)
31
+
32
+
---
33
+
34
+
## 🧩 Default Filter Groups
35
+
36
+
This default filter group is the core logic that triggers creation of a runner project. Since AWS does not officially support provisioning CodeBuild runner projects via API, this webhook indirectly transforms a default CodeBuild project into a runner-enabled project.
Copy file name to clipboardExpand all lines: README.md
+27-11Lines changed: 27 additions & 11 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,8 +9,6 @@ This Terraform module provisions an AWS CodeBuild Runner project with an attache
9
9
- A GitHub App **"AWS Connector for GitHub"** successfully installed and configured in your AWS account. [More info on that](https://qnetconfluence.cms.gov/display/ISFCS/Configuring+Github+Runners+using+AWS+CodeBuild)
10
10
- CodeConnection itself can be provisioned via Terraform but requires manual authorization from AWS. The module will fail if the connection is not authorized.
11
11
12
-
13
-
14
12
## ✨ Features
15
13
16
14
- 🚀 Provisions a CodeBuild Runner project using GitHub as the source (via CodeConnections)
@@ -23,7 +21,7 @@ This Terraform module provisions an AWS CodeBuild Runner project with an attache
23
21
24
22
## 📦 Module Usage Examples
25
23
26
-
See the [examples](examples) dir for examples of usage:
24
+
See the [examples](examples) dir for examples of usage:
|[aws_caller_identity.current](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/caller_identity)| data source |
77
+
|[aws_iam_policy_document.this](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_policy_document)| data source |
78
+
|[aws_iam_role.role](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/iam_role)| data source |
79
+
|[aws_ssm_parameter.github_personal_access_token](https://registry.terraform.io/providers/hashicorp/aws/latest/docs/data-sources/ssm_parameter)| data source |
76
80
77
81
## Inputs
78
82
79
83
| Name | Description | Type | Default | Required |
| <aname="input_additional_filter_groups"></a> [additional\_filter\_groups](#input\_additional\_filter\_groups)| Additional filter groups to be appended to the default | <pre>list(list(object({<br/> type = string<br/> pattern = string<br/> exclude_matched_pattern = optional(bool)<br/> })))</pre> |`[]`| no |
82
86
| <aname="input_build_timeout"></a> [build\_timeout](#input\_build\_timeout)| Build timeout in minutes |`number`|`5`| no |
83
-
| <aname="input_codeconnections_arn"></a> [codeconnections\_arn](#input\_codeconnections\_arn)| preauthorized ARN of the CodeConnection |`string`| n/a | yes |
87
+
| <aname="input_cloudwatch_logs_group_name"></a> [cloudwatch\_logs\_group\_name](#input\_cloudwatch\_logs\_group\_name)| Name of the CloudWatch log group |`string`|`""`| no |
88
+
| <aname="input_cloudwatch_logs_stream_name"></a> [cloudwatch\_logs\_stream\_name](#input\_cloudwatch\_logs\_stream\_name)| Name of the CloudWatch log stream |`string`|`""`| no |
89
+
| <aname="input_codeconnections_arn"></a> [codeconnections\_arn](#input\_codeconnections\_arn)| preauthorized ARN of the CodeConnection |`string`|`null`| no |
84
90
| <aname="input_description"></a> [description](#input\_description)| Description of the CodeBuild project |`string`|`""`| no |
91
+
| <aname="input_docker_server_compute_type"></a> [docker\_server\_compute\_type](#input\_docker\_server\_compute\_type)| Compute type for the Docker server. Default: null. Valid values: BUILD\_GENERAL1\_SMALL, BUILD\_GENERAL1\_MEDIUM, BUILD\_GENERAL1\_LARGE, BUILD\_GENERAL1\_XLARGE, and BUILD\_GENERAL1\_2XLARGE. |`string`|`null`| no |
92
+
| <aname="input_docker_server_security_group_ids"></a> [docker\_server\_security\_group\_ids](#input\_docker\_server\_security\_group\_ids)| The list of Security Group IDs for the Docker server. |`list(string)`|`null`| no |
| <aname="input_environment_image"></a> [environment\_image](#input\_environment\_image)| applicable image of ec2 or lambda |`string`|`"aws/codebuild/amazonlinux-x86_64-lambda-standard:nodejs20"`| no |
95
+
| <aname="input_environment_image_pull_creds"></a> [environment\_image\_pull\_creds](#input\_environment\_image\_pull\_creds)| Type of credentials AWS CodeBuild uses to pull images in your build. Valid values: CODEBUILD, SERVICE\_ROLE. |`string`|`"CODEBUILD"`| no |
87
96
| <aname="input_environment_type"></a> [environment\_type](#input\_environment\_type)| LINUX\_CONTAINER for EC2 and LINUX\_LAMBDA\_CONTAINER for Lambda |`string`|`"LINUX_LAMBDA_CONTAINER"`| no |
88
97
| <aname="input_github_org_name"></a> [github\_org\_name](#input\_github\_org\_name)| Name of your github org if webhook is of org level |`string`| n/a | yes |
98
+
| <aname="input_github_personal_access_token_ssm_parameter"></a> [github\_personal\_access\_token\_ssm\_parameter](#input\_github\_personal\_access\_token\_ssm\_parameter)| The GitHub personal access token to use for accessing the repository. If not specified then GitHub auth must be configured separately. |`string`|`null`| no |
89
99
| <aname="input_name"></a> [name](#input\_name)| Name of the CodeBuild project |`string`| n/a | yes |
90
-
| <aname="input_service_role_arn"></a> [service\_role\_arn](#input\_service\_role\_arn)| IAM role ARN for CodeBuild to assume |`string`| n/a | yes |
100
+
| <aname="input_pat_override"></a> [pat\_override](#input\_pat\_override)| Is the PAT provided an override of the default account token. Default: true |`bool`|`true`| no |
101
+
| <aname="input_privileged_mode"></a> [privileged\_mode](#input\_privileged\_mode)| Is privileged mode enabled for AWS CodeBuild. Required for Docker builds. Default: false |`bool`|`false`| no |
102
+
| <aname="input_service_role_name"></a> [service\_role\_name](#input\_service\_role\_name)| IAM role name for CodeBuild to assume |`string`| n/a | yes |
103
+
| <aname="input_source_buildspec"></a> [source\_buildspec](#input\_source\_buildspec)| The build spec declaration to use for this build project's related builds. Enter a path from your repository's root dir. |`string`|`null`| no |
104
+
| <aname="input_source_git_submodules_config_fetch"></a> [source\_git\_submodules\_config\_fetch](#input\_source\_git\_submodules\_config\_fetch)| Whether to fetch Git submodules for the AWS CodeBuild build project. |`bool`|`false`| no |
91
105
| <aname="input_source_location"></a> [source\_location](#input\_source\_location)| The git remote address for the repository |`string`|`"CODEBUILD_DEFAULT_WEBHOOK_SOURCE_LOCATION"`| no |
106
+
| <aname="input_vpc_id"></a> [vpc\_id](#input\_vpc\_id)| The VPC ID for AWS CodeBuild to launch ephemeral instances in. |`string`|`null`| no |
107
+
| <aname="input_vpc_security_group_ids"></a> [vpc\_security\_group\_ids](#input\_vpc\_security\_group\_ids)| The list of Security Group IDs for AWS CodeBuild to launch ephemeral EC2 instances in. |`list(string)`|`[]`| no |
108
+
| <aname="input_vpc_subnet_ids"></a> [vpc\_subnet\_ids](#input\_vpc\_subnet\_ids)| The list of Subnet IDs for AWS CodeBuild to launch ephemeral EC2 instances in. |`list(string)`|`[]`| no |
description="Compute type for the Docker server. Default: null. Valid values: BUILD_GENERAL1_SMALL, BUILD_GENERAL1_MEDIUM, BUILD_GENERAL1_LARGE, BUILD_GENERAL1_XLARGE, and BUILD_GENERAL1_2XLARGE."
49
+
type=string
50
+
default=null
51
+
}
52
+
53
+
variable"docker_server_security_group_ids" {
54
+
description="The list of Security Group IDs for the Docker server."
55
+
type=list(string)
56
+
default=null
57
+
}
58
+
47
59
variable"environment_type" {
48
60
type=string
49
61
description="LINUX_CONTAINER for EC2 and LINUX_LAMBDA_CONTAINER for Lambda"
0 commit comments