Skip to content

Commit

Permalink
add example skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
gleb committed Sep 25, 2024
1 parent 0ca230e commit 6f9b95f
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
20 changes: 20 additions & 0 deletions examples/gke/gke_impersonate/main.tf
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 = ""
}
37 changes: 37 additions & 0 deletions examples/gke/gke_impersonate/variables.tf
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"
}

0 comments on commit 6f9b95f

Please sign in to comment.