-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgke.tf
More file actions
46 lines (39 loc) · 999 Bytes
/
Copy pathgke.tf
File metadata and controls
46 lines (39 loc) · 999 Bytes
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
# Specify the GCP Provider
provider "google-beta" {
project = var.project_id
region = var.region
version = "~> 3.10"
alias = "gb3"
}
# Create a GKE cluster
resource "google_container_cluster" "my_k8s_cluster" {
provider = google-beta.gb3
name = "my-k8s-cluster"
location = var.region
initial_node_count = 1
master_auth {
username = ""
password = ""
}
# Enable Workload Identity
workload_identity_config {
identity_namespace = "${var.project_id}.svc.id.goog"
}
node_config {
machine_type = var.machine_type
oauth_scopes = [
"https://www.googleapis.com/auth/logging.write",
"https://www.googleapis.com/auth/monitoring",
]
metadata = {
"disable-legacy-endpoints" = "true"
}
workload_metadata_config {
node_metadata = "GKE_METADATA_SERVER"
}
labels = { # Update: Replace with desired labels
"environment" = "test"
"team" = "devops"
}
}
}