-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
35 lines (31 loc) · 873 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
34
35
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 "google_compute_instance" "vm_instance" {
name = "my-self-hosted-runner"
machine_type = "e2-micro"
allow_stopping_for_update = true
boot_disk {
initialize_params {
image = "debian-cloud/debian-9"
}
}
network_interface {
network = "default"
access_config {}
}
metadata_startup_script = "${data.template_cloudinit_config.script.rendered}"
}