Skip to content

Terraform init is extremely slow #27379

Description

@AlmogCohen

Terraform init takes forever and it seems like it is due to provider download. This 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 Screen Shot 2020-12-29 at 2 55 49 PM

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

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions