-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
can't destroy aws_cloudwatch_log_stream if group has been destroyed #6776
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for submitting this, @ahl. It'll be good to get this fixed. 👍 Left some initial comments below -- please let us know if you have any questions or do not have time to implement the feedback.
Config: testAccAWSCloudWatchLogStreamConfig(rName), | ||
Check: resource.ComposeTestCheckFunc( | ||
testAccCheckCloudWatchLogStreamExists("aws_cloudwatch_log_stream.foobar", &ls), | ||
testAccCheckCloudWatchLogStreamDisappears2(&ls, rName), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This new custom function can be replaced with the existing functions from TestAccAWSCloudWatchLogGroup_disappears()
, e.g.
var lg cloudwatchlogs.LogGroup
// ...
testAccCheckCloudWatchLogGroupExists("aws_cloudwatch_log_group.foobar", &lg),
testAccCheckCloudWatchLogGroupDisappears(&lg),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm less convinced that this is an improvement, but I made the change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks @ahl 🚀
--- PASS: TestAccAWSCloudWatchLogStream_disappears_LogGroup (2.96s)
--- PASS: TestAccAWSCloudWatchLogStream_basic (3.95s)
--- PASS: TestAccAWSCloudWatchLogStream_disappears (4.09s)
This has been released in version 1.53.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
consider this config:
If you delete the log group it will implicitly delete the log stream. A subsequent
terraform plan
will result in an error:The problem is that
resourceAwsCloudWatchLogStreamRead
doesn't properly interpret an error looking up the log stream in the case that the log group doesn't exist.Output from acceptance testing:
Added a new test that fails without the fix: