Skip to content

Commit c1d24c2

Browse files
committed
Merge branch 'jaydenrasmussen-feature/allow-passing-pre-install-userdata'
2 parents ea998c0 + deb14c2 commit c1d24c2

File tree

6 files changed

+43
-28
lines changed

6 files changed

+43
-28
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88
## [Unreleased]
9+
- Added the ability to pass in pre and post install scripts to the userdata script for the EC2 instances
910

1011
## [0.2.0] - 2020-06-15
1112

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,8 @@ No requirements.
262262
| scale\_down\_schedule\_expression | Scheduler expression to check every x for scale down. | `string` | `"cron(*/5 * * * ? *)"` | no |
263263
| subnet\_ids | List of subnets in which the action runners will be launched, the subnets needs to be subnets in the `vpc_id`. | `list(string)` | n/a | yes |
264264
| tags | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | `map(string)` | `{}` | no |
265+
| userdata\_post\_install | Script to be ran after the GitHub Actions runner is installed on the EC2 instances | `string` | `""` | no |
266+
| userdata\_pre\_install | Script to be ran before the GitHub Actions runner is installed on the EC2 instances | `string` | `""` | no |
265267
| vpc\_id | The VPC for security groups of the action runners. | `string` | n/a | yes |
266268
| webhook\_lambda\_timeout | Time out of the webhook lambda in seconds. | `number` | `10` | no |
267269
| webhook\_lambda\_zip | File location of the wehbook lambda zip file. | `string` | `null` | no |

main.tf

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ module "runners" {
7878
instance_profile_path = var.instance_profile_path
7979
role_path = var.role_path
8080
role_permissions_boundary = var.role_permissions_boundary
81+
82+
userdata_pre_install = var.userdata_pre_install
83+
userdata_post_install = var.userdata_post_install
8184
}
8285

8386
module "runner_binaries" {

modules/download-lambda/README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,27 @@ module "lambdas" {
2525
```
2626

2727
<!-- BEGINNING OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
28-
2928
## Requirements
3029

3130
No requirements.
3231

3332
## Providers
3433

3534
| Name | Version |
36-
| ---- | ------- |
37-
| null | n/a |
35+
|------|---------|
36+
| null | n/a |
3837

3938
## Inputs
4039

41-
| Name | Description | Type | Default | Required |
42-
| ------- | ------------------------------------- | ------------------------------------------------------------------- | ------- | :------: |
43-
| lambdas | Name and tag for lambdas to download. | <pre>list(object({<br> name = string<br> tag = string<br> }))</pre> | n/a | yes |
40+
| Name | Description | Type | Default | Required |
41+
|------|-------------|------|---------|:--------:|
42+
| lambdas | Name and tag for lambdas to download. | <pre>list(object({<br> name = string<br> tag = string<br> }))</pre> | n/a | yes |
4443

4544
## Outputs
4645

47-
| Name | Description |
48-
| ----- | ----------- |
49-
| files | n/a |
46+
| Name | Description |
47+
|------|-------------|
48+
| files | n/a |
5049

5150
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
5251

modules/runner-binaries-syncer/README.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,31 @@ No requirements.
4141
## Providers
4242

4343
| Name | Version |
44-
| ---- | ------- |
45-
| aws | n/a |
44+
|------|---------|
45+
| aws | n/a |
4646

4747
## Inputs
4848

49-
| Name | Description | Type | Default | Required |
50-
| ---------------------------- | ------------------------------------------------------------------------------------------------------------------- | ------------- | ---------------------- | :------: |
51-
| aws\_region | AWS region. | `string` | n/a | yes |
52-
| distribution\_bucket\_name | Bucket for storing the action runner distribution. | `string` | n/a | yes |
53-
| environment | A name that identifies the environment, used as prefix and for tagging. | `string` | n/a | yes |
54-
| lambda\_schedule\_expression | Scheduler expression for action runner binary syncer. | `string` | `"cron(27 * * * ? *)"` | no |
55-
| lambda\_timeout | Time out of the lambda in seconds. | `number` | `300` | no |
56-
| lambda\_zip | File location of the lambda zip file. | `string` | `null` | no |
57-
| role\_path | The path that will be added to the role, if not set the environment name will be used. | `string` | `null` | no |
58-
| role\_permissions\_boundary | Permissions boundary that will be added to the created role for the lambda. | `string` | `null` | no |
59-
| tags | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | `map(string)` | `{}` | no |
49+
| Name | Description | Type | Default | Required |
50+
|------|-------------|------|---------|:--------:|
51+
| aws\_region | AWS region. | `string` | n/a | yes |
52+
| distribution\_bucket\_name | Bucket for storing the action runner distribution. | `string` | n/a | yes |
53+
| environment | A name that identifies the environment, used as prefix and for tagging. | `string` | n/a | yes |
54+
| lambda\_schedule\_expression | Scheduler expression for action runner binary syncer. | `string` | `"cron(27 * * * ? *)"` | no |
55+
| lambda\_timeout | Time out of the lambda in seconds. | `number` | `300` | no |
56+
| lambda\_zip | File location of the lambda zip file. | `string` | `null` | no |
57+
| role\_path | The path that will be added to the role, if not set the environment name will be used. | `string` | `null` | no |
58+
| role\_permissions\_boundary | Permissions boundary that will be added to the created role for the lambda. | `string` | `null` | no |
59+
| tags | Map of tags that will be added to created resources. By default resources will be tagged with name and environment. | `map(string)` | `{}` | no |
6060

6161
## Outputs
6262

63-
| Name | Description |
64-
| --------------------------------- | ----------- |
65-
| bucket | n/a |
66-
| lambda | n/a |
67-
| lambda\_role | n/a |
68-
| runner\_distribution\_object\_key | n/a |
63+
| Name | Description |
64+
|------|-------------|
65+
| bucket | n/a |
66+
| lambda | n/a |
67+
| lambda\_role | n/a |
68+
| runner\_distribution\_object\_key | n/a |
6969

7070
<!-- END OF PRE-COMMIT-TERRAFORM DOCS HOOK -->
7171

variables.tf

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,13 @@ variable "kms_key_id" {
155155
type = string
156156
default = null
157157
}
158+
variable "userdata_pre_install" {
159+
type = string
160+
default = ""
161+
description = "Script to be ran before the GitHub Actions runner is installed on the EC2 instances"
162+
}
163+
variable "userdata_post_install" {
164+
type = string
165+
default = ""
166+
description = "Script to be ran after the GitHub Actions runner is installed on the EC2 instances"
167+
}

0 commit comments

Comments
 (0)