-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathkube.tf
52 lines (46 loc) · 1.03 KB
/
kube.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
# Creates a GKE cluster with KUBECONFIG
variable "master_user" {}
variable "master_pass" {}
locals {
kubeconfig = <<KUBECONFIG
apiVersion: v1
clusters:
- cluster:
insecure-skip-tls-verify: true
server: https://${google_container_cluster.kube.endpoint}
name: kube
contexts:
- context:
cluster: kube
user: admin
name: kube
current-context: kube
kind: Config
preferences: {}
users:
- name: admin
user:
username: ${var.master_user}
password: ${var.master_pass}
KUBECONFIG
}
resource "google_container_cluster" "kube" {
name = "kube"
zone = "us-central1-a"
initial_node_count = 2
additional_zones = [
"us-central1-b",
]
master_auth {
username = "${var.master_user}"
password = "${var.master_pass}"
}
node_config {
oauth_scopes = [
"https://www.googleapis.com/auth/compute",
"https://www.googleapis.com/auth/devstorage.read_only",
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
}
}