Skip to content

Commit

Permalink
updated boyb codebase
Browse files Browse the repository at this point in the history
  • Loading branch information
velotioaastha committed Jul 29, 2024
1 parent 233ee54 commit 9e55613
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 28 deletions.
16 changes: 9 additions & 7 deletions examples/byob/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ provider "azurerm" {
}

module "byob" {
source = "../../modules/byob"
resource_group_name = { name = "${var.rg_name}", id = "byob" }
location = var.location
prefix = var.prefix
deletion_protection = var.deletion_protection
create_cmk = var.create_cmk
rg_name = var.rg_name
source = "../../modules/byob"
resource_group_name = { name = "${var.rg_name}", id = "byob" }
location = var.location
prefix = var.prefix
deletion_protection = var.deletion_protection
create_cmk = var.enable_encryption
rg_name = var.rg_name
purge_protection_enabled = true
tags = var.tags
}

output "blob_container" {
Expand Down
5 changes: 4 additions & 1 deletion examples/byob/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
rg_name = "rg-name"
location = "westeurope"
prefix = "byob-wandb"
create_cmk = false
tags = {
"name" = "wandb"
}
enable_encryption = true
7 changes: 6 additions & 1 deletion examples/byob/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ variable "deletion_protection" {
type = bool
default = false
}
variable "create_cmk" {
variable "enable_encryption" {
type = bool
}

variable "tags" {
type = map(string)
description = "Map of tags for resource"
}
3 changes: 0 additions & 3 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,6 @@ locals {
wb_managed_key_id_storage = contains(keys(local.filtered_vault_key_map), "storage") ? azurerm_key_vault_key.encryption_keys["storage"].id : null
}




module "storage" {
count = (var.blob_container == "" && var.external_bucket == null) ? 1 : 0
source = "./modules/storage"
Expand Down
30 changes: 15 additions & 15 deletions modules/byob/main.tf
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
module "storage" {
source = "../storage"
create_queue = false
namespace = var.prefix
resource_group_name = var.resource_group_name.name
location = var.location
deletion_protection = var.deletion_protection
wb_managed_key_id = var.create_cmk == true ? azurerm_key_vault_key.Vault_key[0].versionless_id : null
identity_ids = var.create_cmk == true ? module.identity[0].identity.id : null
dynamic_create_cmk = var.create_cmk

}

module "identity" {
count = var.create_cmk ? 1 : 0
source = "../identity"
Expand All @@ -27,8 +14,10 @@ module "vault" {
resource_group = { name = "${var.rg_name}", id = "byob" }
location = var.location

identity_object_id = module.identity[0].identity.principal_id
depends_on = [module.identity]
identity_object_id = module.identity[0].identity.principal_id
depends_on = [module.identity]
tags = var.tags
purge_protection_enabled = var.purge_protection_enabled
}

resource "azurerm_key_vault_key" "Vault_key" {
Expand All @@ -51,3 +40,14 @@ resource "azurerm_key_vault_key" "Vault_key" {
module.vault
]
}
module "storage" {
source = "../storage"
create_queue = false
namespace = var.prefix
resource_group_name = var.resource_group_name.name
location = var.location
deletion_protection = var.deletion_protection
wb_managed_key_id = var.create_cmk == true ? azurerm_key_vault_key.Vault_key[0].versionless_id : null
identity_ids = var.create_cmk == true ? module.identity[0].identity.id : null
}

11 changes: 10 additions & 1 deletion modules/byob/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ variable "rg_name" {
type = string
}


variable "create_cmk" {
type = bool
}

variable "tags" {
type = map(string)
description = "Map of tags for resource"
}

variable "purge_protection_enabled" {
type = bool
description = "Enable or disable purge protection for the Key Vault."
}

0 comments on commit 9e55613

Please sign in to comment.