我是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维护的状态文件,但任何线索都会有所帮助 .
提前致谢 .
1 回答
您可以使用
terraform state rm <resource>
从州中删除资源,也许这就是您要查找的内容?有关更多信息,请访问https://www.terraform.io/docs/commands/state/rm.html .