Moe*_*Moe 6 terraform terraform-provider-aws
我正在与 Terraform V11 和 AWS 提供商合作;我正在寻找一种方法来防止在销毁阶段销毁少量资源。所以我使用了以下方法。
lifecycle {
prevent_destroy = true
}
Run Code Online (Sandbox Code Playgroud)
当我运行“terraform plan”时,出现以下错误。
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.
Run Code Online (Sandbox Code Playgroud)
我正在寻找的只是一种避免在 destroy 命令期间破坏其中一个资源及其依赖项的方法。
小智 7
AFAIK 尚不支持此功能您需要从状态文件中删除该资源,然后重新导入它
terraform plan | grep <resource> | grep id
terraform state rm <resource>
terraform destroy
terraform import <resource> <ID>
Run Code Online (Sandbox Code Playgroud)
小智 4
最简单的方法是注释掉您想要销毁的所有资源,然后执行terraform apply
.
归档时间: |
|
查看次数: |
4796 次 |
最近记录: |