Cannot connect to registry via VPN

I am learning how to use Terraform with AWS.

I am on a Mac (Darwin ARM64) and using terraform 1.6.6.

I can run terraform init for a project I have set up. However, when I turn on the company VPN I got the following error:

% terraform init          

Initializing the backend...

Initializing provider plugins...
- Finding hashicorp/aws versions matching "~> 4.16"...
╷
│ Error: Failed to query available provider packages
│ 
│ Could not retrieve the list of available versions for provider hashicorp/aws: could not connect to registry.terraform.io: failed to request discovery document: Get
│ "https://registry.terraform.io/.well-known/terraform.json": write tcp [2001:4c4d:2059:e000:acc6:e46b:716e:cd46]:53538->[2600:9000:21eb:5600:16:1aa3:1440:93a1]:443: write: socket is not
│ connected
╵

I saw that this is very similar to this problem: Error: Failed to query available provider packages – HashiCorp Help Center.

However, my terraform version is a later one (1.6.6) and setting the DNS to 8.8.8.8 does not help.

Hi @anovoszath,

The fact that there’s an IP address in this error message suggests that DNS worked correctly but that your system cannot reach the resolved IP address.

It’s not really possible to debug network configuration issues from outside of the system and network where they are occurring, and so I can’t give specific help and would suggest discussing this with the department in your company that runs the VPN to see if there’s any special configuration required.

However, one specific thing I noticed is that this is an IPv6 IP address instead of an IPv4 IP address, and that makes me wonder if your normal internet connection supports IPv6 but the company VPN does not, and so now Terraform is trying to use this resolved IPv6 address to connect through a connection path that cannot support IPv6. The VPN administrators can hopefully confirm whether the VPN supports IPv6, and therefore whether this is a reasonable hypothesis for what’s going on.

1 Like