2
votes

I need to create a snapshot of EBS volume using Terraform. I also have to consider that if the EBS volume has previously snapshots or not. If the EBS volume contains some previous snapshots then i need to delete them from my Terraform code and create a new snapshot of EBS volume.

I am not sure if deletion of resources is possible through Terraform code. If it is possible, how can i delete the previous snapshots and create new snapshot of EBS volume with Terraform.

1

1 Answers

1
votes

No it is not possible. However if the previous snapshots were created by terraform, than running terraform destroy before applying the latest version would do the job. But if those snapshots were created by other means than terraform, deleting them using terraform isn't possible at all.