-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgke.tf
71 lines (59 loc) · 1.74 KB
/
gke.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
resource "google_container_cluster" "cluster_prod" {
name = "${var.env_name}-${var.cluster_name}-prod"
zone = "${var.zone}"
network = "${var.network}"
min_master_version = "${var.min_master_version}"
node_version = "${var.node_version}"
node_pool = {
name = "default-pool"
}
lifecycle {
ignore_changes = [
"node_pool",
"ip_allocation_policy",
]
}
}
resource "google_container_node_pool" "np_prod" {
name = "${var.env_name}-${var.cluster_name}-prod-np"
zone = "${var.zone}"
cluster = "${google_container_cluster.cluster_prod.name}"
node_count = "${var.prod_node_count}"
node_config {
machine_type = "${var.machine_type}"
}
}
resource "google_container_cluster" "cluster-stg" {
name = "${var.env_name}-${var.cluster_name}-stg"
zone = "${var.zone}"
initial_node_count = "${var.stg_node_count}"
network = "${var.network}"
min_master_version = "${var.min_master_version}"
node_version = "${var.node_version}"
node_pool = {
name = "default-pool"
}
lifecycle {
ignore_changes = [
"node_pool",
"ip_allocation_policy",
]
}
master_auth {
username = "admin"
password = "${random_string.password.result}"
}
}
resource "google_container_node_pool" "np_stg" {
name = "${var.env_name}-${var.cluster_name}-stg-np"
zone = "${var.zone}"
cluster = "${google_container_cluster.cluster-stg.name}"
node_count = "${var.stg_node_count}"
node_config {
machine_type = "${var.machine_type}"
}
}
resource "random_string" "password" {
length = 16
special = true
}