---
title: "Error: Failed to download module"
description: I get an error when using env0 with my existing Terraform code
---

[Skip to content](https://support.env0.com/migration/error-failed-to-download-module#main-content)

English

Show submenu for translations

![env0 logo - transparent.png\]](https://support.env0.com/hs-fs/hubfs/Logos/env0%20logo%20-%20transparent.png?height=40&name=env0%20logo%20-%20transparent.png)

- [Default HubSpot Blog](https://6165570.hs-sites.com/blog)

Open main navigation

Close main navigation

- [Default HubSpot Blog](https://6165570.hs-sites.com/blog)
- English
  
  Show submenu for translations
- [env0.com](https://www.env0.com/)

[env0.com](https://www.env0.com/)

 Hello, How can we help you?

- There are no suggestions because the search field is empty.

1. [Help Center](https://support.env0.com/migration?hsLang=en)
2. [Troubleshooting](https://support.env0.com/migration/troubleshooting?hsLang=en)

# Error: Failed to download module

## I get an error when using env0 with my existing Terraform code

If you are seeing an error something similar to: "Error: Failed to download module" this error message is coming from Terraform.  
Typically, this happens when you are referencing a module with a git source.

If the git source is using " https" - then you need to configure a git token in order for Terraform (or Terragrunt).  e.g. 

```
module "vpc" {   source = "git::https://example.com/vpc.git"}
```

> Terraform installs modules from Git repositories by running git clone, and so it will respect any local Git configuration set on your system, including credentials. To access a non-public Git repository, configure Git with suitable credentials for that repository

source: https://www.terraform.io/language/modules/sources#generic-git-repository

 

Alternatively, if the git source is using "ssh" - then you need to configure an SSH key and add it to your template.  See https://docs.env0.com/docs/ssh-keys for more details.

e.g. 

```
module "storage" {   source = "git::ssh://username@example.com/storage.git"}
```

 

- [Using env0](https://support.env0.com/migration/using-env0?hsLang=en#main-content)
  
  
  
  
  
    - [Self-Hosted Agent](https://support.env0.com/migration/using-env0?hsLang=en#self-hosted-agent)
    - [FAQ](https://support.env0.com/migration/using-env0?hsLang=en#faq)
- [Advanced](https://support.env0.com/migration/advanced?hsLang=en#main-content)
  
  
  
  
  
    - [VCS Integrations](https://support.env0.com/migration/advanced?hsLang=en#vcs-integrations)
    - [Remote State](https://support.env0.com/migration/advanced?hsLang=en#remote-state)
    - [Agent](https://support.env0.com/migration/advanced?hsLang=en#agent)
    - [Terragrunt](https://support.env0.com/migration/advanced?hsLang=en#terragrunt)
    - [AWS](https://support.env0.com/migration/advanced?hsLang=en#aws)
- [Troubleshooting](https://support.env0.com/migration/troubleshooting?hsLang=en)

- [Default HubSpot Blog](https://6165570.hs-sites.com/blog)

[![env zero logo](https://support.env0.com/hubfs/envzero_logo_black_rgb-2.svg "env zero logo")](https://www.env0.com)

env0 Help Center

<https://www.facebook.com/envzero/> <https://twitter.com/envZero> <https://www.linkedin.com/company/env0/> <https://www.youtube.com/channel/UC2rSNWiZ2bvIc5NalLTPjJA>

Copyright © 2026, env zero