I'm using Terraform automation to create a CloudWatch rule that triggers an SNS topic when any ec2 instance changes its states.
The issue is that when I run the automation codebuild with new updates the rule sometimes triggers the SNS topic and sometimes not, in order to make it work I change the rule name or I play with the pattern of the rule manually like from this:
{
"detail-type": [
"EC2 Instance State-change Notification"
],
"source": [
"aws.ec2"
]
}
To this:
{
"source": [
"aws.ec2"
],
"detail-type": [
"EC2 Instance State-change Notification"
]
}
Any Idea why I'm facing this?