-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathk8s-cluster.tf
44 lines (36 loc) · 926 Bytes
/
k8s-cluster.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
# main.tf
terraform {
required_providers {
google = {
source = "hashicorp/google"
version = "~> 3.5" # Adjust as needed
}
}
required_version = ">= 0.12"
}
provider "google" {
credentials = file("json-key") # Path to your new service account key
project = "black-outlet-438804-p8"
region = "us-central1"
}
resource "google_container_cluster" "primary" {
name = "my-cluster"
location = "us-central1"
initial_node_count = 1
node_config {
machine_type = "e2-medium" # Adjust based on your needs
oauth_scopes = [
"https://www.googleapis.com/auth/cloud-platform",
]
}
}
# Output the cluster endpoint and credentials
output "kubeconfig" {
value = google_container_cluster.primary.endpoint
}
output "cluster_name" {
value = google_container_cluster.primary.name
}
output "cluster_location" {
value = google_container_cluster.primary.location
}