szy*_*mon 16 terraform terraform-provider-azure terraform0.12+
我正在 Azure 中部署 Web 应用程序,我想忽略对site_config块中scm_type属性的更改。
在部署期间,scm_type属性设置为None,稍后我们将在 Azure 门户中将其更改为不同的内容。
我当前的 TF 代码如下所示:
resource "azurerm_app_service" "web_app" {
count = length(var.app_names)
name = var.app_names[count.index]
location = data.azurerm_resource_group.app_resource_group.location
resource_group_name = data.azurerm_resource_group.app_resource_group.name
app_service_plan_id = azurerm_app_service_plan.app_plan.id
tags = var.tags
app_settings = var.app_settings[count.index]
site_config {
always_on = true
websockets_enabled = var.websockets_enabled[count.index]
use_32_bit_worker_process = var.use_32_bit_worker_process
scm_type = "None"
}
lifecycle {
ignore_changes = [
site_config.0.scm_type
]
}
}
Run Code Online (Sandbox Code Playgroud)
我希望 terraform 计划在基础设施更新期间忽略scm_type 的变化,但它试图将其恢复为None。来自地形计划输出的行:
~ scm_type = "BitbucketGit" -> "None"
Jam*_*mie 16
我认为您需要在忽略更改中修复您的语法。它应该看起来像这样,或者至少从我能够开始工作的情况来看。
lifecycle {
ignore_changes = [
site_config["scm_type"],
]
}
Run Code Online (Sandbox Code Playgroud)
这是具有语法的文档。
https://www.terraform.io/docs/language/meta-arguments/lifecycle.html#ignore_changes
szy*_*mon 10
这是一个 terraform 错误:https : //github.com/hashicorp/terraform/issues/21433 我的语法是正确的,在 0.12.4 版本中它又可以工作了。
| 归档时间: |
|
| 查看次数: |
17437 次 |
| 最近记录: |