Skip to content

Commit

Permalink
Merge pull request #17 from aztfmod/RS-analytics
Browse files Browse the repository at this point in the history
Fixed issue executing AIRS launchpad
  • Loading branch information
singh-rahul authored Sep 20, 2020
2 parents a54a965 + bba7649 commit a991188
Show file tree
Hide file tree
Showing 7 changed files with 139 additions and 4 deletions.
21 changes: 21 additions & 0 deletions azure_aml.tf
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -134,4 +134,4 @@ role_mapping = {
}
}
}
}
}
14 changes: 14 additions & 0 deletions modules/analytics/azure_aml/main.tf
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
4 changes: 4 additions & 0 deletions modules/analytics/azure_aml/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
output id {
value = azurerm_machine_learning_workspace.ws.id
sensitive = true
}
12 changes: 12 additions & 0 deletions modules/analytics/azure_aml/variables.tf
Original file line number Diff line number Diff line change
@@ -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 {} */

84 changes: 84 additions & 0 deletions modules/analytics/azure_aml/workspace.tf
Original file line number Diff line number Diff line change
@@ -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"
} */


6 changes: 3 additions & 3 deletions modules/analytics/synapse/workspace.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# 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
passthrough = var.global_settings.passthrough
}

# 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
Expand Down Expand Up @@ -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
}
}

0 comments on commit a991188

Please sign in to comment.