-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
cloudwatch log group not destroyed #14750
Comments
I'm delighted you added this, I've exactly the same issue with VPC flow logs (although lagging on v0.9.3). This is my suspicion:
Possible fix, if it's applicable to you:
You create and destroy that log group yourself presumably, so why the need to allow VPC Flow Logs to also create and delete it? Hope it works for you too! |
Hi Graham, Thanks for answering.
|
Hi @ferrandinand, does it fix it if you remove the |
Hi @Graham-M How is this managed? Thanks! |
Hi @ferrandinand, it looks like you explicitly create the All the IAM role which you give to the Flow Logs needs to do is to be able to write to that aforementioned log group, therefore it just needs |
Hey @ferrandinand – I'm not able to reproduce this unfortunately. Are you able to capture any DEBUG logs (running terraform with I was apple to apply and destroy an example log group like you showed with no error, and it was removed. I'm curious if this only happens in a certain situation. thanks! |
Hi @catsby, I'm able to reproduce, but I don't think it's a terraform issue, but more due to the nature of AWS and its APIs. The debug log would simply show the log group being deleted and a clean exit from the The issue would manifest the next time you came to This needs to be undertaken in an environment with a busy VPC, it won't manifest in a quiet one with no flow logs to be flushed post-deletion. Additionally, the workaround I suggested in my first reply does work here. If you create the log group yourself explicitly via conf and This is where it's recommended, and where @ferrandinand and I most likely copied and pasted from in the first instance: |
Ah I see, thanks for pointing that out 😄 Thanks! |
Nice @Graham-M! Helped me too! |
I had the same issue and removing the "logs:CreateLogGroup" from the policy resolved the issue in my case, thanks @Graham-M ! |
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Terraform Version
Terraform v0.9.4
Affected Resource(s)
cloudwatch_log_group
Terraform Configuration Files
resource "aws_cloudwatch_log_group" "vpcflow_log_group" {
name = "vpcflow_log_group"
retention_in_days = "${var.vpc_flow_logs_retention}"
}
Expected Behavior
aws_cloudwatch_log_group should be removed when performing a destroy
Actual Behavior
Terraform destroy is showing that resource is destroyed but actually is still present.
Steps to Reproduce
$ terraform destroy
aws_cloudwatch_log_group.vpcflow_log_group: Refreshing state... (ID: vpcflow_log_group) aws_cloudwatch_log_group.vpcflow_log_group: Destroying... (ID: vpcflow_log_group) aws_cloudwatch_log_group.vpcflow_log_group: Destruction complete
Got to aws console/aws cli to check it is still there
aws logs describe-log-groups
The text was updated successfully, but these errors were encountered: