AWS: Handling 'Cannot delete entity, must remove tokens from principal first' error
This blog post will be a quick one focusing on troubleshooting a less clear error, ‘Cannot delete entity, must remove tokens from principal first’, that Terraform can throw when you try to delete IAM users from AWS.
Let’s assume that in your Terraform configuration, you manage IAM users and you want to delete one of them. You’d think that by simply removing the Terraform code and then running terraform apply it will delete the users. Which was my case. But then as soon as I ran the command to destroy the resource I ran into an issue:
