如何在 Terraform 中对 Azure 数据工厂的 REST 资源数据集进行编码

How to code the REST resource dataset of an Azure Data Factory in Terraform

我正在尝试在 Terraform 中编写 Azure 数据工厂代码,但我不确定如何编写此 REST 数据集的代码:

{
"name": "RestResource1",
"properties": {
    "linkedServiceName": {
        "referenceName": "API_Connection",
        "type": "LinkedServiceReference"
    },
    "annotations": [],
    "type": "RestResource",
    "schema": []
},
"type": "Microsoft.DataFactory/factories/datasets"

}

我在 azurerm 文档中没有看到。可以改用 azurerm_data_factory_dataset_http 资源吗?

azurerm_data_factory_linked_service_rest - Does not currently exist.

azurerm_data_factory_linked_service_web - This only support a web table and not a REST API endpoint and can't be used with the Azure integrated runtime.

当我尝试使用 rest 和 http 创建链接服务时,它总是重定向到使用 terraform 创建网络 table。因此,目前解决方法是使用 azurerm_data_factory_linked_custom_service.

示例如下: 如何创建自定义链接服务:

provider "azurerm" {

  features{}

}

data "azurerm_resource_group" "example" {

  name     = "Your Resource Group"

}



data "azurerm_data_factory" "example" {

  name                = "vipdashadf"

  resource_group_name = data.azurerm_resource_group.example.name

}



resource "azurerm_data_factory_linked_custom_service" "example" {

  name                = "ipdashlinkedservice"

  data_factory_id =   data.azurerm_data_factory.example.id

  type = "RestService"

  description = "test for rest linked"

  type_properties_json = <<JSON

  {

            "url": "http://www.bing.com",

            "enableServerCertificateValidation": false,

            "authenticationType": "Anonymous"

}

JSON

annotations = []

}



resource "azurerm_data_factory_dataset_http" "example" {

  name                = "apidataset"

  resource_group_name = data.azurerm_resource_group.example.name

  data_factory_name   = data.azurerm_data_factory.example.name

  linked_service_name = azurerm_data_factory_linked_custom_service.example.name



  relative_url   = "http://www.bing.com"

  request_body   = "foo=bar"

  request_method = "POST"



}

输出:

链接服务 - ipdashlinkservice 类型 Rest 连接器

数据集: apidataset

您可以在 GitHub 讨论中找到相同的内容: 支持 REST 的 Azure 数据工厂链接服务 API #9431