Skip to content

Commit

Permalink
feat: Add optional path var for instance level bucket path (#84)
Browse files Browse the repository at this point in the history
  • Loading branch information
levinandrew authored Aug 26, 2024
1 parent 2f166a3 commit 2f430f2
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ resources that lack official modules.
| <a name="input_app_wandb_env"></a> [app\_wandb\_env](#input\_app\_wandb\_env) | Extra environment variables for W&B | `map(string)` | `{}` | no |
| <a name="input_azuremonitor"></a> [azuremonitor](#input\_azuremonitor) | # To support otel azure monitor sql and redis metrics need operator-wandb chart minimum version 0.14.0 | `bool` | `false` | no |
| <a name="input_blob_container"></a> [blob\_container](#input\_blob\_container) | Use an existing bucket. | `string` | `""` | no |
| <a name="input_bucket_path"></a> [bucket\_path](#input\_bucket\_path) | path of where to store data for the instance-level bucket | `string` | `""` | no |
| <a name="input_cluster_sku_tier"></a> [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 |
| <a name="input_create_private_link"></a> [create\_private\_link](#input\_create\_private\_link) | Use for the azure private link. | `bool` | `false` | no |
| <a name="input_create_redis"></a> [create\_redis](#input\_create\_redis) | Boolean indicating whether to provision an redis instance (true) or not (false). | `bool` | `false` | no |
Expand Down
2 changes: 2 additions & 0 deletions examples/public-dns/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ module "wandb" {

deletion_protection = false

bucket_path = var.bucket_path

tags = {
"Example" : "PublicDns"
}
Expand Down
6 changes: 6 additions & 0 deletions examples/public-dns/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
}
6 changes: 3 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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 = {
Expand Down
11 changes: 11 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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 #
Expand Down

0 comments on commit 2f430f2

Please sign in to comment.