Interview Prep/Terraform/Modules, Variables, Sensitive Values and Workspaces

`Error: Failed to download module` — `git::https://github.com/acme/tf-modules.git?ref=v2.3.0 ... exit status 128` in CI, works locally.

IntermediateTroubleshootingModules, Variables, Sensitive Values and Workspaces
Answer

Likely causes → Private repo and the CI runner has no Git credentials (your laptop uses your SSH key or credential helper); the tag doesn't exist; SSH host key not trusted.

Diagnose →

git ls-remote https://github.com/acme/tf-modules.git v2.3.0
GIT_TERMINAL_PROMPT=0 git clone https://github.com/acme/tf-modules.git /tmp/m

Fix → Give the job a token via Git config:

git config --global url."https://x-access-token:${GH_TOKEN}@github.com/".insteadOf "https://github.com/"

or an SSH deploy key with known_hosts. Push the missing tag if needed.

Prevent → Publish internal modules to a private registry (HCP Terraform, Artifactory, GitLab) with versioned releases.

All Terraform questions Roadmap: Terraform

More on Modules, Variables, Sensitive Values and Workspaces