iateadonut
iateadonut

Reputation: 2239

terraform destroy specified resources concurrently

If I have a few different resources, I can destroy them all with one command like this:

terraform destroy -target=aws_instance.bake -target=aws_instance.ec2 -target=aws_db_instance.main

However, it destroys them sequentially, which might take a lot of time. I'm wondering how I can destroy them concurrently.

Upvotes: 0

Views: 697

Answers (1)

Paolo
Paolo

Reputation: 26074

terraform destroy is an alias for terraform apply -destroy, and terraform apply has a default -parallelism of 10, meaning terraform will process up to 10 resources at a time. So by default, terraform is already destroying the resources in parallel. You can of course change this argument to a lower or higher value as needed.

terraform however will not be able to delete resources in parallel when dependencies amongst them exist.

Upvotes: 3

Related Questions