-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf.old
78 lines (63 loc) · 1.47 KB
/
main.tf.old
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
terraform {
required_providers {
civo = {
source = "civo/civo"
}
}
}
provider "civo" {
token = var.civo_apitoken
}
data "civo_firewall" "get_firewall_k8s" {
name = "sp7x-firewall"
region = var.region
}
# Create a cluster with k3s
resource "civo_kubernetes_cluster" "k8sCluster" {
name = var.cluster_name
kubernetes_version = var.k8s_version
applications = "Traefik-v2"
firewall_id = data.civo_firewall.get_firewall_k8s.id
cluster_type = "k3s"
region = var.region
cni = var.cni
pools {
label = "k3s-play"
size = var.node_size
node_count = var.num_of_nodes
# public_ip_node_pool =
}
}
# Query small instance size
data "civo_instances_size" "medium" {
filter {
key = "name"
values = ["g3.medium"]
match_by = "re"
}
filter {
key = "type"
values = ["instance"]
}
}
# Query instance disk image
data "civo_disk_image" "debian" {
filter {
key = "name"
values = ["debian-10"]
}
}
# Create a new instance
resource "civo_instance" "foo" {
hostname = "spx7.build"
tags = ["build", "k8s"]
notes = "This is a K8s Build Server"
size = element(data.civo_instances_size.medium.sizes, 0).name
disk_image = element(data.civo_disk_image.debian.diskimages, 0).id
}
# module "compute_instance" {
# source = "./modules/civo-compute"
# }
# module "k8s_cluster" {
# source = "./modules/civo-k8s"
# }