Skip to content

Commit

Permalink
feat(tft): add WithParallelism()
Browse files Browse the repository at this point in the history
  • Loading branch information
apeabody committed Jun 15, 2024
1 parent eb4672b commit 5a7027b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions infra/blueprint-test/pkg/tft/terraform.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -173,6 +174,12 @@ func WithSetupOutputs(vars map[string]interface{}) tftOption {
}
}

func WithParallelism(vars int) tftOption {
return func(f *TFBlueprintTest) {
f.parallelism = vars
}
}

// NewTFBlueprintTest sets defaults, validates and returns a TFBlueprintTest.
func NewTFBlueprintTest(t testing.TB, opts ...tftOption) *TFBlueprintTest {
var err error
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 5a7027b

Please sign in to comment.