2
votes

I am trying to use a terraform destroy job but get ResourceNotFoundException. This is because the resources is already deleted in the previous job. Is there a way where terraform can ignore that the resource is deleted and destroy rest of infrastructure.

Example :- Dynamo table was deleted in the previous job and in the next job I want to delete the policy and role attached to it.

Error retrieving DynamoDB table: ResourceNotFoundException: Requested resource not found: Table

1

1 Answers

1
votes

Sounds like if the resource is gone, but Terraform thinks it still exists to delete, your best bet is simply to update the state file to match.

terraform state rm <your_dynamo_table_resource>

https://www.terraform.io/docs/commands/state/rm.html