【发布时间】:2018-10-23 20:20:44
【问题描述】:
我是 terraform 的新手,并且已经玩了一段时间了。在我尝试执行的场景中,我尝试为我的每个部署创建一个堆栈。我能够创建我需要的资源。但是,当我想部署一个新堆栈时,它正试图破坏已经存在的堆栈。我曾尝试将生命周期密钥与防止销毁一起使用,但这会引发错误,指出无法删除资源。
the plan would destroy this resource, but it currently has lifecycle.prevent_destroy set to true. To avoid this error and continue with the plan, either disable lifecycle.prevent_destroy or adjust the scope of the plan using the -target flag.
有没有办法跳过或让 terraform “忘记”它创建的资源?我知道这很棘手,因为 terraform 维护的状态文件,但任何线索都会有所帮助。
提前致谢。
【问题讨论】:
-
请安装您的 Terraform。
-
如果您想保留多个已部署的 Terraform 堆栈,您应该使用单独的状态文件和/或工作区。
-
用于独立检查工作区的不同部署 (terraform.io/docs/state/workspaces.html)。关于销毁:你想销毁和再利用什么样的资源?
标签: terraform