liveBook · Manning

Terraform variable file

As explained in Effective Platform Engineering

A Terraform variable file is a configuration file that assigns values to input variables for a Terraform configuration.

A Terraform variable file assigns values to input variables for a Terraform configuration. In a reusable pipeline, it supplies environment-specific or runtime-generated values without changing the shared job definition. section 6.3.7

Use variable files to keep shared Terraform pipeline jobs adaptable:

  • Pass the file to terraform plan with the optional -var-file argument. section 6.3.7
  • Generate or populate the file after checkout when values depend on computations performed by the pipeline. section 6.3.7
  • Expose the file path as a shared-job parameter so callers can use the strategy without modifying shared pipeline code. section 6.3.7

Runtime-generated plan inputs

A CircleCI Terraform plan job can run custom after-checkout steps that compute values and create a local variable file, then invoke terraform plan with -var-file pointing to it. section 6.3.7

How Effective Platform Engineering covers it

How deep it goes
Shows command-level integration and runtime generation, without detailing variable-file syntax or Terraform evaluation internals.
Examples
Uses a computed local varfile created after checkout and passed to terraform plan through a reusable job parameter.
What it assumes
Assumes familiarity with Terraform plans, input variables, CircleCI jobs, and pipeline parameters.
What you can do after
Apply it via a reusable CircleCI Terraform plan job that accepts static or runtime-generated variable files.
How it connects
Connects Terraform input variables with Terraform plan, CircleCI shared jobs, pipeline parameters, and custom pipeline steps.

Also explained in

Compare how 2 books explain Terraform variable file →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Effective Platform Engineering. The section links point to the parts of the book it draws on.