Interview Prep/DevSecOps/Secrets and Identity Management

Terraform needs credentials for AWS, Datadog and Cloudflare in CI. How do you supply them securely?

IntermediateScenarioSecrets and Identity Management
Answer

Situation read → Multiple providers often means multiple static tokens. Minimise and federate.

What I'd do →

  1. AWS: OIDC role assumption, separate plan (read) and apply (write) roles.
  2. Others: store API tokens in Vault or Secrets Manager, fetch at job start using the AWS role or Vault JWT auth.
  3. Pass via env vars (DD_API_KEY, CLOUDFLARE_API_TOKEN), never in .tfvars committed to git.
  4. Mark sensitive variables with sensitive = true and use ephemeral resources/variables (Terraform 1.10+) so values stay out of state where supported.
  5. Scope each token to the zones or orgs it manages.

Why → One federated identity unlocks the rest, so there is only one trust root to protect.

Interview tip → Split plan and apply roles; PRs only ever get the read role.

All DevSecOps questions Roadmap: Supply chain, secrets & identity

More on Secrets and Identity Management