Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Persona Model #124

Merged
merged 34 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4346779
Update workspace configuration
marvinbuss Jan 6, 2025
026d6e9
Update provider versions
marvinbuss Jan 6, 2025
baeff68
lint
marvinbuss Jan 6, 2025
8b460c9
Add missing dependency in output
marvinbuss Jan 6, 2025
a496e05
Update terraform version
marvinbuss Jan 6, 2025
db578a3
Add variables for group names
marvinbuss Jan 7, 2025
3eed00b
Add data references
marvinbuss Jan 7, 2025
e10f833
Update app configuration
marvinbuss Jan 7, 2025
e811fb9
Add databricks service principle referenced from entra id
marvinbuss Jan 7, 2025
59e7ea6
Add role assignment per persona
marvinbuss Jan 7, 2025
4bdb2be
Add references in root module
marvinbuss Jan 7, 2025
94dc00b
lint
marvinbuss Jan 7, 2025
a36fe84
Add conditions for optional groups
marvinbuss Jan 7, 2025
0ff13d8
Update references
marvinbuss Jan 7, 2025
a9e0023
Add missing padding for month value
marvinbuss Jan 8, 2025
584fb78
Update froce destroy and update for credential
marvinbuss Jan 8, 2025
6872c37
Force recretion of databricks catalog items
marvinbuss Jan 8, 2025
0e9b769
Update permissions for databricks resources
marvinbuss Jan 8, 2025
7a4d9c5
Try ADB permissions without SP permissions
marvinbuss Jan 8, 2025
8dca077
Add missing dependencies and enable SP assignment
marvinbuss Jan 8, 2025
6af627e
Fix sp reference
marvinbuss Jan 8, 2025
d810a14
Enable SP role assignment
marvinbuss Jan 8, 2025
ce77152
Add secret ACLS for personas
marvinbuss Jan 8, 2025
1257546
Update ACL reference
marvinbuss Jan 8, 2025
73f4a0d
Add tags for app catalogs
marvinbuss Jan 9, 2025
f7da593
Add permissions to catalogs in metastore
marvinbuss Jan 9, 2025
605f42e
Add busget permissions as draft
marvinbuss Jan 9, 2025
ab8aa55
Add permissions for databricks external locations
marvinbuss Jan 9, 2025
b799239
Add permissions for storage credential
marvinbuss Jan 9, 2025
0fe64d1
Add admin role assignments to Azure
marvinbuss Jan 9, 2025
01a0fa6
Add role assignments to azure for personas
marvinbuss Jan 10, 2025
1ab1b1b
Update references
marvinbuss Jan 10, 2025
0625bba
Add workspace config parameter
marvinbuss Jan 14, 2025
847ce98
Fix role assignments
marvinbuss Jan 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/terraform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
name: "Terraform"
with:
environment: "dev"
terraform_version: "1.10.2"
terraform_version: "1.10.3"
node_version: 20
working_directory: "./tests/e2e"
tenant_id: "37963dd4-f4e6-40f8-a7d6-24b97919e452"
Expand All @@ -43,7 +43,7 @@ jobs:
if: github.event_name == 'push' || github.event_name == 'release'
with:
environment: "dev"
terraform_version: "1.10.2"
terraform_version: "1.10.3"
node_version: 20
working_directory: "./tests/e2e"
tenant_id: "37963dd4-f4e6-40f8-a7d6-24b97919e452"
Expand Down
6 changes: 6 additions & 0 deletions databricksconfiguration.tf
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@ module "databricksworkspaceapplication" {
databricks_keyvault_secret_scope_details = try(module.data_application[each.key].key_vault_details, {})
storage_container_ids = try(module.data_application[each.key].storage_container_ids, {})

# Identity variables
admin_group_name = try(each.value.identity.admin_group_name, "")
developer_group_name = try(each.value.identity.developer_group_name, "")
reader_group_name = try(each.value.identity.reader_group_name, "")
service_principal_name = try(each.value.identity.service_principal_name, "")

# Budget variables
budget = try(each.value.budget, 100)
}
11 changes: 9 additions & 2 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,9 @@ module "data_application" {
tags = merge(var.tags, try(each.value.tags, {}))

# Service variables
app_name = each.key
storage_account_ids = module.core.storage_account_ids
app_name = each.key
storage_account_ids = module.core.storage_account_ids
databricks_workspace_details = module.core.databricks_workspace_details

# HA/DR variables
zone_redundancy_enabled = var.zone_redundancy_enabled
Expand All @@ -101,6 +102,12 @@ module "data_application" {
diagnostics_configurations = local.diagnostics_configurations
alerting = try(each.value.alerting, {})

# Identity variables
admin_group_name = try(each.value.identity.admin_group_name, "")
developer_group_name = try(each.value.identity.developer_group_name, "")
reader_group_name = try(each.value.identity.reader_group_name, "")
service_principal_name = try(each.value.identity.service_principal_name, "")

# Network variables
vnet_id = var.vnet_id
subnet_id_app = module.platform.subnet_ids_private_endpoint_application[each.key]
Expand Down
4 changes: 4 additions & 0 deletions modules/core/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ output "databricks_workspace_details" {
description = "Specifies the workspace details of the Azure Databricks core workspace."
value = local.databricks_workspace_details
sensitive = false
depends_on = [
module.databricks_workspace_engineering.databricks_workspace_completed,
module.databricks_workspace_consumption.databricks_workspace_completed,
]
}

output "databricks_private_endpoint_rules" {
Expand Down
2 changes: 1 addition & 1 deletion modules/dataapplication/budget.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ resource "azurerm_consumption_budget_subscription" "consumption_budget_subscript
amount = var.budget.categories.azure
time_grain = "Monthly"
time_period {
start_date = "${time_rotating.rotating_current.year - local.budget_start_date_rotation_years}-${time_rotating.rotating_current.month}-01T00:00:00Z"
start_date = "${time_rotating.rotating_current.year - local.budget_start_date_rotation_years}-${format("%02s", time_rotating.rotating_current.month)}-01T00:00:00Z"
}
filter {
dynamic "tag" {
Expand Down
23 changes: 23 additions & 0 deletions modules/dataapplication/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,26 @@ data "azurerm_location" "current" {
data "azuread_service_principal" "service_principal_databricks" {
client_id = local.databricks_enterprise_application_id
}

data "azuread_service_principal" "service_principal" {
display_name = var.service_principal_name
}

data "azuread_group" "group_admin" {
display_name = var.admin_group_name
security_enabled = true
}

data "azuread_group" "group_developer" {
count = var.developer_group_name == "" ? 0 : 1

display_name = var.developer_group_name
security_enabled = true
}

data "azuread_group" "group_reader" {
count = var.reader_group_name == "" ? 0 : 1

display_name = var.reader_group_name
security_enabled = true
}
83 changes: 83 additions & 0 deletions modules/dataapplication/roleassignments_admin.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# Resource group role assignments
resource "azurerm_role_assignment" "role_assignment_resource_group_app_reader_admin" {
description = "Role assignment to app resource group."
scope = azurerm_resource_group.resource_group_app.id
role_definition_name = "Reader"
principal_id = data.azuread_group.group_admin.object_id
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_resource_group_app_monitoring_reader_admin" {
description = "Role assignment to app resource group."
scope = azurerm_resource_group.resource_group_app_monitoring.id
role_definition_name = "Reader"
principal_id = data.azuread_group.group_admin.object_id
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_resource_group_storage_reader_admin" {
description = "Role assignment to storage resource group."
scope = "${data.azurerm_subscription.current.id}/resourceGroups/${split("/", var.storage_account_ids.external)[4]}"
role_definition_name = "Reader"
principal_id = data.azuread_group.group_admin.object_id
principal_type = "Group"
}

# Key vault role assignments
resource "azurerm_role_assignment" "role_assignment_key_vault_secrets_officer_admin" {
description = "Role assignment to key vault to create secrets."
scope = module.key_vault.key_vault_id
role_definition_name = "Key Vault Secrets Officer"
principal_id = data.azuread_group.group_admin.object_id
principal_type = "Group"
}

# Databricks role assignments
resource "azurerm_role_assignment" "role_assignment_databricks_workspace_reader_admin" {
description = "Role assignment to databricks workspace."
scope = var.databricks_workspace_details["engineering"].id
role_definition_name = "Reader"
principal_id = data.azuread_group.group_admin.object_id
principal_type = "Group"
}

# Storage role assignments
resource "azurerm_role_assignment" "role_assignment_storage_container_external_blob_data_owner_admin" {
description = "Role assignment to the external storage container."
scope = azurerm_storage_container.storage_container_external.id
role_definition_name = "Storage Blob Data Owner"
principal_id = data.azuread_group.group_admin.object_id
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_storage_container_raw_blob_data_owner_admin" {
description = "Role assignment to the raw storage container."
scope = azurerm_storage_container.storage_container_raw.id
role_definition_name = "Storage Blob Data Owner"
principal_id = data.azuread_group.group_admin.object_id
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_storage_container_enriched_blob_data_owner_admin" {
description = "Role assignment to the enriched storage container."
scope = azurerm_storage_container.storage_container_enriched.id
role_definition_name = "Storage Blob Data Owner"
principal_id = data.azuread_group.group_admin.object_id
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_storage_container_curated_blob_data_owner_admin" {
description = "Role assignment to the curated storage container."
scope = azurerm_storage_container.storage_container_curated.id
role_definition_name = "Storage Blob Data Owner"
principal_id = data.azuread_group.group_admin.object_id
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_storage_container_workspace_blob_data_owner_admin" {
description = "Role assignment to the workspace storage container."
scope = azurerm_storage_container.storage_container_workspace.id
role_definition_name = "Storage Blob Data Owner"
principal_id = data.azuread_group.group_admin.object_id
principal_type = "Group"
}
103 changes: 103 additions & 0 deletions modules/dataapplication/roleassignments_developer.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# Resource group role assignments
resource "azurerm_role_assignment" "role_assignment_resource_group_app_reader_developer" {
count = var.developer_group_name == "" ? 0 : 1

description = "Role assignment to app resource group."
scope = azurerm_resource_group.resource_group_app.id
role_definition_name = "Reader"
principal_id = one(data.azuread_group.group_developer[*].object_id)
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_resource_group_app_monitoring_reader_developer" {
count = var.developer_group_name == "" ? 0 : 1

description = "Role assignment to app resource group."
scope = azurerm_resource_group.resource_group_app_monitoring.id
role_definition_name = "Reader"
principal_id = one(data.azuread_group.group_developer[*].object_id)
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_resource_group_storage_reader_developer" {
count = var.developer_group_name == "" ? 0 : 1

description = "Role assignment to storage resource group."
scope = "${data.azurerm_subscription.current.id}/resourceGroups/${split("/", var.storage_account_ids.external)[4]}"
role_definition_name = "Reader"
principal_id = one(data.azuread_group.group_developer[*].object_id)
principal_type = "Group"
}

# Key vault role assignments
resource "azurerm_role_assignment" "role_assignment_key_vault_secrets_user_developer" {
count = var.developer_group_name == "" ? 0 : 1

description = "Role assignment to key vault to read secrets."
scope = module.key_vault.key_vault_id
role_definition_name = "Key Vault Secrets User"
principal_id = one(data.azuread_group.group_developer[*].object_id)
principal_type = "Group"
}

# Databricks role assignments
resource "azurerm_role_assignment" "role_assignment_databricks_workspace_reader_developer" {
count = var.developer_group_name == "" ? 0 : 1

description = "Role assignment to databricks workspace."
scope = var.databricks_workspace_details["engineering"].id
role_definition_name = "Reader"
principal_id = one(data.azuread_group.group_developer[*].object_id)
principal_type = "Group"
}

# Storage role assignments
resource "azurerm_role_assignment" "role_assignment_storage_container_external_blob_data_conributor_developer" {
count = var.developer_group_name == "" ? 0 : 1

description = "Role assignment to the external storage container."
scope = azurerm_storage_container.storage_container_external.id
role_definition_name = "Storage Blob Data Contributor"
principal_id = one(data.azuread_group.group_developer[*].object_id)
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_storage_container_raw_blob_data_conributor_developer" {
count = var.developer_group_name == "" ? 0 : 1

description = "Role assignment to the raw storage container."
scope = azurerm_storage_container.storage_container_raw.id
role_definition_name = "Storage Blob Data Contributor"
principal_id = one(data.azuread_group.group_developer[*].object_id)
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_storage_container_enriched_blob_data_conributor_developer" {
count = var.developer_group_name == "" ? 0 : 1

description = "Role assignment to the enriched storage container."
scope = azurerm_storage_container.storage_container_enriched.id
role_definition_name = "Storage Blob Data Contributor"
principal_id = one(data.azuread_group.group_developer[*].object_id)
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_storage_container_curated_blob_data_conributor_developer" {
count = var.developer_group_name == "" ? 0 : 1

description = "Role assignment to the curated storage container."
scope = azurerm_storage_container.storage_container_curated.id
role_definition_name = "Storage Blob Data Contributor"
principal_id = one(data.azuread_group.group_developer[*].object_id)
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_storage_container_workspace_blob_data_conributor_developer" {
count = var.developer_group_name == "" ? 0 : 1

description = "Role assignment to the workspace storage container."
scope = azurerm_storage_container.storage_container_workspace.id
role_definition_name = "Storage Blob Data Contributor"
principal_id = one(data.azuread_group.group_developer[*].object_id)
principal_type = "Group"
}
94 changes: 94 additions & 0 deletions modules/dataapplication/roleassignments_reader.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Resource group role assignments
resource "azurerm_role_assignment" "role_assignment_resource_group_app_reader_reader" {
count = var.reader_group_name == "" ? 0 : 1

description = "Role assignment to app resource group."
scope = azurerm_resource_group.resource_group_app.id
role_definition_name = "Reader"
principal_id = one(data.azuread_group.group_reader[*].object_id)
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_resource_group_app_monitoring_reader_reader" {
count = var.reader_group_name == "" ? 0 : 1

description = "Role assignment to app resource group."
scope = azurerm_resource_group.resource_group_app_monitoring.id
role_definition_name = "Reader"
principal_id = one(data.azuread_group.group_reader[*].object_id)
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_resource_group_storage_reader_reader" {
count = var.reader_group_name == "" ? 0 : 1

description = "Role assignment to storage resource group."
scope = "${data.azurerm_subscription.current.id}/resourceGroups/${split("/", var.storage_account_ids.external)[4]}"
role_definition_name = "Reader"
principal_id = one(data.azuread_group.group_reader[*].object_id)
principal_type = "Group"
}

# Key vault role assignments

# Databricks role assignments
resource "azurerm_role_assignment" "role_assignment_databricks_workspace_reader_reader" {
count = var.reader_group_name == "" ? 0 : 1

description = "Role assignment to databricks workspace."
scope = var.databricks_workspace_details["engineering"].id
role_definition_name = "Reader"
principal_id = one(data.azuread_group.group_reader[*].object_id)
principal_type = "Group"
}

# Storage role assignments
resource "azurerm_role_assignment" "role_assignment_storage_container_external_blob_data_reader_reader" {
count = var.reader_group_name == "" ? 0 : 1

description = "Role assignment to the external storage container."
scope = azurerm_storage_container.storage_container_external.id
role_definition_name = "Storage Blob Data Reader"
principal_id = one(data.azuread_group.group_reader[*].object_id)
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_storage_container_raw_blob_data_reader_reader" {
count = var.reader_group_name == "" ? 0 : 1

description = "Role assignment to the raw storage container."
scope = azurerm_storage_container.storage_container_raw.id
role_definition_name = "Storage Blob Data Reader"
principal_id = one(data.azuread_group.group_reader[*].object_id)
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_storage_container_enriched_blob_data_reader_reader" {
count = var.reader_group_name == "" ? 0 : 1

description = "Role assignment to the enriched storage container."
scope = azurerm_storage_container.storage_container_enriched.id
role_definition_name = "Storage Blob Data Reader"
principal_id = one(data.azuread_group.group_reader[*].object_id)
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_storage_container_curated_blob_data_reader_reader" {
count = var.reader_group_name == "" ? 0 : 1

description = "Role assignment to the curated storage container."
scope = azurerm_storage_container.storage_container_curated.id
role_definition_name = "Storage Blob Data Reader"
principal_id = one(data.azuread_group.group_reader[*].object_id)
principal_type = "Group"
}

resource "azurerm_role_assignment" "role_assignment_storage_container_workspace_blob_data_reader_reader" {
count = var.reader_group_name == "" ? 0 : 1

description = "Role assignment to the workspace storage container."
scope = azurerm_storage_container.storage_container_workspace.id
role_definition_name = "Storage Blob Data Reader"
principal_id = one(data.azuread_group.group_reader[*].object_id)
principal_type = "Group"
}
Loading
Loading