使用Terraform创建Azure数据工厂链接服务在实时模式下创建链接

swvgeqrz  于 2023-10-22  发布在  其他
关注(0)|答案(1)|浏览(102)

当我在Azure Data Factory(ADF)中使用terraform(使用azurerm_data_factory_linked_service_azure_databricks)为Databricks创建链接服务时,链接服务仅在实时模式下显示。
如何在存储所有其他ADF管道配置的GIT模式下使链接的服务可用?

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=2.97.0"
    }
    databricks = {
      source = "databrickslabs/databricks"
    }
  }
}

provider "azurerm" {
  features {}
}

provider "databricks" {
  host          = azurerm_databricks_workspace.this.workspace_url
}

data "azurerm_client_config" "this" {
}

resource "azurerm_data_factory" "this" {
  name                = "myadf-9182371362"
  resource_group_name = "testrg"
  location            = "East US"

  identity {
    type = "SystemAssigned"
  }       

  vsts_configuration {
      account_name    = "mydevopsorg"
      branch_name     = "main"
      project_name    = "adftest"
      repository_name = "adftest"
      root_folder     = "/adf/"
      tenant_id       = data.azurerm_client_config.this.tenant_id
  }

}

resource "azurerm_databricks_workspace" "this" {
  name                 = "mydbworkspace"
  resource_group_name = "testrg"
  location            = "East US"
  sku                  = "standard"

}

data "databricks_node_type" "smallest" {
  local_disk = true

  depends_on = [
    azurerm_databricks_workspace.this
  ]
}

data "databricks_spark_version" "latest_lts" {
  long_term_support = true

  depends_on = [
    azurerm_databricks_workspace.this
  ]
}

resource "databricks_cluster" "this" {
  cluster_name = "Single Node"
  spark_version = data.databricks_spark_version.latest_lts.id
  node_type_id  = data.databricks_node_type.smallest.id
  autotermination_minutes = 20

  spark_conf = {
    "spark.databricks.cluster.profile" : "singleNode"
    "spark.master" : "local[*]"
  }

  depends_on = [
    azurerm_databricks_workspace.this
  ]

  custom_tags = {
    "ResourceClass" = "SingleNode"
  }
}

data "azurerm_resource_group" "this" {
  name = "testrg"
}

resource "azurerm_role_assignment" "example" {
  scope                = data.azurerm_resource_group.this.id 
  role_definition_name = "Contributor"  
  principal_id         = azurerm_data_factory.this.identity[0].principal_id
}

resource "azurerm_data_factory_linked_service_azure_databricks" "msi_linked" {
  name                = "ADBLinkedServiceViaMSI"
  data_factory_id     = azurerm_data_factory.this.id
  resource_group_name = "testrg"
  description         = "ADB Linked Service via MSI"
  adb_domain          = "https://${azurerm_databricks_workspace.this.workspace_url}"

  existing_cluster_id = databricks_cluster.this.id
  msi_work_space_resource_id = azurerm_databricks_workspace.this.id
}

git模式下的结果

结果在实时模式

zbsbpyhn

zbsbpyhn1#

我认为在GIT模式下,所有链接的服务定义,全局参数等。从GIT分支中找到的JSON文件中读取。
所以我认为这是预期的行为。

相关问题