-
-
Notifications
You must be signed in to change notification settings - Fork 80
/
template.tf
131 lines (104 loc) · 3.29 KB
/
template.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
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
resource "oci_core_instance_configuration" "k3s_server_template" {
compartment_id = var.compartment_ocid
display_name = "k3s server configuration"
freeform_tags = {
"provisioner" = "terraform"
"environment" = "${var.environment}"
"${var.unique_tag_key}" = "${var.unique_tag_value}"
"k3s-template-type" = "k3s-server"
}
instance_details {
instance_type = "compute"
launch_details {
agent_config {
is_management_disabled = "false"
is_monitoring_disabled = "false"
plugins_config {
desired_state = "DISABLED"
name = "Vulnerability Scanning"
}
plugins_config {
desired_state = "ENABLED"
name = "Compute Instance Monitoring"
}
plugins_config {
desired_state = "DISABLED"
name = "Bastion"
}
}
availability_domain = var.availability_domain
compartment_id = var.compartment_ocid
create_vnic_details {
assign_public_ip = true
subnet_id = oci_core_subnet.default_oci_core_subnet10.id
nsg_ids = [oci_core_network_security_group.lb_to_instances_kubeapi.id]
}
display_name = "k3s server template"
metadata = {
"ssh_authorized_keys" = file(var.public_key_path)
"user_data" = data.cloudinit_config.k3s_server_tpl.rendered
}
shape = var.compute_shape
shape_config {
memory_in_gbs = "6"
ocpus = "1"
}
source_details {
image_id = var.os_image_id
source_type = "image"
}
}
}
}
resource "oci_core_instance_configuration" "k3s_worker_template" {
compartment_id = var.compartment_ocid
display_name = "k3s worker configuration"
freeform_tags = {
"provisioner" = "terraform"
"environment" = "${var.environment}"
"${var.unique_tag_key}" = "${var.unique_tag_value}"
"k3s-template-type" = "k3s-worker"
}
instance_details {
instance_type = "compute"
launch_details {
agent_config {
is_management_disabled = "false"
is_monitoring_disabled = "false"
plugins_config {
desired_state = "DISABLED"
name = "Vulnerability Scanning"
}
plugins_config {
desired_state = "ENABLED"
name = "Compute Instance Monitoring"
}
plugins_config {
desired_state = "DISABLED"
name = "Bastion"
}
}
availability_domain = var.availability_domain
compartment_id = var.compartment_ocid
create_vnic_details {
assign_public_ip = true
subnet_id = oci_core_subnet.default_oci_core_subnet10.id
nsg_ids = [oci_core_network_security_group.lb_to_instances_http.id]
}
display_name = "k3s worker template"
metadata = {
"ssh_authorized_keys" = file(var.public_key_path)
"user_data" = data.cloudinit_config.k3s_worker_tpl.rendered
}
shape = var.compute_shape
shape_config {
memory_in_gbs = "6"
ocpus = "1"
}
source_details {
image_id = var.os_image_id
source_type = "image"
}
}
}
}