8000 Terraform test: Is teardown parallelized? · Issue #37156 · hashicorp/terraform · GitHub
Skip to content
Terraform test: Is teardown parallelized? #37156
Open
@jamiekt

Description

@jamiekt

Terraform Version

1.12

Use Cases

We have a terraform module that creates AWS RDS instances. We are using terraform test to test that module for which we have 5 run blocks.

I note that terraform 1.12 now has the ability to run tests in parallel so I’ve been playing around with that. Simply from examining behaviour on the AWS console I’ve observed something that seems strange. In a nutshell, the creation of resources seems to happen in parallel but the teardown seems to still be sequential. Hopefully screenshots will help explain.

When I run my 5 tests (all of which create a primary, 4 of which create a replica) they’ll all getting created at the same time (i.e. in parallel):

Image

The teardown though seems sequential as these screenshots suggest:

Image

Image

Image

Image

As you can see, all the instances are getting deleted one at a time.

Is this expected behaviour? Why doesn’t terraform teardown all instances at the same time?

Inexplicably by parallelizing my tests they’re not actually completing any quicker, total execution time both before and after parallelizing is around about 57 minutes. Given all the instances are being created simultaneously I can’t understand this, but clearly the sequential teardown isn’t helping. I can observe from the GitHub Actions logs that the teardown begins after about 23 minutes.

Can anyone shed any light on why teardown seems to be sequential instead of parallelized?

Thanks in advance

Attempted Solutions

As explained above

Proposal

I'd like teardown to be parallelizable which it seems it is not in 1.12 (unless I'm doing something wrong - which is very possible)

References

I also raised this here: https://discuss.hashicorp.com/t/terraform-test-is-teardown-parallelized/75124/1 and was advised to come and raise an issue

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    0