我正在使用 Terraform 来或阉割我的 Azure 环境。目前我可以执行增量更新。当我运行一个新计划时,它会尝试销毁所有以前应用的资源。例如,我创建了一个新的虚拟机,接下来我运行一个新计划来创建一个角色,它标记了虚拟机以进行销毁。
我知道 Azure ARM 具有增量
或完整
部署模式。
是否可以从 terraform 访问 deployment_mode
属性?
例如,在此脚本中:
data "azurerm_subscription" "primary" {
}
resource "azurerm_role_definition" "roles" {
count = length(var.roles)
name = "${var.role_prefix}${var.roles[count.index]["suffix_name"]}${var.role_suffix}"
scope = "${data.azurerm_subscription.primary.id}"
permissions {
actions = split(",", var.roles[count.index]["actions"])
not_actions = split(",", var.roles[count.index]["not_actions"])
}
assignable_scopes = ["${data.azurerm_subscription.primary.id}"]
}
有没有办法设置deployment_mode
?
最佳答案
您误解了 terraform 的工作原理。如果无法编辑资源,它只会破坏资源。如果编辑可以工作(至少 terraform 应该认为它可以工作),terraform 只会更新服务,但在创建资源后很多东西都是不可变的(名称是一个相当好的例子)。简而言之:如果您尝试更改不可变属性(或者更准确地说 - terraform 认为不可变的属性),terraform 将销毁\创建资源,否则它将更新它。
此外,您误解了完整\增量部署模式;)
关于azure - 使用 terraform 进行增量更新,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59917512/