Terraspace and Azure Devops - multi-pipeline options?

Hi All

We’re using terraspace in Azure Devops pipelines to build environments but are finding terraspace “all” builds taking an inordinate amount of time due to the amount of layers it has to go through.

We’d like to try and optimise this by running each layer as a separate pipeline and only running ones which will make planned changes to the infrastructure. Since we are using a dedicated terraform state for each layer, running in parallel should be possible - excepting that we need to get the ordering correct.

However, my understanding is that we can find the order and whether each will make any changes from “terraspace all graph” and “terraspace all plan” but the output formats from these aren’t particularly parsable for making decisions over.

We were wondering if there was any way to output the list of the batches that should be run, including any ordering. So that we can parse it and fire any we want to run as independent “terraspace up” jobs (and not fire off any that the plan says already match the infrastructure perhaps)?

Any suggestions gratefully received


Currently, there’s no machine friendly output for terraspace all graph. Thinking maybe something like

 terraspace all graph --format json

Unsure what would make a decent structure for parsing.

Will review and consider PRs for this. Relevant source code: https://github.com/boltops-tools/terraspace/blob/d7df6c197b646055d0f0eaf6056036f332b993d7/lib/terraspace/all/grapher.rb#L13 No sweat either way of course. Thanks!

1 Like