我正在尝试使用Terraform创建Synapse 连系服务,并且遇到了"type_properties_json“字段的一个常量障碍(这是必需的)。
当我试图建立到SFTP资源类型的链接服务时,我可以通过门户做到这一点--没有问题,但是尝试使用Terraform会不断地给我带来错误。我正在使用JSON代码格式在此参考,但是"type_properties_json“字段不断出错,因为我认为它需要一个"String”,而是提供一个Mapstring类型。
我在地形应用过程中一直收到的错误是json: cannot unmarshal string into Go value of type map[string]interface {}。
我的特定代码如下所示:
resource "azurerm_synapse_linked_service" "linked-service" {
synapse_workspace_id = azurerm_synapse_workspace.synapse.id
name = "name"
type = "Sftp"
type_properties_json = <<JSON
{
"host": "x.x.com",
"port": 22,
"skipHostKeyValidation": false,
"hostKeyFingerprint": "ssh-rsa 2048 xx:00:00:00:xx:00:x0:0x:0x:0x:0x:00:00:x0:x0:00",
"authenticationType": "Basic",
"userName": "whatever_name,
"password": "randompassw"
}
JSON
depends_on = [azurerm_synapse_firewall_rule.allow]}
在这里没有希望了,现在我正在寻找人群的来源,看看是否有人曾经遇到过这个问题!!
发布于 2022-02-22 11:02:02
这是因为您要传递的密码参数。根据这个Microsoft文档,它应该按以下方式传递:
"password": {
"type": "SecureString",
"value": "<value>"
}而不是
"password": <value>我在我的环境中使用您的代码进行了相同的测试,在这里我遇到了完全相同的问题:

因此,我使用了下面的代码,应用了上面提到的解决方案:
resource "azurerm_synapse_linked_service" "example" {
name = "SftpLinkedService"
synapse_workspace_id = azurerm_synapse_workspace.example.id
type = "Sftp"
type_properties_json = <<TYPE
{
"host": "xxx.xx.x.x",
"port": 22,
"skipHostKeyValidation": false,
"hostKeyFingerprint": "<SSH-publicKey>",
"authenticationType": "Basic",
"userName": "adminuser",
"password": {
"type": "SecureString",
"value": "<Value>"
}
}
TYPE
depends_on = [
azurerm_synapse_firewall_rule.example,
azurerm_synapse_firewall_rule.example1
]
}输出:


https://stackoverflow.com/questions/71178279
复制相似问题