Cannot access cluster that was terminated or unpinned

I created a databricks cluster (azure) using terraform before, and the cluster was deleted because I didn’t use it for a long time and it was not pinned. Now I cannot run terraform plan because of the error message:

Error: Cannot access cluster xxx that was terminated or unpinned more than 30 days ago.

I tried terraform refresh and adding ignore_changes in the cluster resource but none of them worked (with the same error).
Has anyone experienced the same issue and know how to solve it?

Hi @soni,

If the provider isn’t able to automatically detect that the object was deleted during planning then you can force Terraform to “forget” the object (remove it from the state but don’t try to delete it) using the terraform state rm command.

To do this you’ll need to know the resource address of the resource instance representing that object in Terraform. That’s hopefully included in the error message, but if not then you should be able to find it by running terraform show and looking at the comment annotation just above the relevant block of its output.

1 Like

It worked, thank you! :slight_smile: