0
votes

anyone knows if we can use terraform delete rds instance? There is a destroy command https://www.terraform.io/docs/commands/destroy.html but I'm not sure

2

2 Answers

0
votes

Without knowing what your terraform looks like and from the way you've worded your question I'm unsure if you have any, however, if you created the RDS instance via Terraform, then running terraform destroy will delete the RDS instance.

If you didn't create the instance in Terraform, you can import the instance and then run the terraform destroy command.

You can import by running the running the command shown here.

0
votes

I have similar answer to @Nate. However I believe it is important to mention.

If you have your backend configured make sure you have the correct state file. This is usually done by running

terraform init

To remove the RDS and the resources you have created using terraform you should run the following;

terraform destroy -var-file=<name-of-the-file-with-vars> -auto-approve

It is important to provide the var-file and not to enter it manually.

Hope that helps slightly as well.