skip_destroy
support for aws_cloudwatch_log_group
#26752
Labels
enhancement
Requests to existing resources that expand the functionality or scope.
service/logs
Issues and PRs that pertain to the logs service.
Milestone
Community Note
Description
It would be usable to have a way of skipping
aws_cloudwatch_log_group
resources from being destroyed without actually blocking a destroy/change, to make it easier to represent the tight coupling such resources typically have with the related resources that log to them while still ensuring any captured logs will be kept for compliance reasons.My use case for this is born from using modules where we're trying to encapsulate supporting resources needed for core functionality. For example, VPC flow logging to CloudWatch requires 1. an
aws_flog_log
resource, 2. a role & policy, and 3. aaws_cloudwatch_log_group
resource.Currently, I've got the following options:
prevent_destroy
prevent_destroy
If
aws_cloudwatch_log_group
supported askip_destroy
attribute, I could include that resource in my module with that attribute set totrue
and not have to worry - this would also tie in nicely with retention periods, since the groups themselves don't cost money so they're effectively self-destroying.Another good example (imo) is with provisioning scripts: we typically create a dedicated module to represent our provisioning scripts for EC2 instances which outputs the script in a form that can be passed as
user_data
- part of these scripts include configuring the CloudWatch Agent to send specific logs; there are a number of these logs and sometimes we make changes such as adding a new log which means it would be very useful for the provisioning script module to be able to safely create the log groups its going to need.There is a general Terraform feature request for supporting this but it does not look like we'll get it anytime soon, and I think its a good enough fit for this resource (+ it should only require a small amount of code), to make it worth supporting via an attribute while we wait for that feature to land someday.
New or Affected Resource(s)
Potential Terraform Configuration
References
aws_ecs_task_definition
,aws_lambda_layer_version
, andaws_ec2_ebs_volume_attachment
(I think there's a few others around too with slightly different names)The text was updated successfully, but these errors were encountered: