Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parallelism not disabled on init when terraform plugin cache is used #3476

Open
loganmzz opened this issue Oct 16, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@loganmzz
Copy link

loganmzz commented Oct 16, 2024

Describe the bug

Document states:

The exception is the terraform init command, which is always executed sequentially if the terraform plugin cache is used.

However, I enabled plugin cache with environment variable TF_PLUGIN_CACHE_DIR and parallelism still apply (whatever it is specified or not).

Steps To Reproduce

Create stack with several Terragrunt modules and run:

export TF_PLUGIN_CACHE_DIR="$(pwd)/.tf-plugin-cache" &&
mkdir -p "${TF_PLUGIN_CACHE_DIR}" &&
terragrunt run-all init -reconfigure -upgrade &&
true

Expected behavior

Successful Terraform initialization of all Terragrunt modules without the famous:

  │ Error: Required plugins are not installed
  │ 
  │ The installed provider plugins are not consistent with the packages
  │ selected in the dependency lock file:
  │   - registry.terraform.io/hashicorp/aws: the cached package for registry.terraform.io/hashicorp/aws 5.72.0 (in .terraform/providers) does not match any of the checksums recorded in the dependency lock file
  │ 
  │ Terraform uses external plugins to integrate with a variety of different
  │ infrastructure services. To download the plugins required for this
  │ configuration, run:
  │   terraform init

Nice to haves

09:02:19.776 STDOUT [0001] terraform: Initializing the backend...
09:02:19.776 STDOUT [0002] terraform: Initializing the backend...
09:02:19.813 STDOUT [0003] terraform: Initializing the backend...
09:02:19.814 STDOUT [0004] terraform: Initializing the backend...
09:02:22.112 STDOUT [0004] terraform: 
09:02:22.112 STDOUT [0004] terraform: Successfully configured the backend "s3"! Terraform will automatically
09:02:22.112 STDOUT [0004] terraform: use this backend unless the backend configuration changes.
09:02:22.364 STDOUT [0002] terraform: 
09:02:22.364 STDOUT [0002] terraform: Successfully configured the backend "s3"! Terraform will automatically
09:02:22.364 STDOUT [0002] terraform: use this backend unless the backend configuration changes.
09:02:22.469 STDOUT [0001] terraform: 
09:02:22.469 STDOUT [0001] terraform: Successfully configured the backend "s3"! Terraform will automatically
09:02:22.469 STDOUT [0001] terraform: use this backend unless the backend configuration changes.
09:02:22.652 STDOUT [0003] terraform: 
09:02:22.652 STDOUT [0003] terraform: Successfully configured the backend "s3"! Terraform will automatically
09:02:22.652 STDOUT [0003] terraform: use this backend unless the backend configuration changes.
09:02:24.067 STDOUT [0004] terraform: Initializing provider plugins...
09:02:24.067 STDOUT [0004] terraform: - Finding latest version of hashicorp/aws...
09:02:24.519 STDOUT [0004] terraform: - Installing hashicorp/aws v5.72.0...
09:02:24.836 STDOUT [0002] terraform: Initializing provider plugins...
09:02:24.836 STDOUT [0002] terraform: - terraform.io/builtin/terraform is built in to Terraform
09:02:24.836 STDOUT [0002] terraform: - Finding hashicorp/kubernetes versions matching "2.24.0"...
09:02:25.261 STDOUT [0001] terraform: Initializing provider plugins...
09:02:25.261 STDOUT [0001] terraform: - terraform.io/builtin/terraform is built in to Terraform
09:02:25.261 STDOUT [0001] terraform: - Finding latest version of hashicorp/aws...
09:02:25.549 STDOUT [0001] terraform: - Finding alekc/kubectl versions matching "~> 2.0"...
09:02:25.678 STDOUT [0001] terraform: - Finding hashicorp/kubernetes versions matching "2.23.0"...
09:02:25.853 STDOUT [0003] terraform: Initializing provider plugins...
09:02:25.853 STDOUT [0003] terraform: - terraform.io/builtin/terraform is built in to Terraform
09:02:25.853 STDOUT [0003] terraform: - Finding hashicorp/helm versions matching "2.12.1"...
09:02:25.986 STDOUT [0001] terraform: - Finding hashicorp/helm versions matching "2.11.0"...
09:02:26.160 STDOUT [0003] terraform: - Finding alekc/kubectl versions matching "~> 2.0"...
09:02:26.286 STDOUT [0003] terraform: - Finding hashicorp/kubernetes versions matching "2.24.0"...
09:02:28.041 STDOUT [0002] terraform: - Finding hashicorp/helm versions matching "2.12.1"...
09:02:31.415 STDOUT [0003] terraform: - Finding latest version of hashicorp/aws...
09:02:31.939 STDOUT [0003] terraform: - Using previously-installed hashicorp/helm v2.12.1
09:02:31.943 STDOUT [0001] terraform: - Installing hashicorp/aws v5.72.0...
09:02:32.073 STDOUT [0003] terraform: - Using previously-installed alekc/kubectl v2.1.0
09:02:32.243 STDOUT [0003] terraform: - Using previously-installed hashicorp/kubernetes v2.24.0
09:02:33.163 STDOUT [0002] terraform: - Finding latest version of hashicorp/aws...
09:02:33.415 STDOUT [0002] terraform: - Using previously-installed hashicorp/kubernetes v2.24.0
09:02:33.551 STDOUT [0002] terraform: - Using previously-installed hashicorp/helm v2.12.1
09:02:33.827 STDOUT [0002] terraform: - Installing hashicorp/aws v5.72.0...
09:02:37.197 STDOUT [0004] terraform: - Installed hashicorp/aws v5.72.0 (signed by HashiCorp)
09:02:37.198 STDOUT [0004] terraform: Terraform has made some changes to the provider dependency selections recorded
09:02:37.198 STDOUT [0004] terraform: in the .terraform.lock.hcl file. Review those changes and commit them to your
09:02:37.198 STDOUT [0004] terraform: version control system if they represent changes you intended to make.
09:02:37.198 STDOUT [0004] terraform: Terraform has been successfully initialized!
09:02:37.198 STDOUT [0004] terraform: 
09:02:37.198 STDOUT [0004] terraform: You may now begin working with Terraform. Try running "terraform plan" to see
09:02:37.198 STDOUT [0004] terraform: any changes that are required for your infrastructure. All Terraform commands
09:02:37.198 STDOUT [0004] terraform: should now work.
09:02:37.198 STDOUT [0004] terraform: If you ever set or change modules or backend configuration for Terraform,
09:02:37.198 STDOUT [0004] terraform: rerun this command to reinitialize your working directory. If you forget, other
09:02:37.198 STDOUT [0004] terraform: commands will detect it and remind you to do so if necessary.
09:02:37.527 STDOUT [0003] terraform: - Installing hashicorp/aws v5.72.0...
09:03:02.970 STDOUT [0002] terraform: - Installed hashicorp/aws v5.72.0 (signed by HashiCorp)
09:03:02.970 STDOUT [0002] terraform: Terraform has made some changes to the provider dependency selections recorded
09:03:02.970 STDOUT [0002] terraform: in the .terraform.lock.hcl file. Review those changes and commit them to your
09:03:02.970 STDOUT [0002] terraform: version control system if they represent changes you intended to make.
09:03:02.971 STDOUT [0002] terraform: Terraform has been successfully initialized!
09:03:02.971 STDOUT [0002] terraform: 
09:03:02.971 STDOUT [0002] terraform: You may now begin working with Terraform. Try running "terraform plan" to see
09:03:02.971 STDOUT [0002] terraform: any changes that are required for your infrastructure. All Terraform commands
09:03:02.971 STDOUT [0002] terraform: should now work.
09:03:02.971 STDOUT [0002] terraform: If you ever set or change modules or backend configuration for Terraform,
09:03:02.971 STDOUT [0002] terraform: rerun this command to reinitialize your working directory. If you forget, other
09:03:02.971 STDOUT [0002] terraform: commands will detect it and remind you to do so if necessary.
09:03:08.418 STDOUT [0001] terraform: - Installed hashicorp/aws v5.72.0 (signed by HashiCorp)
09:03:08.571 STDOUT [0001] terraform: - Using previously-installed alekc/kubectl v2.1.0
09:03:08.700 STDOUT [0001] terraform: - Using previously-installed hashicorp/kubernetes v2.23.0
09:03:08.880 STDOUT [0001] terraform: - Using previously-installed hashicorp/helm v2.11.0
09:03:08.880 STDOUT [0001] terraform: Terraform has made some changes to the provider dependency selections recorded
09:03:08.880 STDOUT [0001] terraform: in the .terraform.lock.hcl file. Review those changes and commit them to your
09:03:08.880 STDOUT [0001] terraform: version control system if they represent changes you intended to make.
09:03:08.880 STDOUT [0001] terraform: Terraform has been successfully initialized!
09:03:08.880 STDOUT [0001] terraform: 
09:03:08.880 STDOUT [0001] terraform: You may now begin working with Terraform. Try running "terraform plan" to see
09:03:08.881 STDOUT [0001] terraform: any changes that are required for your infrastructure. All Terraform commands
09:03:08.881 STDOUT [0001] terraform: should now work.
09:03:08.881 STDOUT [0001] terraform: If you ever set or change modules or backend configuration for Terraform,
09:03:08.881 STDOUT [0001] terraform: rerun this command to reinitialize your working directory. If you forget, other
09:03:08.881 STDOUT [0001] terraform: commands will detect it and remind you to do so if necessary.

Versions

  • Terragrunt version: 0.68.1
  • OpenTofu/Terraform version: 1.9.7
  • Environment details (Ubuntu 20.04, Windows 10, etc.): WSL2 - Ubuntu 22.04

Additional context

N/A

@loganmzz loganmzz added the bug Something isn't working label Oct 16, 2024
@yhakbar
Copy link
Collaborator

yhakbar commented Oct 16, 2024

Hey @loganmzz , do you mind submitting a pull request to update the documentation that you found saying that?

The Provider Cache Server is what we recommend users use for concurrent access to provider cache across units (terragrunt.hcl files).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants