terraform-provider-aws: Error-deleting-CloudWatch-Rule in provider.aws v3.28.0
Terraform CLI and Terraform AWS Provider Version
Terraform v0.12.26
- provider.aws v3.28.0
- provider.template v2.2.0
Linked/Known issue but closed earlier: https://github.com/hashicorp/terraform-provider-aws/issues/1479
Affected Resource(s)
AWS Cloudwatch Event Rule not deleted
Expected Behavior
Should delete the Cloudwatch(CW) Event Rule after Removing the targets from the Rule. Also note, it should not delete the targets but it has to remove the target from the Rule.
Actual Behavior
Not deleting the CW Event rule and failed with below error.
Error: error deleting CloudWatch Events Rule (dev-es-cluster-alert): ValidationException: Rule can't be deleted since it has targets.
status code: 400
Steps to Reproduce
- Create the CW Event Rule with target SNS policy P.S: SNS policy is already created and available
- Delete the CW Event Rule via terraform
- Should see, terraform will delete other resources but will not delete the CW event rule
Are there any other GitHub issues (open or closed) or pull requests that should be linked here? Vendor documentation? For example:
This is the existing known issue but fixed in this URL.
https://github.com/hashicorp/terraform-provider-aws/issues/1479
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 47
- Comments: 16 (1 by maintainers)
This issue has been open since April 2021. Any solutions or even workarounds ???
Thanks
Error: error deleting EventBridge Rule (xxxxx-admin_rs_broadcast): ValidationException: Rule can’t be deleted since it has targets. status code: 400
Yep, also issue for me. Only option is to delete the CloudWatch event bridge rule and then re apply terraform 😕
The same problem persists in version 5.11. The workaround by @stevebosman, unfortunately, didn’t work for me.
I have the same problem. Trying to figure out a workaround…