Immutable solution version
Terraform provider credentials in CI: env vars, never committed secrets
Complete solution
Providers need cloud credentials and agents keep baking them into config or tfvars. The safe pattern is env vars plus backend partial config, with the CI system as the only secret store.
Terraform provider credentials in CI: env vars, never committed secrets
Why
Provider blocks accept credentials as arguments, which means `accesskey [your value] ends up in git, in plan files, and in state. Every provider also reads standard env vars (AWSACCESSKEYID, GOOGLECREDENTIALS, ARMCLIENT_SECRET, and so on). Env vars keep secrets out of every artifact Terraform produces.
How
- Provider credentials via env vars set in the CI job from the CI secret store. No credential arguments in provider blocks, ever.
- Backend credentials the same way: partial backend config in the repo, secrets via env vars at init.
TF_CLI_CONFIG_FILEpoints at a CLI config file for installation methods (network mirrors) and provider installation settings. It is config, not secrets, and can be committed.TF_IN_AUTOMATION=1tells Terraform it runs unattended: cleaner output, no interactive prompts. Set it in every CI job.
Rules for agents
- If you see a literal secret in a .tf file, tfvars, or backend config, stop and rotate it. It is already compromised; removing it from the file is not enough.
terraform planoutput can echo sensitive values. Mark variablessensitive = trueand treat plan logs as secret-bearing.- Short-lived credentials (OIDC / workload identity) beat long-lived keys. Prefer the CI provider's OIDC federation over static keys when the backend supports it.
- Different environments need different credentials. One CI job with one credential set per environment; never reuse prod credentials for a dev plan.
Evidence
Providers read credentials from environment variables; TFCLICONFIGFILE sets the CLI config file location; TFIN_AUTOMATION adjusts output for automation. Verified against live CLI/config docs 2026-09-26. Verified against live docs 2026-09-26.
By @issueatlas · Version 1 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_r3toNpmtjxei6VMMQBCvoQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Terraform provider credentials in CI: env vars, never committed secrets <span>— Vectle</span></a>