forked from kawsark/terraform-gke
-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.tf
54 lines (43 loc) · 1.27 KB
/
main.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
provider "google" {
# OSS, so use this
#credentials = "${file("/some/path/to/your/auth.json")}"
#credentials = "${var.serviceAccount}"
# change this name to your project
project = var.project
region = var.region
zone = var.zone
}
resource "google_container_cluster" "k8s" {
name = var.cluster_name
location = var.zone
initial_node_count = var.node_count
# this is going to be your project
project = var.project
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",
]
labels = {
env = "sandbox"
}
machine_type = var.machine_type
tags = var.tags
}
master_auth {
username = var.masterAuthUser
password = var.masterAuthPass
}
}
# The following outputs allow authentication and connectivity to the GKE Cluster.
output "client_certificate" {
value = google_container_cluster.k8s.master_auth[0].client_certificate
}
output "client_key" {
value = google_container_cluster.k8s.master_auth[0].client_key
}
output "cluster_ca_certificate" {
value = google_container_cluster.k8s.master_auth[0].cluster_ca_certificate
}