IoT rules won't fire after being deployed

I’m having a problem when deploying to AWS. I have several IoT rules that get deployed using Serverless/CF. They deploy just fine but the rules do not fire when the appropriate trigger occurs. However, I can get the rule to work with a little manual intervention in the IoT console. All I do is open the rule, click edit on the query statement, and click update without changing anything. From here on out, the rule works just fine.

Subsequent deploys are hit or miss. If the rule is renamed, it will not fire until manually updated. If the stack is deleted and re-added, or renamed, the rules will not fire until manually updated. Normal subsequent deploys where nothing changes with the rule usually don’t hinder the rule, but I’m not sure if it works 100% of the time.

It’s become a large annoyance as our rule definition is changing very frequently.

Turns out I needed to grant the rule permission to invoke the lambda. When editing the rule in the console, it was adding the permission automatically, hence subsequent executions would succeed.