-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
gleb
committed
Sep 25, 2024
1 parent
0ca230e
commit 6f9b95f
Showing
2 changed files
with
57 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
locals { | ||
service_account_id = "castai-gke-tf-${substr(sha1(var.cluster_name), 0, 8)}" | ||
} | ||
|
||
resource "google_service_account" "client_service_account" { | ||
account_id = local.service_account_id | ||
display_name = "Service account to manage ${var.cluster_name} cluster via CAST" | ||
project = var.project_id | ||
} | ||
|
||
resource "castai_gke_cluster" "this" { | ||
project_id = var.project_id | ||
location = var.cluster_region | ||
name = var.cluster_name | ||
delete_nodes_on_disconnect = var.delete_nodes_on_disconnect | ||
|
||
# provide client service account to cluster | ||
client_service_account = google_service_account.client_service_account.email | ||
cast_service_account = "" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
variable "project_id" { | ||
type = string | ||
description = "GCP project ID in which GKE cluster is located." | ||
} | ||
|
||
variable "cluster_name" { | ||
type = string | ||
description = "GKE cluster name in GCP project." | ||
} | ||
|
||
variable "cluster_region" { | ||
type = string | ||
description = "Region of the cluster to be connected to CAST AI." | ||
} | ||
|
||
variable "subnets" { | ||
type = list(string) | ||
description = "Subnet IDs used by CAST AI to provision nodes." | ||
} | ||
|
||
variable "delete_nodes_on_disconnect" { | ||
type = bool | ||
description = "Optionally delete Cast AI created nodes when the cluster is destroyed." | ||
default = false | ||
} | ||
|
||
variable "castai_api_token" { | ||
type = string | ||
description = "CAST AI API token created in console.cast.ai API Access keys section." | ||
} | ||
|
||
variable "castai_api_url" { | ||
type = string | ||
description = "CAST AI api url." | ||
default = "https://api.cast.ai" | ||
} | ||
|