Loading...
Loading...
### Terraform Version ```shell v1.11.3 ``` ### Terraform Configuration Files ```terraform ``` ### Debug Output ``` ``` ### Expected Behavior Running unit tests in a DevOps pipeline for a custom vm_windows module. My main configuration file contains a for_each loop with the config for 4 VMs, each with different values so the unit tests can test all cases. One of these values is the availability_set_id, to fill in this value a created availability_set is necessary to get the id from, I do this by creating an availability_set resource just above the for_each loop. The problem with this is that the pipeline ends up failing (even though all tests pass) because terraform test tries to destroy the availability_set before destroying the VMs (because it’s above the VMs in the main.tf file, which isn’t possible so terraform test throws an error and leaves the availability_set in state). Creating the availability_set after the VMs is also not an option since the VM config needs an ID to be valid. I solved this issue by adding a depends_on block to my main.tf file so the configuration recognizes that the AS needs to be created before, and destroyed after the VMs. ### Actual Behavior The problem here is that the **test time to run increases substantially**, from about 10 seconds per test, to 3-5min per test, making my entire pipeline take around 20-25mins! ### Steps to Reproduce 1. `terraform init` 2. create config files using a depends on function 3. create tests 4. `terraform test` ### Additional Context Some configuration code and extra context has been submitted through email to @crw due to my organizations policy on sharing internal code publicly. ### References _No response_ ### Generative AI / LLM assisted development? _No response_
Click on a version to see all relevant bugs
Terraform Integration
Learn more about where this data comes from
Bug Scrub Advisor
Streamline upgrades with automated vendor bug scrubs
BugZero Enterprise
Wish you caught this bug sooner? Get proactive today.