-
Notifications
You must be signed in to change notification settings - Fork 9.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
aws_cloudwatch_log_group does not destroy although log says it did #14057
Comments
I had a similar problem but it was not a bug. In my case terraform was destroying the cloudwatch log group, but AWS (eks.amazonaws.com principal) was recreating it, I believe because some logs got delivered after the log group deletion. You can verify this by looking at the expiry set on the log group, if AWS EKS created the log group then the expiry would be set to "never" instead of the log retention days you have specified in terraform. |
I see that in your screenshot that it is actually set to "never", so I strongly believe this is the case. You can probably double check the Cloudtrail for confirmation. |
Yes. That's a bug as it was acknowledged 17 days ago. |
Hi folks 👋 This is not likely an issue with the Terraform AWS Provider As mentioned above, certain AWS services will (re-)create a CloudWatch Log Group automatically when it is not present. A really good clue to this behavior is seeing the log group with no retention period. Given that CloudWatch Logs in general have eventually consistent delivery, the deletion of a resource that logs such as an EKS Cluster, may not fully guarantee that the CloudWatch Log Group is not re-created with those lingering entries. As an example, these IAM permissions are present by default with the EKS managed IAM policy (e.g. {
"Effect": "Allow",
"Action": "logs:CreateLogGroup",
"Resource": "arn:aws:logs:*:*:log-group:/aws/eks/*"
}, To prevent this automatic behavior, update your IAM permissions for the service in question, to not allow this Hope this helps. |
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks! |
This issue was originally opened by @ivanfarkas2 as hashicorp/terraform#25482. It was migrated here as a result of the provider split. The original body of the issue is below.
Terraform Version
Terraform Configuration Files
Debug Output
Crash Output
N/A
Expected Behavior
terraform destroy
should have removed the aws_cloudwatch_log_group resource (/aws/eks/ceres-eks-dev/cluster)Actual Behavior
terraform destroy
did not remove the aws_cloudwatch_log_group resource (/aws/eks/ceres-eks-dev/cluster), although log says it did, but changed the retention time from 7 days (1 week) to Never expire. Brilliant!After
terraform apply
After
terraform destroy
Log streams
Steps to Reproduce
terraform init
terraform apply
terraform destroy
Additional Context
N/A
References
cloudwatch log group not destroyed hashicorp/terraform#14750 seems somewhat related.
The text was updated successfully, but these errors were encountered: