/
main.tf
46 lines (39 loc) · 1.2 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
terraform {
required_version = ">= 0.11.11"
}
provider "vault" {
address = "${var.vault_addr}"
}
data "vault_generic_secret" "gcp_credentials" {
path = "secret/${var.vault_user}/gcp/credentials"
}
provider "google" {
credentials = "${data.vault_generic_secret.gcp_credentials.data[var.gcp_project]}"
project = "${var.gcp_project}"
region = "${var.gcp_region}"
}
resource "google_container_cluster" "k8sexample" {
name = "${var.vault_user}-k8s-cluster"
description = "example k8s cluster"
zone = "${var.gcp_zone}"
initial_node_count = "${var.initial_node_count}"
enable_kubernetes_alpha = "true"
enable_legacy_abac = "true"
master_auth {
username = "${var.master_username}"
password = "${var.master_password}"
client_certificate_config {
issue_client_certificate = true
}
}
node_config {
machine_type = "${var.node_machine_type}"
disk_size_gb = "${var.node_disk_size}"
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"
]
}
}