terraform 破坏后保留资源 [英] Retaining resources after terraform destroy

查看:26
本文介绍了terraform 破坏后保留资源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在停止使用 terraform 创建的一堆资源(包括 CloudWatch 日志组)后保留 CloudWatch 日志.有没有办法告诉 terraform destroy 节省一些资源?

I'd like to retain CloudWatch logs after I spin down a bunch of resources created using terraform - which includes the CloudWatch log group. Is there a way to tell terraform destroy to spare some resources?

我想我可以在调用销毁之前从 tfstate 手动删除 CloudWatch 资源,这似乎不是正确的方法.

I suppose I could manually remove CloudWatch resources from tfstate before calling destroy, doesn't seem like the right approach.

推荐答案

在cloudformation中,有一个选项retain 删除策略

In cloudformation, there is an option retain DeletionPolicy

{
  "AWSTemplateFormatVersion" : "2010-09-09",
  "Resources" : {
    "myS3Bucket" : {
      "Type" : "AWS::S3::Bucket",
      "DeletionPolicy" : "Retain"
    }
  }
}

但是在terraform中,我没有找到这种类型的生命周期

But in terraform, I didn't find this type of lifecycle

您可以在 terraform 问题列表 或提出新票来关注此问题.

You can search in terraform issue list or raise a new ticket to follow this issue.

这篇关于terraform 破坏后保留资源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆