【发布时间】:2020-08-10 14:15:45
【问题描述】:
我正在与 Terraform V11 和 AWS 提供商合作;我正在寻找一种方法来防止在销毁阶段破坏少量资源。所以我使用了以下方法。
lifecycle {
prevent_destroy = true
}
当我运行“地形计划”时,我收到以下错误。
the plan would destroy this resource, but it currently has
lifecycle.preven_destroy set to true. to avoid this error and continue with the plan.
either disable or adjust the scope.
我正在寻找的只是一种避免在 destroy 命令期间破坏其中一个资源及其依赖项的方法。
【问题讨论】:
-
重新创建是什么意思?你想用新名称创建一个新资源吗?
-
修改了帖子以澄清。我希望能够销毁除具有依赖性的一种资源之外的所有东西。从我到目前为止收集到的内容来看,使用 prevent_destroy = true 我需要在 destroy 命令中添加 -target 以仅销毁我需要的对象。我希望是否有一个选项可以否定我不想破坏的东西。
-
这很有可能,但需要提供更多关于用例、计划和配置的信息。
-
你能举个例子吗?
-
你解决了这个问题吗?
标签: terraform terraform-provider-aws