forked from oracle-quickstart/oci-github-actions-runner
-
Notifications
You must be signed in to change notification settings - Fork 1
/
compute.tf
executable file
·53 lines (44 loc) · 1.67 KB
/
compute.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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
resource "oci_core_instance" "simple-vm" {
count = var.number_of_runners
availability_domain = local.availability_domain
compartment_id = var.compute_compartment_ocid
display_name = "${var.vm_display_name}-${count.index}"
shape = local.compute_shape
dynamic "shape_config" {
for_each = local.is_flex_shape
content {
ocpus = local.flex_shape_ocpus
memory_in_gbs = local.flex_shape_memory
}
}
create_vnic_details {
subnet_id = local.use_existing_network ? var.subnet_id : oci_core_subnet.simple_subnet[0].id
display_name = "${var.subnet_display_name}-${count.index}"
assign_public_ip = local.is_public_subnet
hostname_label = "${var.hostname_label}-${count.index}"
skip_source_dest_check = false
nsg_ids = [oci_core_network_security_group.simple_nsg.id]
}
source_details {
source_type = "image"
source_id = local.image_id
}
metadata = {
ssh_authorized_keys = var.ssh_public_key
user_data = base64encode(join("\n", tolist([
"#!/usr/bin/env bash",
"set -x",
(data.template_file.install_runner_ol.rendered)],
)))
}
freeform_tags = tomap({ "${var.tag_key_name}" = "${var.tag_value}" })
}
data "template_file" "install_runner_ol" {
template = file("${path.module}/scripts/install-github-runner-ubuntu.sh")
vars = {
github_runner_version = var.github_runner_version
github_runner_registration_token = var.github_runner_registration_token
github_url = var.github_url
github_runner_label_list = var.github_runner_label_list
}
}