-
Notifications
You must be signed in to change notification settings - Fork 0
/
gke.tf
57 lines (45 loc) · 1.28 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
variable "kube_username" {
default = ""
description = "gke cluster username"
}
variable "kube_password" {
default = ""
description = "gke password"
}
variable "gke_num_nodes" {
default = 2
description = "number of gke nodes"
}
data "google_container_engine_versions" "gke_version" {
location = var.region
version_prefix = "1.27."
}
resource "google_container_cluster" "primary" {
name = "${var.project_id}-gke"
location = var.region
remove_default_node_pool = true
initial_node_count = 1
network = google_compute_network.vpc.name
subnetwork = google_compute_subnetwork.subnet.name
}
resource "google_container_node_pool" "primary_nodes" {
name = google_container_cluster.primary.name
location = var.region
cluster = google_container_cluster.primary.name
version = data.google_container_engine_versions.gke_version.release_channel_latest_version["STABLE"]
node_count = var.gke_num_nodes
node_config {
oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
labels = {
env = var.project_id
}
machine_type = "n1-standard-1"
tags = [ "gke-node", "${var.project_id}-gke" ]
metadata = {
disable-legacy-endpoints = "true"
}
}
}