gpt4 book ai didi

azure - 无法确定此地形应用错误发生在何处

转载 作者:行者123 更新时间:2023-12-03 06:41:21 29 4
gpt4 key购买 nike

当我执行 terraform 应用时,出现以下错误,错误:验证模板部署“uksfe-dev-api-office365”(资源组“app-sfe-dev-eastus”):请求验证: resources.DeploymentsClient#Validate: 发送请求失败: StatusCode=400 -- 原始错误: Code="InvalidRequestContent"Message="请求内容无效且无法反序列化: '转换值时出错\"sfe-dev-api- office365\”键入“Azure.Deployments.Core.Definitions.DeploymentParameterDefinition”。路径“properties.parameters.connections_office365_name”,第 1 行,位置 1590。”。”。这是错误引用的资源:

resource "azurerm_resource_group_template_deployment" "office365" {
name = format( "%s%s-%s-api-office365", var.sfe_names.market, var.sfe_names.product_group, var.sfe_names.environment)
resource_group_name = module.resource_group.name
template_content = file("./refScript/logicapp/Office365.json")
deployment_mode = "Incremental"
parameters_content = jsonencode({
"connections_office365_name" = format( "%s-%s-api-office365", var.sfe_names.product_group, var.sfe_names.environment),
"subscription_id" = data.azurerm_subscription.current.subscription_id
})
}

这是上面显示的资源引用的 ARM 模板文件 Office365.json:

{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"connections_office365_name": {
"defaultValue": "testoffice365",
"type": "String"
}
},
"variables": {},
"resources": [
{
"type": "Microsoft.Web/connections",
"apiVersion": "2016-06-01",
"name": "[parameters('connections_office365_name')]",
"location": "eastus",
"kind": "V1",
"properties": {
"displayName": "<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6113120607080d0404190209000f0604210c18020e0c11000f18050e0c00080f4f020e0c" rel="noreferrer noopener nofollow">[email protected]</a>",
"statuses": [
{
"status": "Connected"
}
],
"customParameterValues": {},
"nonSecretParameterValues": {},
"createdTime": "2021-03-25T07:41:30.7103666Z",
"changedTime": "2021-09-02T19:26:09.2638641Z",
"api": {
"name": "sfe-dev-api-office365",
"displayName": "Office 365 Outlook",
"description": "Microsoft Office 365 is a cloud-based service that is designed to help meet your organization's needs for robust security, reliability, and user productivity.",
"iconUri": "https://connectoricons-prod.azureedge.net/releases/v1.0.1507/1.0.1507.2528/office365/icon.png",
"brandColor": "#0078D4",
"id": "/subscriptions/dfdbeere-dfda-ghgh-eree-18a838e6ed7a/providers/Microsoft.Web/locations/eastus/managedApis/office365",
"type": "Microsoft.Web/locations/managedApis"
},
"testLinks": [
{
"requestUri": "[concat('https://management.azure.com:443/subscriptions/dfdbeere-dfda-ghgh-eree-18a838e6ed7a/resourceGroups/app-sfe-dev-eastus/providers/Microsoft.Web/connections/', parameters('connections_office365_name'), '/extensions/proxy/testconnection?api-version=2016-06-01')]",
"method": "get"
}
]
}
}
]
}

我相信错误消息的最后一部分告诉了错误发生的位置,即路径'properties.parameters.connections_office365_name',第1行,位置1590。'

任何帮助将不胜感激。

最佳答案

示例here显示参数像这样传递到模板:

parameters_content = jsonencode({
"vnetName" = {
value = local.vnet_name
}
})

因此,您的代码需要修改如下:

parameters_content = jsonencode({
"connections_office365_name" = { value = format( "%s-%s-api-office365", var.sfe_names.product_group, var.sfe_names.environment) }
"subscription_id" = { value = data.azurerm_subscription.current.subscription_id }
})

关于azure - 无法确定此地形应用错误发生在何处,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/74480223/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com