From 7167d4e03b82a65db0bc94a4ad91ef42edb6cb2d Mon Sep 17 00:00:00 2001 From: Andrew Peabody Date: Thu, 20 Jun 2024 11:39:38 -0700 Subject: [PATCH] feat(tft): add WithParallelism() (#2424) Co-authored-by: Bharath KKB --- infra/blueprint-test/pkg/tft/terraform.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/infra/blueprint-test/pkg/tft/terraform.go b/infra/blueprint-test/pkg/tft/terraform.go index bb0bce9aee7..89c20e44bba 100644 --- a/infra/blueprint-test/pkg/tft/terraform.go +++ b/infra/blueprint-test/pkg/tft/terraform.go @@ -81,6 +81,7 @@ type TFBlueprintTest struct { teardown func(*assert.Assertions) // teardown function setupOutputOverrides map[string]interface{} // override outputs from the Setup phase tftCacheMutex *filemutex.FileMutex // Mutex to protect Terraform plugin cache + parallelism int // Set the parallelism setting for Terraform } type tftOption func(*TFBlueprintTest) @@ -173,6 +174,12 @@ func WithSetupOutputs(vars map[string]interface{}) tftOption { } } +func WithParallelism(p int) tftOption { + return func(f *TFBlueprintTest) { + f.parallelism = p + } +} + // NewTFBlueprintTest sets defaults, validates and returns a TFBlueprintTest. func NewTFBlueprintTest(t testing.TB, opts ...tftOption) *TFBlueprintTest { var err error @@ -308,6 +315,7 @@ func (b *TFBlueprintTest) GetTFOptions() *terraform.Options { MigrateState: b.migrateState, RetryableTerraformErrors: b.retryableTerraformErrors, NoColor: true, + Parallelism: b.parallelism, }) if b.maxRetries > 0 { newOptions.MaxRetries = b.maxRetries