queglay
November 18, 2023, 3:26am
1
In a basic minimal AWS VPC test, it takes 10 seconds for ci every time to run terraform init every time.
This seems unnecessary if the result is cached, and the versions inputs and results are cached. So why can’t terraform init use serialisation on the local cache and inputs to determine quickly if terraform init is required again? Terraform init should be instant if the result output in .terraform is the same.
Perhaps I’m not getting the nuance of why this command shouldn’t be much faster though…
opened 12:58PM - 29 Dec 20 UTC
bug
v0.13
waiting for reproduction
v0.15
v1.0
v1.2
Terraform init takes forever and it seems like it is due to provider download. T… his extremely slow behaviour is consistent for the last 2 days. Working like that is hellish as I'm using terragrunt which runs the `terraform init` command often in my case.
Drilling down on the trace logs, I've seen that the download of https://releases.hashicorp.com/terraform-provider-aws/3.22.0/terraform-provider-aws_3.22.0_darwin_amd64.zip takes usually 1-5 minutes minimum. When I simply download this url in my browser, it never takes more than 15 seconds....usually less than 10. When I run the `init` command with trace logs, it is almost *always* takes many many minutes to finish.
I have no internet issues at ALL <img width="645" alt="Screen Shot 2020-12-29 at 2 55 49 PM" src="https://user-images.githubusercontent.com/3888998/103285144-f3b50f80-49e5-11eb-8aa2-87e77c589fe5.png">
### Terraform Version
```
Terraform v0.13.5
+ provider registry.terraform.io/hashicorp/aws v3.22.0
```
### Terraform Configuration Files
I have created only one file in my example project, `backend.tf` and this is the its content
```# Generated by Terragrunt. Sig: nIlQXj57tbuaRZEa
terraform {
backend "s3" {
encrypt = true
key = "staging/elastic_beanstalk/terraform.tfstate"
profile = "some-profile"
region = "us-east-1"
bucket = "company-terraform-state"
dynamodb_table = "terraform-lock-table"
}
}
```
### Debug Output
https://gist.github.com/AlmogCohen/b8af6e33c170c393a63e126226ad7108
### Crash Output
Not relevant
### Expected Behavior
Terraform provider download should take as fast as it takes in the browser, and terraform init should not take 5 minutes for a very very simple terraform proejct
### Actual Behavior
Terraform provider/plugin downloads takes forever
### Steps to Reproduce
1. `terraform init`
### Additional Context
I'm using terragrunt, so the `init` command runs often on one of my dependency projects. It doesn't really matter for this bug report because I've run the `terraform` command directly in a folder which has only `tf` files in.
### References
Not relevant
queglay
November 18, 2023, 4:04am
2
Short of this feature existing is there any logic I could apply in ci to determine what conditions should trigger init and update a cache in circle ci?