Skip to main content

Aws

AWS: Handling 'Cannot delete entity, must remove tokens from principal first' error

·5 mins
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:

Terraform: Handling the deletion of a non-empty AWS S3 Bucket

·4 mins
This article applies to Terraform v1.1.4 When using Terraform to manage your infrastructure you will end up in the situation when you want to remove some resources. You can do this in several ways, but most of the time you can also just remove the Terraform configuration by commenting it out the code, or removing the calling of the module, run terraform apply and it will get rid of the resources.