forked from github-aws-runners/terraform-aws-github-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
161 lines (154 loc) · 5.6 KB
/
Copy pathmain.tf
File metadata and controls
161 lines (154 loc) · 5.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
locals {
environment = var.environment != null ? var.environment : "multi-runner"
aws_region = "eu-west-1"
}
resource "random_id" "random" {
byte_length = 20
}
module "multi-runner" {
source = "../../modules/multi-runner"
multi_runner_config = {
"linux-arm64" = {
matcherConfig : {
labelMatchers = [["self-hosted", "linux", "arm64", "amazon"]]
exactMatch = true
}
fifo = true
delay_webhook_event = 0
redrive_build_queue = {
enabled = false
maxReceiveCount = null
}
runner_config = {
runner_os = "linux"
runner_architecture = "arm64"
runner_extra_labels = "amazon"
enable_ssm_on_runners = true
instance_types = ["t4g.large", "c6g.large"]
runners_maximum_count = 1
scale_down_schedule_expression = "cron(* * * * ? *)"
}
},
"linux-ubuntu" = {
matcherConfig : {
labelMatchers = [["self-hosted", "linux", "x64", "ubuntu-latest"], ["self-hosted", "linux", "x64", "ubuntu-2204"]]
exactMatch = true
}
fifo = true
delay_webhook_event = 0
redrive_build_queue = {
enabled = false
maxReceiveCount = null
}
runner_config = {
runner_os = "linux"
runner_architecture = "x64"
runner_extra_labels = "ubuntu-latest,ubuntu-2204"
runner_run_as = "ubuntu"
enable_ssm_on_runners = true
instance_types = ["m5ad.large", "m5a.large"]
runners_maximum_count = 1
scale_down_schedule_expression = "cron(* * * * ? *)"
userdata_template = "./templates/user-data.sh"
ami_owners = ["099720109477"] # Canonical's Amazon account ID
ami_filter = {
name = ["ubuntu/images/hvm-ssd/ubuntu-jammy-22.04-amd64-server-*"]
}
block_device_mappings = [{
# Set the block device name for Ubuntu root device
device_name = "/dev/sda1"
delete_on_termination = true
volume_type = "gp3"
volume_size = 30
encrypted = true
iops = null
throughput = null
kms_key_id = null
snapshot_id = null
}]
runner_log_files = [
{
log_group_name = "syslog"
prefix_log_group = true
file_path = "/var/log/syslog"
log_stream_name = "{instance_id}"
},
{
log_group_name = "user_data"
prefix_log_group = true
file_path = "/var/log/user-data.log"
log_stream_name = "{instance_id}/user_data"
},
{
log_group_name = "runner"
prefix_log_group = true
file_path = "/opt/actions-runner/_diag/Runner_**.log",
log_stream_name = "{instance_id}/runner"
}
]
}
},
"windows-x64" = {
matcherConfig : {
labelMatchers = [["self-hosted", "windows", "x64", "servercore-2022"]]
exactMatch = true
}
fifo = true
delay_webhook_event = 5
runner_config = {
runner_os = "windows"
runner_architecture = "x64"
enable_ssm_on_runners = true
instance_types = ["m5.large", "c5.large"]
runner_extra_labels = "servercore-2022"
runners_maximum_count = 1
scale_down_schedule_expression = "cron(* * * * ? *)"
runner_boot_time_in_minutes = 20
ami_filter = {
name = ["Windows_Server-2022-English-Core-ContainersLatest-*"]
}
}
},
"linux-x64" = {
matcherConfig : {
labelMatchers = [["self-hosted", "linux", "x64", "amazon"]]
exactMatch = false
}
fifo = true
delay_webhook_event = 0
runner_config = {
runner_os = "linux"
runner_architecture = "x64"
create_service_linked_role_spot = true
enable_ssm_on_runners = true
instance_types = ["m5ad.large", "m5a.large"]
runner_extra_labels = "amazon"
runners_maximum_count = 1
enable_ephemeral_runners = true
scale_down_schedule_expression = "cron(* * * * ? *)"
}
}
}
aws_region = local.aws_region
vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnets
runners_scale_up_lambda_timeout = 60
runners_scale_down_lambda_timeout = 60
prefix = local.environment
tags = {
Project = "ProjectX"
}
github_app = {
key_base64 = var.github_app.key_base64
id = var.github_app.id
webhook_secret = random_id.random.hex
}
# Assuming local build lambda's to use pre build ones, uncomment the lines below and download the
# lambda zip files lambda_download
# webhook_lambda_zip = "../lambdas-download/webhook.zip"
# runner_binaries_syncer_lambda_zip = "../lambdas-download/runner-binaries-syncer.zip"
# runners_lambda_zip = "../lambdas-download/runners.zip"
# enable_workflow_job_events_queue = true
# override delay of events in seconds
# log_level = "debug"
}