Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

terraform remove specific resource by id

When i run terraform apply it creates a droplet on digitalOcean, and soon as it creates, i I am removing the terrafrom.tfstate file and all the file that created after droplet luanch. and i am saving that info in a database.

Now i want to delete certain resource by its resource id or urn or uuid. is it possible?

I am saving these info in database.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

enter image description here

>Solution :

Instead of removing the tf state, you should just copy it to the database

Then to remove a specific resource

terraform destroy -target TYPE.NAME

In your case

terraform destroy -target digitalocean_droplet.web
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading