I’ve been stuck for a couple of months trying to complete the Pluralsight terraform training. I’m on the section for the modules, and I’m getting the error below.
Could not download module "vpc" (network.tf:12) source code from "git::https://github.com/terraform-aws-modules/terraform-aws-vpc?ref=v3.14.2": error downloading
│ 'https://github.com/terraform-aws-modules/terraform-aws-vpc?ref=v3.14.2': C:\Program Files\Git\cmd\git.exe exited with 128: Cloning into '.terraform\modules\vpc'...
│ fatal: unable to access 'https://github.com/terraform-aws-modules/terraform-aws-vpc/': SSL certificate problem: unable to get local issuer certificate
│ .
This is the first part of the network.tf file below. I actually copied all the contents from the corresponding solution directory to ensure syntax was correct.
# NETWORKING #
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
version = "~> 3.0"
cidr = var.vpc_cidr_block
azs = slice(data.aws_availability_zones.available.names, 0, (var.vpc_subnet_count))
public_subnets = [for subnet in range(var.vpc_subnet_count) : cidrsubnet(var.vpc_cidr_block, 8, subnet)]
enable_nat_gateway = false
enable_dns_hostnames = var.enable_dns_hostnames
map_public_ip_on_launch = var.map_public_ip_on_launch
tags = merge(local.common_tags, {
Name = "${local.name_prefix}-vpc"
})
I would greatly appreciate any help as I cannot continue with the training to get my certification.
OS Windows 10 Enterprise
Hi @royce.bussey,
Unfortunately it seems that this error is really coming from the Git executable rather than from Terraform, and Terraform is just relying the message back to you. That means this isn’t an error I have an immediate explanation for based on my Terraform knowledge. 
Terraform is internally truing to run a git clone
command line to ask Git to retrieve the contents of the repository that this module belongs to, so it’ll be running a command something like this:
C:\Program Files\Git\cmd\git.exe clone https://github.com/terraform-aws-modules/terraform-aws-vpc.git
I suspect that if you run this command directly yourself you’ll see the same error, which will confirm that the error is coming from Git rather than Terraform. If it does work when you run that command directly, please let me know! (If it succeeds then it will also create a subsdirectory called terraform-aws-vpc
containing the module source code, which you can delete because Terraform doesn’t expect to find the module at that location.)
Because I don’t have direct experience with running Git on Windows, I tried searching online to find other questions about this error message. I found a question on Stack Overflow which has a popular answer which talks about reconfiguring Git to use a different “SSL Backend” to handle connections to TLS/HTTPS servers, which you could enable with a command like this (copied directly from that other answer):
git config --global http.sslbackend schannel
Can you try running that and then retry the Git command I mentioned above to see if it begins working? Once you can see it work to run git clone
directly, I expect that Terraform should then also be able to run Git to retrieve this module.
Thank you so much for your help. I’ve been struggling with this for a while on top of learning other technologies. When trying to run the first command, I got the SSL error.
c:\Program Files\Git\cmd>git.exe clone GitHub - terraform-aws-modules/terraform-aws-vpc: Terraform module which creates VPC resources on AWS 🇺🇦
Cloning into ‘terraform-aws-vpc’…
fatal: unable to access ‘GitHub - terraform-aws-modules/terraform-aws-vpc: Terraform module which creates VPC resources on AWS 🇺🇦’: SSL certificate problem: unable to get local issuer certificate
After running the command from stack overflow, that resolved the issue.
c:\Program Files\Git\cmd>git config --global http.sslbackend schannel
c:\Program Files\Git\cmd>git.exe clone GitHub - terraform-aws-modules/terraform-aws-vpc: Terraform module which creates VPC resources on AWS 🇺🇦
Cloning into ‘terraform-aws-vpc’…
remote: Enumerating objects: 2391, done.
remote: Counting objects: 100% (15/15), done.
remote: Compressing objects: 100% (11/11), done.
remote: Total 2391 (delta 4), reused 12 (delta 3), pack-reused 2376
Receiving objects: 100% (2391/2391), 884.55 KiB | 3.30 MiB/s, done.
Resolving deltas: 100% (1469/1469), done.
Thanks again for your quick response and ability to point me in the right direction.