问题描述
我正在尝试使用 terraform 和嵌入式 ARM 模板来允许在 Azure 中创建一个简单的逻辑应用程序.我在 terraform 中有资源块:
I am attempting to use terraform and embedded ARM templates to permit creating a simple logic app in Azure. I have the resource block in terraform as:
resource "azurerm_resource_group_template_deployment" "templateTEST" {
name = "arm-Deployment"
resource_group_name = azurerm_resource_group.rg.name
deployment_mode = "Incremental"
template_content = file("${path.module}/arm/createLogicAppsTEST.json")
parameters_content = jsonencode({
logic_app_name = { value = "logic-${var.prefix}" }
})
}
并且定义了 createLogicAppsTEST.json
文件(只是前几行)
and the createLogicAppsTEST.json
file is defined (just the top few lines as)
{
"$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"logic_app_name": {
"defaultValue": "tsa-logic-dgtlbi-stage-001",
"type": "string"
}
},
"variables": {},
"resources": [
{
....
第一次部署和运行时,即.使用 terraform 和嵌入式 ARM 模板创建逻辑应用程序资源,它将创建正确传递名称:
When deploying and running the first time, ie. creating the logic app resource using terraform and the embedded ARM template, it will create passing the name correctly given the:
parameters_content = jsonencode({
logic_app_name = { value = "logic-${var.prefix}" }
})
但是,如果我再次运行,terraform 似乎会忽略我传递的参数,并使用 ARM 模板中的默认值:
however, if I ever run again, terraform appears to ignore the parameters I am passing and goes with the default from the ARM template as:
"logic_app_name": {
"defaultValue": "tsa-logic-dgtlbi-stage-001",
"type": "string"
}
我已更新到 terraform (0.14.2) 和 azurerm (2.40.0) 的最新版本,但问题仍然存在.目前,鉴于我公司的 dev、test 和 prod 具有不同的前缀和名称,因此这种类型的 ARM 在 terraform 中存在问题,即.生产-,开发-.
I have updated to the latest version of both terraform (0.14.2) and azurerm (2.40.0), yet the issue persists. At present, this kind of makes ARM in terraform problematic given different tiers, dev, test and prod at my company have different prefixes and names ie. prod-, dev-.
是否有设置可以让 terraform 实际使用我通过 azurerm_resource_group_template_deployment 资源块传递的参数?
Is there a setting to make terraform actually use the parameters I am passing with azurerm_resource_group_template_deployment resource block?
推荐答案
我选择只使用旧的提供程序,实际上在 github 上有一个关于相同问题的公开错误报告
I elected to just use the old provider, there is actually an open bug report about this same issue on github
这篇关于azurerm_resource_group_template_deployment 忽略参数文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!