-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.tf
More file actions
66 lines (55 loc) · 1.85 KB
/
main.tf
File metadata and controls
66 lines (55 loc) · 1.85 KB
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
resource "digitalocean_kubernetes_cluster" "main" {
name = var.doks_name
region = var.region
version = var.doks_version
vpc_uuid = var.vpc_id
tags = var.tags
node_pool {
name = "${var.doks_name}-default-pool"
size = var.default_pool.size
node_count = var.default_pool.node_count
labels = var.default_pool.labels != null ? var.default_pool.labels : {}
tags = concat(var.tags, var.default_pool.tags != null ? var.default_pool.tags : [])
dynamic "taint" {
for_each = var.default_pool.taints != null ? var.default_pool.taints : []
content {
key = taint.key
value = taint.value
effect = taint.effect
}
}
}
registry_integration = var.integrations.registry
routing_agent {
enabled = var.integrations.routing_agent
}
cluster_autoscaler_configuration {
scale_down_utilization_threshold = var.cluster_autoscaler_configuration.scale_down_utilization_threshold
scale_down_unneeded_time = var.cluster_autoscaler_configuration.scale_down_unneeded_time
}
}
resource "digitalocean_kubernetes_node_pool" "main" {
for_each = var.pools
cluster_id = digitalocean_kubernetes_cluster.main.id
name = "${var.doks_name}-${each.key}-pool"
size = each.value.size
auto_scale = true
node_count = each.value.min_nodes
min_nodes = each.value.min_nodes
max_nodes = each.value.max_nodes
labels = each.value.labels != null ? each.value.labels : {}
tags = concat(var.tags, each.value.tags != null ? each.value.tags : [])
dynamic "taint" {
for_each = each.value.taints != null ? each.value.taints : []
content {
key = taint.key
value = taint.value
effect = taint.effect
}
}
}
resource "digitalocean_project_resources" "main" {
count = var.project_id != null ? 1 : 0
project = var.project_id
resources = [digitalocean_kubernetes_cluster.main.urn]
}