Interview Prep/Terraform/Secrets Provisioners and Policy as Code

How do you review a PR that adds a `local-exec` provisioner?

IntermediateScenarioSecrets Provisioners and Policy as Code
Answer

Situation read → Arbitrary code runs on the CI runner with deployment credentials.

What I'd do →

  1. Ask why no provider or data source can do it.
  2. Read the script: idempotent? quoting safe? no secret in command line (visible in process list and logs)?
  3. Check failure behaviour (on_failure) and that destroy-time behaviour is handled.
  4. Require a ticket to retire it when native support exists.

Why → Provisioners run outside Terraform's model, so the review must cover the script as if it were production code.

Interview tip → Mention injection risk if interpolating untrusted variables into commands.

All Terraform questions

More on Secrets Provisioners and Policy as Code