terraform-azurerm-sec-datab.../main.tf

47 строки
1.7 KiB
Terraform
Исходник Постоянная ссылка Обычный вид История

2020-06-05 19:10:41 +03:00
provider "azurerm" {
version = "~> 2.3"
features {}
}
locals {
resource_group = data.azurerm_resource_group.main
databricks_vnet_id = data.azurerm_virtual_network.main.id
databricks_private_snet_name = data.azurerm_subnet.private.name
databricks_public_snet_name = data.azurerm_subnet.public.name
log_analytics_workspace_id = data.azurerm_log_analytics_workspace.main.id
diagnostics_storage_account_id = data.azurerm_storage_account.main.id
diagnostics_script_path = var.diagnostics_script_path == "" ? "${path.module}/scripts/diagnostics.sh" : var.diagnostics_script_path
2020-06-05 19:10:41 +03:00
}
module "azurerm_naming" {
source = "git::https://github.com/Azure/terraform-azurerm-naming"
2020-06-05 19:10:41 +03:00
prefix = var.prefix
suffix = var.suffix
}
resource "azurerm_databricks_workspace" "main" {
name = module.azurerm_naming.databricks_workspace.name_unique
resource_group_name = local.resource_group.name
location = local.resource_group.location
sku = var.databricks_workspace_sku
custom_parameters {
no_public_ip = var.no_public_ip
virtual_network_id = local.databricks_vnet_id
public_subnet_name = local.databricks_public_snet_name
private_subnet_name = local.databricks_private_snet_name
}
2020-06-05 19:10:41 +03:00
}
resource "null_resource" "main" {
triggers = {
log_analytics_id = local.log_analytics_workspace_id
diagnostics_storage_account_id = local.diagnostics_storage_account_id
2020-06-05 19:10:41 +03:00
}
provisioner "local-exec" {
command = "${local.diagnostics_script_path} ${local.resource_group.name} ${local.log_analytics_workspace_id} ${local.diagnostics_storage_account_id} ${azurerm_databricks_workspace.main.id}"
2020-06-05 19:10:41 +03:00
}
2020-06-25 10:07:47 +03:00
depends_on = [azurerm_databricks_workspace.main]
2020-06-05 19:10:41 +03:00
}