diff --git a/README.md b/README.md index 474b6d6..a48ea0e 100644 --- a/README.md +++ b/README.md @@ -75,6 +75,7 @@ resources that lack official modules. | [app\_wandb\_env](#input\_app\_wandb\_env) | Extra environment variables for W&B | `map(string)` | `{}` | no | | [azuremonitor](#input\_azuremonitor) | # To support otel azure monitor sql and redis metrics need operator-wandb chart minimum version 0.14.0 | `bool` | `false` | no | | [blob\_container](#input\_blob\_container) | Use an existing bucket. | `string` | `""` | no | +| [bucket\_path](#input\_bucket\_path) | path of where to store data for the instance-level bucket | `string` | `""` | no | | [cluster\_sku\_tier](#input\_cluster\_sku\_tier) | The Azure AKS SKU Tier to use for this cluster (https://learn.microsoft.com/en-us/azure/aks/free-standard-pricing-tiers) | `string` | `"Free"` | no | | [create\_private\_link](#input\_create\_private\_link) | Use for the azure private link. | `bool` | `false` | no | | [create\_redis](#input\_create\_redis) | Boolean indicating whether to provision an redis instance (true) or not (false). | `bool` | `false` | no | diff --git a/examples/public-dns/main.tf b/examples/public-dns/main.tf index 93215af..1ff8157 100644 --- a/examples/public-dns/main.tf +++ b/examples/public-dns/main.tf @@ -41,6 +41,8 @@ module "wandb" { deletion_protection = false + bucket_path = var.bucket_path + tags = { "Example" : "PublicDns" } diff --git a/examples/public-dns/variables.tf b/examples/public-dns/variables.tf index ebdb00d..2cc981b 100644 --- a/examples/public-dns/variables.tf +++ b/examples/public-dns/variables.tf @@ -52,3 +52,9 @@ variable "database_sku_name" { default = "GP_Standard_D4ds_v4" description = "Specifies the SKU Name for this MySQL Server" } + +variable "bucket_path" { + description = "path of where to store data for the instance-level bucket" + type = string + default = "" +} \ No newline at end of file diff --git a/main.tf b/main.tf index c3005a0..94e5e1b 100644 --- a/main.tf +++ b/main.tf @@ -222,7 +222,7 @@ locals { default_bucket_config = { provider = "az" name = var.storage_account - path = var.blob_container + path = "${var.blob_container}/${var.bucket_path}" accessKey = var.storage_key } bucket_config = var.external_bucket != null ? var.external_bucket : (local.use_customer_bucket ? local.default_bucket_config : null) @@ -250,13 +250,13 @@ module "wandb" { bucket = local.bucket_config == null ? { provider = "az" name = module.storage[0].account.name - path = module.storage[0].container.name + path = "${module.storage[0].container.name}/${var.bucket_path}" accessKey = module.storage[0].account.primary_access_key } : local.bucket_config defaultBucket = { provider = "az" name = module.storage[0].account.name - path = module.storage[0].container.name + path = "${module.storage[0].container.name}/${var.bucket_path}" accessKey = module.storage[0].account.primary_access_key } azureIdentityForBucket = { diff --git a/variables.tf b/variables.tf index a8771c0..7c0e2c4 100644 --- a/variables.tf +++ b/variables.tf @@ -180,6 +180,17 @@ variable "external_bucket" { default = null } +########################################## +# Bucket path # +########################################## +# This setting is meant for users who want to store all of their instance-level +# bucket's data at a specific path within their bucket. It can be set both for +# external buckets or the bucket created by this module. +variable "bucket_path" { + description = "path of where to store data for the instance-level bucket" + type = string + default = "" +} ########################################## # K8s #