[英]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
- 當前不存在。
azurerm_data_factory_linked_service_web
- 這僅支持 web 表而不支持 REST API 端點,不能與 Azure 集成運行時一起使用。
當我嘗試使用 rest 和 http 創建鏈接服務時,它總是重定向為使用 terraform 創建一個 web 表。因此,目前解決此問題的方法是使用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 討論中找到相同的內容: Support for Azure Data Factory Linked Service for REST API #9431
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.