Interview Prep/Terraform/Workflow and Providers

A production network has no internet access. How do you make `terraform init` work?

IntermediateScenarioWorkflow and Providers
Answer

Situation read → Providers are downloaded from the registry by default, which an air-gapped runner can't reach.

What I'd do →

  1. On a connected machine run terraform providers mirror ./mirror.
  2. Host that directory internally (filesystem or HTTPS network mirror).
  3. Point the CLI at it in ~/.terraformrc.
provider_installation {
  filesystem_mirror {
    path    = "/opt/terraform/providers"
    include = ["registry.terraform.io/*/*"]
  }
}

Why → A mirror gives reproducible, offline installs, and also protects you from a registry outage or a withdrawn release.

Interview tip → Mention that modules need a mirror too (internal Git or private registry), since terraform init fetches those separately.

All Terraform questions Roadmap: Terraform

More on Workflow and Providers