Interview Prep/Terraform/Secrets Provisioners and Policy as Code

Why should you replace `null_resource` with `terraform_data`?

BeginnerScenarioSecrets Provisioners and Policy as Code
Answer

Situation read → Old modules use the null provider for hooks.

What I'd do →

  1. Switch to the built-in terraform_data resource (Terraform 1.4+).
  2. Use triggers_replace instead of triggers.
  3. Migrate with a moved block where supported, or recreate since it has no real infrastructure.

Why → It needs no extra provider download and can store input and output values.

Interview tip → It's a small thing that shows you keep up with the language.

All Terraform questions

More on Secrets Provisioners and Policy as Code