Lin Hao Li
Lin Hao Li

Reputation: 13

How to destroy resources in Terraform?

I have created resources in different workspace in terraform but not able to destroy resource from one specific workspace. Is there any way to destroy resources by specifying workspace? I have switched to that specific workspace while destroying resources but it is still pointing to other workspace state file.

Upvotes: 1

Views: 717

Answers (1)

Kumar Vivek
Kumar Vivek

Reputation: 381

You have to first select the workspace with the following command

terraform workspace select <workspace_name>

Then you can destroy the workspace with

terraform destroy -refresh=false

if you want to list the workspaces created use

terraform workspace list

Upvotes: 2

Related Questions