-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.tf
33 lines (28 loc) · 1012 Bytes
/
main.tf
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
// The droplet is used as the host runner on Digital Ocean
// to run jobs in your GitHub Actions workflows.
# Render registration.sh using a `template_file`
data "template_file" "reg_script" {
template = "${file("./templates/register.sh.tpl")}"
vars {
GITHUB_ACCESS_TOKEN = "${var.github_access_token}"
GITHUB_USERNAME = "${var.github_username}"
GITHUB_REPO_NAME = "${var.github_repo_name}"
}
}
data "template_cloudinit_config" "script" {
gzip = false
base64_encode = false
part {
content_type = "text/x-shellscript"
content = "${data.template_file.reg_script.rendered}"
}
}
resource "digitalocean_droplet" "runner" {
name = "${var.github_repo_name}-self-hosted-runner-${format("%02d", count.index + 1)}"
count = "${var.runner_node_count}"
size = "${var.node_size}"
image = "${var.ubuntu}"
region = "${var.region}"
ssh_keys = ["${var.ssh_key_ids}"]
user_data = "${data.template_cloudinit_config.script.rendered}"
}