Skip to content

[Module 1] Terraform Geo-blocking Error in Iraq - Invalid provider registry #124

@tahanawfal

Description

@tahanawfal

Course

data-engineering-zoomcamp

Question

If you are accessing Terraform from a restricted region (e.g., Iraq), you may be unable to reach the registry, resulting in initialization errors.

Error Message:

│ Error: Invalid provider registry host
│
│ The host "registry.terraform.io" given in provider source address "registry.terraform.io/hashicorp/google" does not offer a Terraform provider registry. 
╵
│ Error: Failed to query available provider packages
│
│ Could not retrieve the list of available versions for provider hashicorp/google: could not connect to registry.terraform.io: failed to request discovery      
│ document: Get "https://registry.terraform.io/.well-known/terraform.json": proxyconnect tcp: dial tcp: lookup http: no such host

Answer

This error occurs because the connection to registry.terraform.io is blocked.

  • Important: Using a VPN browser extension is often not sufficient. Extensions typically only proxy traffic within the web browser, leaving your terminal/VS Code connection blocked.
  • Fix: Install and activate a system-wide VPN software (e.g., Proton VPN, which is free and open source). This ensures that traffic from your terminal (where terraform init runs) is correctly routed through the VPN.
  • Once the system-wide VPN is active, run terraform init again.

Checklist

  • I have searched existing FAQs and this question is not already answered
  • The answer provides accurate, helpful information
  • I have included any relevant code examples or links

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions