Skip to content

Commit

Permalink
chore: terraform fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
danielpanzella committed Nov 15, 2024
1 parent 79dff9d commit 4486d82
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 29 deletions.
27 changes: 16 additions & 11 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -156,24 +156,24 @@ module "database" {

module "bigtable" {
source = "./modules/bigtable"
count = var.create_bigtable ? 1 : 0
count = var.create_bigtable ? 1 : 0

namespace = var.namespace
namespace = var.namespace
deletion_protection = var.deletion_protection
service_account = module.service_accounts.service_account
crypto_key = local.default_sql_key
service_account = module.service_accounts.service_account
crypto_key = local.default_sql_key

labels = var.labels
}

module "pubsub" {
source = "./modules/pubsub"
count = var.create_pubsub ? 1 : 0
count = var.create_pubsub ? 1 : 0

namespace = var.namespace
namespace = var.namespace
deletion_protection = var.deletion_protection
service_account = module.service_accounts.service_account
crypto_key = local.default_sql_key
service_account = module.service_accounts.service_account
crypto_key = local.default_sql_key

labels = var.labels
}
Expand Down Expand Up @@ -272,8 +272,8 @@ locals {
internal_lb_name = "${var.namespace}-internal"
filestream_envs = (var.create_bigtable && var.create_pubsub) ? {
"GORILLA_PARQUET_LIVE_HISTORY_STORE" = "bigtable://${module.bigtable[0].bigtable_project_id}/${module.bigtable[0].bigtable_instance_id}"
"GORILLA_HISTORY_STORE" = "http://wandb-parquet:8087/_goRPC_,bigtable://${module.bigtable[0].bigtable_project_id}/${module.bigtable[0].bigtable_instance_id}"
"GORILLA_FILE_STREAM_STORE_ADDRESS" = "pubsub:/${module.pubsub[0].filestream_project_id}/${module.pubsub[0].filestream_topic_name}"
"GORILLA_HISTORY_STORE" = "http://wandb-parquet:8087/_goRPC_,bigtable://${module.bigtable[0].bigtable_project_id}/${module.bigtable[0].bigtable_instance_id}"
"GORILLA_FILE_STREAM_STORE_ADDRESS" = "pubsub:/${module.pubsub[0].filestream_project_id}/${module.pubsub[0].filestream_topic_name}"
} : {}
}

Expand All @@ -288,6 +288,11 @@ module "wandb" {
version = "1.2.0"

spec = {
chart = {
url = "https://charts.wandb.ai"
name = "operator-wandb"
version = "0.19.0-PR262-2eba68f"
}
values = {
global = {
pod = { labels = { workload_hash : local.workload_hash } }
Expand Down Expand Up @@ -436,7 +441,7 @@ module "wandb" {
serviceAccount = var.create_workload_identity ? {
name = local.k8s_sa_map.filestream
annotations = { "iam.gke.io/gcp-service-account" = module.service_accounts.sa_account_role }
} : {
} : {
name = null
annotations = {}
}
Expand Down
8 changes: 4 additions & 4 deletions modules/bigtable/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ locals {
}

resource "google_bigtable_instance" "default" {
name = "${var.namespace}"
name = var.namespace
deletion_protection = var.deletion_protection
force_destroy = !var.deletion_protection
force_destroy = !var.deletion_protection

cluster {
cluster_id = "${var.namespace}-c1"
storage_type = var.storage_type
kms_key_name = var.crypto_key
autoscaling_config {
min_nodes = 1
max_nodes = 3
min_nodes = 1
max_nodes = 3
cpu_target = 70
}
}
Expand Down
12 changes: 6 additions & 6 deletions modules/bigtable/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ variable "storage_type" {
}

variable "min_nodes" {
type = number
description = "The minimum number of nodes for the Bigtable cluster."
default = 1
type = number
description = "The minimum number of nodes for the Bigtable cluster."
default = 1
}

variable "max_nodes" {
type = number
description = "The maximum number of nodes for the Bigtable cluster."
default = 3
type = number
description = "The maximum number of nodes for the Bigtable cluster."
default = 3
}
16 changes: 8 additions & 8 deletions modules/pubsub/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ resource "google_pubsub_topic" "filestream" {
}

resource "google_pubsub_topic_iam_member" "filestream" {
topic = google_pubsub_topic.filestream.name
role = "roles/pubsub.admin"
topic = google_pubsub_topic.filestream.name
role = "roles/pubsub.admin"
member = local.sa_member
}

Expand All @@ -35,8 +35,8 @@ resource "google_pubsub_subscription" "filestream-gorilla" {

resource "google_pubsub_subscription_iam_member" "filestream-gorilla" {
subscription = google_pubsub_subscription.filestream-gorilla.name
role = "roles/pubsub.admin"
member = local.sa_member
role = "roles/pubsub.admin"
member = local.sa_member
}

resource "google_pubsub_topic" "run_updates_v2" {
Expand All @@ -47,8 +47,8 @@ resource "google_pubsub_topic" "run_updates_v2" {
}

resource "google_pubsub_topic_iam_member" "run_updates_v2" {
topic = google_pubsub_topic.run_updates_v2.name
role = "roles/pubsub.admin"
topic = google_pubsub_topic.run_updates_v2.name
role = "roles/pubsub.admin"
member = local.sa_member
}

Expand All @@ -64,6 +64,6 @@ resource "google_pubsub_subscription" "flat_run_fields_updater_v2" {

resource "google_pubsub_subscription_iam_member" "flat_run_fields_updater_v2" {
subscription = google_pubsub_subscription.flat_run_fields_updater_v2.name
role = "roles/pubsub.admin"
member = local.sa_member
role = "roles/pubsub.admin"
member = local.sa_member
}

0 comments on commit 4486d82

Please sign in to comment.