# Terraform init throws error : Error: Failed to download module

**URL:** <https://discuss.hashicorp.com/t/terraform-init-throws-error-error-failed-to-download-module/23892>\
**Category:** Terraform\
**Created:** [April 30, 2021, 12:11pm UTC](https://discuss.hashicorp.com/t/terraform-init-throws-error-error-failed-to-download-module/23892 "2021-04-30T12:11:43Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Snehil03](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/snehil03/32/15574_2.png) [@Snehil03](https://discuss.hashicorp.com/u/Snehil03)\
**Post date:** [April 30, 2021, 12:11pm UTC](https://discuss.hashicorp.com/t/terraform-init-throws-error-error-failed-to-download-module/23892/1 "2021-04-30T12:11:43Z")

</div>

Hello,

I am facing issue with respect to running terraform init in Bitbucket Pipelines, wheras these code works on local machine.  
Terraform init does not run successfully on Bitbucket pipelines during initial first run.

- terraform init  
Initializing modules…

- aws-services in …/…/modules/aws-services
- cluster in …/…/modules/cluster  
Downloading terraform-aws-modules/eks/aws 12.2.0 for cluster.eks…  
Downloading terraform-aws-modules/vpc/aws 3.0.0 for cluster.vpc…
- elasticsearch in …/…/modules/elasticsearch
- ingress in …/…/modules/ingress
- ingress.letsencrypt\_issuers in …/…/modules/k8s\_manifest
- ingress.wildcard-domain-certificate in …/…/modules/wildcard-certificate
- ingress.wildcard-domain-certificate.k8s\_manifest\_domain\_wildcard in …/…/modules/k8s\_manifest
- ingress.wildcard-subdomain-certificate in …/…/modules/wildcard-certificate
- ingress.wildcard-subdomain-certificate.k8s\_manifest\_domain\_wildcard in …/…/modules/k8s\_manifest
- k8s\_cluster\_config in …/…/modules/k8s\_cluster\_config
- k8s\_cluster\_config.k8s\_pod\_network\_policies in …/…/modules/k8s\_manifest
- k8s\_cluster\_config.k8s\_pod\_security\_policy in …/…/modules/k8s\_manifest
- kubed in …/…/modules/kubed
- monitoring in …/…/modules/monitoring  
Error: Failed to download module  
Could not download module “eks” (…/…/modules/cluster/eks.tf:1) source code  
from  
“git::[GitHub - terraform-aws-modules/terraform-aws-eks at v12.2.0](https://github.com/terraform-aws-modules/terraform-aws-eks?ref=v12.2.0)”:  
error downloading  
‘[GitHub - terraform-aws-modules/terraform-aws-eks at v12.2.0](https://github.com/terraform-aws-modules/terraform-aws-eks?ref=v12.2.0)’: git  
must be available and on the PATH.  
Error: Failed to download module  
Could not download module “vpc” (…/…/modules/cluster/vpc.tf:1) source code  
from  
“git::[GitHub - terraform-aws-modules/terraform-aws-vpc at v3.0.0](https://github.com/terraform-aws-modules/terraform-aws-vpc?ref=v3.0.0)”:  
error downloading  
‘[GitHub - terraform-aws-modules/terraform-aws-vpc at v3.0.0](https://github.com/terraform-aws-modules/terraform-aws-vpc?ref=v3.0.0)’: git  
must be available and on the PATH.  
Error: Failed to download module  
Could not download module “eks” (…/…/modules/cluster/eks.tf:1) source code  
from  
“git::[GitHub - terraform-aws-modules/terraform-aws-eks at v12.2.0](https://github.com/terraform-aws-modules/terraform-aws-eks?ref=v12.2.0)”:  
error downloading  
‘[GitHub - terraform-aws-modules/terraform-aws-eks at v12.2.0](https://github.com/terraform-aws-modules/terraform-aws-eks?ref=v12.2.0)’: git  
must be available and on the PATH.

I saw these bug reported multiple times and solution provided  
[https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/versions.tf](https://github.com/terraform-aws-modules/terraform-aws-eks/blob/master/versions.tf)  
but even after the changes suggested not able to run it via CI server : Bitbucket

```
local configurations

terraform version
Terraform v0.13.2

* provider registry.terraform.io/carlpett/sops v0.6.2
* provider registry.terraform.io/hashicorp/aws v3.37.0
* provider registry.terraform.io/hashicorp/external v2.1.0
* provider registry.terraform.io/hashicorp/helm v2.1.2
* provider registry.terraform.io/hashicorp/kubernetes v2.1.0
* provider registry.terraform.io/hashicorp/local v2.1.0
* provider registry.terraform.io/hashicorp/null v3.1.0
* provider registry.terraform.io/hashicorp/random v3.1.0
* provider registry.terraform.io/hashicorp/template v2.2.0
* provider registry.terraform.io/hashicorp/tls v3.1.0
```

---

<div class="post-metadata">

**Author:** ![jbardin](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/jbardin/32/3325_2.png) [@jbardin](https://discuss.hashicorp.com/u/jbardin)\
**Post date:** [April 30, 2021, 12:56pm UTC](https://discuss.hashicorp.com/t/terraform-init-throws-error-error-failed-to-download-module/23892/2 "2021-04-30T12:56:20Z")

</div>

Hi @Snehil03,

The “`git must be available and on the PATH`” error indicates that you do not have git installed in the PATH on the system you are using. You will need `git` to be installed if you want to use modules that are fetched via git.

---

<div class="post-metadata">

**Author:** ![Snehil03](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/snehil03/32/15574_2.png) [@Snehil03](https://discuss.hashicorp.com/u/Snehil03)\
**Post date:** [April 30, 2021, 4:16pm UTC](https://discuss.hashicorp.com/t/terraform-init-throws-error-error-failed-to-download-module/23892/3 "2021-04-30T16:16:39Z")

</div>

Hi @jbardin Indeed git was missing added it , made few more changes now this thing fly,  
thanks !

---

<div class="post-metadata">

**Author:** ![nitin194](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/nitin194/32/28507_2.png) [@nitin194](https://discuss.hashicorp.com/u/nitin194)\
**Post date:** [June 1, 2022, 7:06am UTC](https://discuss.hashicorp.com/t/terraform-init-throws-error-error-failed-to-download-module/23892/4 "2022-06-01T07:06:22Z")

</div>

Thanks, this answer helped me resolve my issue 😀

---

<div class="post-metadata">

**Author:** ![royal-ramesh](https://sea2.discourse-cdn.com/hashicorp/user_avatar/discuss.hashicorp.com/royal-ramesh/32/37366_2.png) [@royal-ramesh](https://discuss.hashicorp.com/u/royal-ramesh)\
**Post date:** [August 13, 2023, 7:55am UTC](https://discuss.hashicorp.com/t/terraform-init-throws-error-error-failed-to-download-module/23892/5 "2023-08-13T07:55:51Z")

</div>

@jbardin Thanks!!. It really help’s for beginner’s
