Skip to content

Commit

Permalink
feat: Add storage account creds
Browse files Browse the repository at this point in the history
  • Loading branch information
venky-wandb committed Oct 21, 2022
1 parent d972bd9 commit 2d543be
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
9 changes: 5 additions & 4 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module "database" {
}

module "storage" {
count = local.create_blob_container ? 1 : 0
source = "./modules/storage"
namespace = var.namespace
resource_group_name = azurerm_resource_group.default.name
Expand Down Expand Up @@ -76,8 +77,8 @@ module "app_aks" {
}

locals {
blob_container = local.create_blob_container ? "${module.storage.account.name}/${module.storage.container.name}" : var.blob_container
queue = var.use_internal_queue ? "internal://" : "az://${module.storage.account.name}/${module.storage.queue.name}"
blob_container = local.create_blob_container ? "${module.storage.0.account.name}/${module.storage.0.container.name}" : var.blob_container
queue = var.use_internal_queue ? "internal://" : "az://${module.storage.0.account.name}/${module.storage.0.queue.name}"
}

module "aks_app" {
Expand All @@ -101,8 +102,8 @@ module "aks_app" {
wandb_version = var.wandb_version

other_wandb_env = {
"AZURE_STORAGE_KEY" = module.storage.account.primary_access_key,
"AZURE_STORAGE_ACCOUNT" = module.storage.account.name,
"AZURE_STORAGE_KEY" = local.create_blob_container ? module.storage.0.account.primary_access_key:var.storage_key
"AZURE_STORAGE_ACCOUNT" = local.create_blob_container ? module.storage.0.account.name:var.storage_account
}

# If we dont wait, tf will start trying to deploy while the work group is
Expand Down
8 changes: 6 additions & 2 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,13 @@ output "cluster_ca_certificate" {
}

output "storage_account" {
value = module.storage.account
value = local.create_blob_container ? module.storage.0.account:null
}

output "storage_container" {
value = module.storage.container
value = local.create_blob_container ? module.storage.0.container:null
}

output "blob_container" {
value = local.blob_container
}
14 changes: 13 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,23 @@ variable "create_redis" {
##########################################
# External Bucket #
##########################################
# Most users will not need these settings. They are ment for users who want a
# Most users will not need these settings. They are meant for users who want a
# bucket in a different account.

variable "blob_container" {
type = string
description = "Use an existing bucket."
default = ""
}

variable "storage_account" {
type = string
description = "Azure storage account name"
default = ""
}

variable "storage_key" {
type = string
description = "Azure primary storage access key"
default = ""
}

0 comments on commit 2d543be

Please sign in to comment.