Skip to content

Commit

Permalink
feat: Add optional path var for instance level bucket path (#251)
Browse files Browse the repository at this point in the history
  • Loading branch information
levinandrew authored Aug 23, 2024
1 parent 2fb76be commit 9ccc357
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 0 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,7 @@ Upgrades must be executed in step-wise fashion from one version to the next. You
| <a name="input_aws_loadbalancer_controller_tags"></a> [aws\_loadbalancer\_controller\_tags](#input\_aws\_loadbalancer\_controller\_tags) | (Optional) A map of AWS tags to apply to all resources managed by the load balancer controller | `map(string)` | `{}` | no |
| <a name="input_bucket_kms_key_arn"></a> [bucket\_kms\_key\_arn](#input\_bucket\_kms\_key\_arn) | n/a | `string` | `""` | no |
| <a name="input_bucket_name"></a> [bucket\_name](#input\_bucket\_name) | n/a | `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_create_bucket"></a> [create\_bucket](#input\_create\_bucket) | ######################################### External Bucket # ######################################### Most users will not need these settings. They are ment for users who want a bucket and sqs that are in a different account. | `bool` | `true` | no |
| <a name="input_create_elasticache"></a> [create\_elasticache](#input\_create\_elasticache) | Boolean indicating whether to provision an elasticache instance (true) or not (false). | `bool` | `true` | no |
| <a name="input_create_vpc"></a> [create\_vpc](#input\_create\_vpc) | Boolean indicating whether to deploy a VPC (true) or not (false). | `bool` | `true` | no |
Expand Down Expand Up @@ -233,6 +234,7 @@ Upgrades must be executed in step-wise fashion from one version to the next. You
| Name | Description |
|------|-------------|
| <a name="output_bucket_name"></a> [bucket\_name](#output\_bucket\_name) | n/a |
| <a name="output_bucket_path"></a> [bucket\_path](#output\_bucket\_path) | n/a |
| <a name="output_bucket_queue_name"></a> [bucket\_queue\_name](#output\_bucket\_queue\_name) | n/a |
| <a name="output_bucket_region"></a> [bucket\_region](#output\_bucket\_region) | n/a |
| <a name="output_cluster_id"></a> [cluster\_id](#output\_cluster\_id) | n/a |
Expand Down
6 changes: 6 additions & 0 deletions examples/public-dns-external/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ module "wandb_infra" {
license = var.wandb_license

bucket_name = var.bucket_name
bucket_path = var.bucket_path
bucket_kms_key_arn = var.bucket_kms_key_arn
use_internal_queue = true
size = var.size
Expand Down Expand Up @@ -91,6 +92,7 @@ module "wandb_app" {

host = module.wandb_infra.url
bucket = "s3://${module.wandb_infra.bucket_name}"
bucket_path = var.bucket_path
bucket_aws_region = module.wandb_infra.bucket_region
bucket_queue = "internal://"
bucket_kms_key_arn = module.wandb_infra.kms_key_arn
Expand All @@ -115,6 +117,10 @@ output "bucket_name" {
value = module.wandb_infra.bucket_name
}

output "bucket_path" {
value = module.wandb_infra.bucket_path
}

output "bucket_queue_name" {
value = module.wandb_infra.bucket_queue_name
}
Expand Down
5 changes: 5 additions & 0 deletions examples/public-dns-external/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ variable "bucket_kms_key_arn" {
default = ""
}

variable "bucket_path" {
description = "path of where to store data for the instance-level bucket"
type = string
default = ""
}

variable "allowed_inbound_cidr" {
default = ["0.0.0.0/0"]
Expand Down
1 change: 1 addition & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@ module "wandb" {
bucket = {
provider = "s3"
name = local.bucket_name
path = var.bucket_path
region = data.aws_s3_bucket.file_storage.region
kmsKey = local.s3_kms_key_arn
}
Expand Down
4 changes: 4 additions & 0 deletions outputs.tf
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
output "bucket_name" {
value = local.bucket_name
}
output "bucket_path" {
value = var.bucket_path
}
output "bucket_queue_name" {
value = local.bucket_queue_name
}
output "bucket_region" {
value = data.aws_s3_bucket.file_storage.region
}

output "cluster_id" {
value = module.app_eks.cluster_id
}
Expand Down
12 changes: 12 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,18 @@ variable "bucket_kms_key_arn" {
}
}

##########################################
# 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 = ""
}

##########################################
# Redis #
##########################################
Expand Down

0 comments on commit 9ccc357

Please sign in to comment.