-1

我正在使用 Terraformazurerm_template_deployment部署 AADDS,运行时出现以下错误terraform apply

Error: Error validating Template for Deployment "aadds-arm-template" (Resource Group "RG-VNET-Aadds-001"): Deployment template validation failed: 'Template parameter JToken type is not valid. Expected 'Array'. Actual 'String'. Please see https://aka.ms/resource-manager-parameter-files for usage details.'.
-----------------------------------

我使用下面的构造在我的 terraform 代码中传递 theparams.parameters.json 和 aadds-arm-template.json 文件:

resource "azurerm_template_deployment" "aadds-arm-template" {
    name                    = "aadds-arm-template"
    resource_group_name     = local.RG-Aadds-Name 
    template_body           = file("aadds-arm-template.json")
    parameters_body         = file("theparams.parameters.json")     
    deployment_mode = "Incremental" 
}

我相信 Terraform 对这个对象构造有问题:

        "notificationSettings": {
            "value": {
                "notifyGlobalAdmins": "Disabled",
                "notifyDcAdmins": "Enabled",
                "additionalRecipients": []
            }
        },

在我的theparams.parameters.json文件中,我没有发布这两个文件的内容,因为我确信这是引起所有大惊小怪的对象的传递。如果有人会提供帮助将不胜感激。我还在此链接中使用了相同的构造:Terraform - 将类型对象作为参数传递给 Azure 模板部署,但它从未奏效。

我不知道该怎么做,请帮助没有意义我在过去的 2 天里一直在努力解决这个问题。

4

2 回答 2

0

我要感谢 Leif:https ://stackoverflow.com/users/739351/leif ,他不久前将这个答案发布给了其他人,并最终让我的代码使用他的文章中的解决方案工作:Terraform - Passing键入 Object 作为 Azure 模板部署的参数

好东西谢谢。-平等

于 2020-04-11T20:16:43.007 回答
0

您的错误输出告诉您出了什么问题...

'Template parameter JToken type is not valid. Expected 'Array'. Actual 'String'. 
Please see https://aka.ms/resource-manager-parameter-files for usage details.'.

将该参数修复为数组。

于 2020-04-09T22:01:49.773 回答