💻 Tech
Sometimes, the quick solution is just to remove offending item from the state. The command below removes the auth action postloginaction1 from the state. As expected, when you remove a resource declaration and perform a plan and apply, the process is smooth. But in my case, when I created a postlogin action and then switched to a different branch that doesn’t that resource configuration then try to perform plan, it reports that it will destroy the postlogin action. But when I hit apply, terraform said Error: 409 Conflict: Unable to delete an action bound to a trigger.. I was confused because the postlogin action does exist and it’s connected to the trigger in the dashboard, and terraform is supposed to delete the association to the trigger first before deleting the action (which I assumed). Since I was expecting those resources to be deleted anyway, I used the terraform command below. I think that command is useful in this kind of scenario where you know what item you want to delete and you don’t want to waste more time figuring out what went wrong, which who knows what, it can be a bug of the tool.
terraform state rm auth0_action.postloginaction1