Skip to content
This repository has been archived by the owner on Jun 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1481 from kinvolk/imran/increase-terraform-parall…
Browse files Browse the repository at this point in the history
…elism

pkg/terraform: increase the default parallelism
  • Loading branch information
ipochi authored Jun 18, 2021
2 parents 421f9ae + fcaaec0 commit 340a424
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions pkg/platform/aks/aks.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func (c *config) Apply(ex *terraform.Executor) error {
return err
}

return ex.Apply(nil)
return ex.Apply([]string{terraform.WithParallelism})
}

// ApplyWithoutParallel applies Terraform configuration without parallel execution.
Expand All @@ -301,7 +301,7 @@ func (c *config) ApplyWithoutParallel(ex *terraform.Executor) error {
return fmt.Errorf("initializing Terraform configuration: %w", err)
}

return ex.Apply([]string{"-parallelism=1"})
return ex.Apply([]string{terraform.WithoutParallelism})
}

// Destroy destroys AKS infrastructure via Terraform.
Expand Down
4 changes: 2 additions & 2 deletions pkg/platform/aws/aws.go
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ func (c *config) Apply(ex *terraform.Executor) error {
return err
}

return ex.Apply(nil)
return ex.Apply([]string{terraform.WithParallelism})
}

// ApplyWithoutParallel applies Terraform configuration without parallel execution.
Expand All @@ -149,7 +149,7 @@ func (c *config) ApplyWithoutParallel(ex *terraform.Executor) error {
return fmt.Errorf("initializing Terraform configuration: %w", err)
}

return ex.Apply([]string{"-parallelism=1"})
return ex.Apply([]string{terraform.WithoutParallelism})
}

func (c *config) Destroy(ex *terraform.Executor) error {
Expand Down
4 changes: 2 additions & 2 deletions pkg/platform/baremetal/baremetal.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func (c *config) Apply(ex *terraform.Executor) error {
return err
}

return ex.Apply(nil)
return ex.Apply([]string{terraform.WithParallelism})
}

// ApplyWithoutParallel applies Terraform configuration without parallel execution.
Expand All @@ -126,7 +126,7 @@ func (c *config) ApplyWithoutParallel(ex *terraform.Executor) error {
return fmt.Errorf("initializing Terraform configuration: %w", err)
}

return ex.Apply([]string{"-parallelism=1"})
return ex.Apply([]string{terraform.WithoutParallelism})
}

func (c *config) Destroy(ex *terraform.Executor) error {
Expand Down
4 changes: 2 additions & 2 deletions pkg/platform/packet/packet.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ func (c *config) Apply(ex *terraform.Executor) error {
return err
}

return c.terraformSmartApply(ex, c.DNS, nil)
return c.terraformSmartApply(ex, c.DNS, []string{terraform.WithParallelism})
}

// ApplyWithoutParallel applies Terraform configuration without parallel execution.
Expand All @@ -224,7 +224,7 @@ func (c *config) ApplyWithoutParallel(ex *terraform.Executor) error {
return fmt.Errorf("initializing Terraform configuration: %w", err)
}

return c.terraformSmartApply(ex, c.DNS, []string{"-parallelism=1"})
return c.terraformSmartApply(ex, c.DNS, []string{terraform.WithoutParallelism})
}

func (c *config) Destroy(ex *terraform.Executor) error {
Expand Down
4 changes: 2 additions & 2 deletions pkg/platform/tinkerbell/tinkerbell.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (c *Config) Apply(ex *terraform.Executor) error {
return err
}

return ex.Apply(nil)
return ex.Apply([]string{terraform.WithParallelism})
}

// ApplyWithoutParallel applies Terraform configuration without parallel executions.
Expand All @@ -171,7 +171,7 @@ func (c *Config) ApplyWithoutParallel(ex *terraform.Executor) error {
return fmt.Errorf("initializing Terraform configuration: %w", err)
}

return ex.Apply([]string{"-parallelism=1"})
return ex.Apply([]string{terraform.WithoutParallelism})
}

// Destroy destroys Terraform managed resources.
Expand Down
5 changes: 5 additions & 0 deletions pkg/terraform/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ const (
requiredVersion = ">= 0.13, < 0.14"

noOfLinesOnError = 20

// WithoutParallelism sets the parallelism value to 1.
WithoutParallelism = "-parallelism=1"
// WithParallelism sets the parallelism value to 100.
WithParallelism = "-parallelism=100"
)

// ErrBinaryNotFound denotes the fact that the Terraform binary could not be
Expand Down

0 comments on commit 340a424

Please sign in to comment.