Terraform azurerm azurerm_data_factory_dataset_binary 参数定义

Terraform azurerm azurerm_data_factory_dataset_binary prameters definition

所以我一直在尝试在 terraform 中为 azure datafactory 定义一个数据集,但在规划 terraform 时定义动态参数时,我一直运行关注这个问题。

Terraform 计划输出:

│ Error: Incorrect attribute value type
│
│   on xxxxxx-xxxxxxx.tf line 69, in resource "azurerm_data_factory_dataset_binary" "xxxxxxx_dataset_source":
│   69:     parameters = <<PARAMETERS
│   70:     {
│   71:         "fileSystem": {
│   72:             "type": "string"
│   73:         },
│   74:         "directory":{
│   75:             "type": "string"
│   76:         }
│   77:     }
│   78:     PARAMETERS
│
│ Inappropriate value for attribute "parameters": map of string required.

数据集定义:


resource "azurerm_data_factory_dataset_binary" "xxxxxxx_dataset_source" {
    name = join("", [var.config.name, "_storageacount_dataset_source"])
    resource_group_name = var.common.resource_group_name
    linked_service_name = azurerm_data_factory_linked_service_data_lake_storage_gen2.xxxxxx_storageacount_linkedservice_source.name
    data_factory_name =  var.config.datafactory_name

    parameters = <<PARAMETERS
    {
        "fileSystem": {
            "type": "string"
        },
        "directory":{
            "type": "string"
        }
    }
    PARAMETERS

    azure_blob_storage_location {
        container = "@dataset().fileSystem"
        path = "@dataset().directory"
        filename = "/"
    }
}

文档不清楚,因为这应该如何定义。我看到其他人谈论 parameters_values 但当尝试使用它时,它说这里不是预期的。

提前致谢!

正确的做法是这样的:

resource "azurerm_data_factory_dataset_binary" "xxxxxxx_dataset_source" {
    name = join("", [var.config.name, "_storageacount_dataset_source"])
    resource_group_name = var.common.resource_group_name
    linked_service_name = azurerm_data_factory_linked_service_data_lake_storage_gen2.xxxxxx_storageacount_linkedservice_source.name
    data_factory_name =  var.config.datafactory_name

    parameters = <<PARAMETERS
    {
        "fileSystem": "",
        "directory": ""
    }
    PARAMETERS

    azure_blob_storage_location {
        container = "@dataset().fileSystem"
        path = "@dataset().directory"
        filename = "/"
    }
}