Skip to content

Commit

Permalink
terraform parralelism flag
Browse files Browse the repository at this point in the history
  • Loading branch information
userbradley committed Sep 7, 2023
1 parent 41cf9ff commit 8ed7802
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 0 deletions.
35 changes: 35 additions & 0 deletions docs/automation/iac/terraform/terraform-refresh-takes-ages.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Terraform refresh takes ages
---

## What

This can happen with both Terraform and Terragrunt, so this applies to al

The issue is when running a `terraform plan` the plan will sit at the below for ages

```text
...
google_folder.sandbox: Refreshing state... [id=folders/<>]
...
^CStopping operation...
```

This happens because terraform sucks at walking the graph

## Solution

Set the [`parallelism` flag to 20](https://developer.hashicorp.com/terraform/cli/commands/apply#parallelism-n) and disable a refresh


=== "Terraform"

```shell
terraform plan -parallelism=20 -refresh=false
```

=== "Terragrunt"

```shell
terragrunt plan -parallelism=20 -refresh=false
```
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ nav:
- Remote Data: automation/iac/terraform/remote-data.md
- Terraform lock file update: automation/iac/terraform/terraform-lock-file-update.md
- "Terraform plugin Cannot locate module locally, unknown reason": automation/iac/terraform/terraform-plugin-cannot-locate-module-locally-unknown-reason.md
- Terraform refresh takes ages: automation/iac/terraform/terraform-refresh-takes-ages.md
- Terraform Sleep: automation/iac/terraform/terraform-sleep.md
- Terraform verbose: automation/iac/terraform/terraform-verbose.md
- tfupdate: automation/iac/terraform/tfupdate.md
Expand Down

0 comments on commit 8ed7802

Please sign in to comment.