diff --git a/azure_aml.tf b/azure_aml.tf new file mode 100644 index 0000000000..f91e1c705d --- /dev/null +++ b/azure_aml.tf @@ -0,0 +1,21 @@ +module aml_workspaces { + source = "./modules/analytics/azure_aml" + for_each = local.database.aml_workspaces + + location = lookup(each.value, "region", null) == null ? module.resource_groups[each.value.resource_group_key].location : local.global_settings.regions[each.value.region] + resource_group_name = module.resource_groups[each.value.resource_group_key].name + global_settings = local.global_settings + settings = each.value + virtual_network_id = lookup(each.value.custom_parameters, "vnet_key") == null ? null : module.networking[each.value.custom_parameters.vnet_key].id + public_subnet_name = lookup(each.value.custom_parameters, "vnet_key") == null ? null : module.networking[each.value.custom_parameters.vnet_key].subnets[each.value.custom_parameters.public_subnet_key].name + private_subnet_name = lookup(each.value.custom_parameters, "vnet_key") == null ? null : module.networking[each.value.custom_parameters.vnet_key].subnets[each.value.custom_parameters.private_subnet_key].name + + storage_account_id = module.storage_accounts[each.value.data_lake_filesystem.storage_account_key].data_lake_filesystems[each.value.data_lake_filesystem.container_key].id + keyvault_id = try(each.value.sql_administrator_login_password, null) == null ? module.keyvaults[each.value.keyvault_key].id : null + application_insights_id = lookup(each.value.custom_parameters, "app_insights") == null ? null : module.terraform-azurerm-caf-appinsights[each.value.custom_parameters.vnet_key].subnets[each.value.custom_parameters.private_subnet_key].name +} + +output databricks_workspaces { + value = module.databricks_workspaces + sensitive = true +} diff --git a/landingzones/caf_launchpad/scenario/100/configuration.tfvars b/landingzones/caf_launchpad/scenario/100/configuration.tfvars index ff23618f32..f2dabd3ded 100755 --- a/landingzones/caf_launchpad/scenario/100/configuration.tfvars +++ b/landingzones/caf_launchpad/scenario/100/configuration.tfvars @@ -134,4 +134,4 @@ role_mapping = { } } } -} \ No newline at end of file +} diff --git a/modules/analytics/azure_aml/main.tf b/modules/analytics/azure_aml/main.tf new file mode 100644 index 0000000000..90bb2ba1fa --- /dev/null +++ b/modules/analytics/azure_aml/main.tf @@ -0,0 +1,14 @@ +locals { + module_tag = { + "module" = basename(abspath(path.module)) + } + # tags = merge(try(each.value.tags, {}), local.module_tag) +} + +terraform { + required_providers { + azurecaf = { + source = "aztfmod/azurecaf" + } + } +} diff --git a/modules/analytics/azure_aml/output.tf b/modules/analytics/azure_aml/output.tf new file mode 100644 index 0000000000..64ca57a529 --- /dev/null +++ b/modules/analytics/azure_aml/output.tf @@ -0,0 +1,4 @@ +output id { + value = azurerm_machine_learning_workspace.ws.id + sensitive = true +} diff --git a/modules/analytics/azure_aml/variables.tf b/modules/analytics/azure_aml/variables.tf new file mode 100644 index 0000000000..936b78bd96 --- /dev/null +++ b/modules/analytics/azure_aml/variables.tf @@ -0,0 +1,12 @@ +variable settings {} +variable global_settings {} +variable location {} +variable resource_group_name {} +variable keyvault_id {} +variable storage_account_id {} +variable application_insights_id {} + +/* variable virtual_network_id {} +variable private_subnet_name {} +variable public_subnet_name {} */ + diff --git a/modules/analytics/azure_aml/workspace.tf b/modules/analytics/azure_aml/workspace.tf new file mode 100644 index 0000000000..7f32e95fff --- /dev/null +++ b/modules/analytics/azure_aml/workspace.tf @@ -0,0 +1,84 @@ +# naming convention +resource "azurecaf_name" "wp" { + name = var.settings.application_insight_name + prefix = [var.global_settings.prefix] + resource_type = "azurerm_machine_learning_workspace" + random_length = var.global_settings.random_length + clean_input = true + passthrough = var.global_settings.passthrough +} + +# ML Workspace +resource "azurerm_machine_learning_workspace" "ws" { + name = azurecaf_name.wp.result + location = var.location + resource_group_name = var.resource_group_name + application_insights_id = var.application_insights_id + key_vault_id = var.keyvault_id + storage_account_id = var.storage_account_id + tags = try(var.settings.tags, null) + sku = try(var.settings.sku, "basic") + + identity { + type = "SystemAssigned" + } +} + + +#------------------------ + +/* resource "azurecaf_name" "apin" { + name = var.settings.application_insight_name + prefix = [var.global_settings.prefix] + resource_type = "azurerm_application_insight" + random_length = var.global_settings.random_length + clean_input = true + convention = var.global_settings.passthrough +} */ + +/* resource "azurerm_resource_group" "rg_dap_aml" { + name = azurecaf_naming_convention.nc_aml_rg.result + location = var.location +} */ + +/* +module "aml_storage" { + source = "../module_azure_storage" + + prefix = var.prefix + convention = var.convention + resource_group_name = azurerm_resource_group.rg_dap_aml.name + location = var.location + storage_account_config = var.aml_config.storage_account + subnet_ids = var.subnet_ids +} + +# Insight ID for ML Workspace +resource "azurerm_application_insights" "ml_workspace_insight" { + name = azurecaf_naming_convention.nc_aml_appinsight.result + location = azurerm_resource_group.rg_dap_aml.location + resource_group_name = azurerm_resource_group.rg_dap_aml.name + application_type = "web" + + depends_on = [azurerm_resource_group.rg_dap_aml] +} + */ + +/* # Keyvault for ML Workspace +module "caf-keyvault" { + source = "github.com/aztfmod/terraform-azurerm-caf-keyvault?ref=vnext" + # source = "aztfmod/caf-keyvault/azurerm" + # version = "2.0.2" + + prefix = var.prefix + location = var.location + resource_group_name = azurerm_resource_group.rg_dap_aml.name + akv_config = var.akv_config + tags = var.tags + diagnostics_settings = var.akv_config.diagnostics + diagnostics_map = var.diagnostics_map + log_analytics_workspace = var.log_analytics_workspace + convention = "passthrough" +} */ + + diff --git a/modules/analytics/synapse/workspace.tf b/modules/analytics/synapse/workspace.tf index 4a32688898..17a9a7a901 100644 --- a/modules/analytics/synapse/workspace.tf +++ b/modules/analytics/synapse/workspace.tf @@ -1,7 +1,7 @@ # naming convention resource "azurecaf_name" "wp" { name = var.settings.name - resource_type = "azurerm_machine_learning_workspace" + resource_type = "azurerm_synapse_workspace" prefixes = [var.global_settings.prefix] random_length = var.global_settings.random_length clean_input = true @@ -9,7 +9,7 @@ resource "azurecaf_name" "wp" { } # synapse workspace -resource "azurerm_synapse_workspace" "wp" { +resource "azurerm_synapse_workspace" "ws" { name = azurecaf_name.wp.result resource_group_name = var.resource_group_name location = var.location @@ -67,4 +67,4 @@ resource "azurerm_key_vault_secret" "synapse_rg_name" { name = format("%s-synapse-resource-group-name", azurerm_synapse_workspace.wp.name) value = var.resource_group_name key_vault_id = var.keyvault_id -} \ No newline at end of file +}