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?
I suppose I could manually remove CloudWatch resources from tfstate before calling destroy, doesn't seem like the right approach.
There is a meta-argument called lifecycle for that.
resource "aws_s3_bucket" "MyPreciousBucket" {
lifecycle {
prevent_destroy = true
}
}