This chapter covers
- The Directed Acyclic Graph Data Structure
- How Terraform uses Graphs
- Visualizing Terraform Graphs
- Creating Terraform Plans
- Modifying Plans using CLI Flags and Variables
- Customizing Terraform Apply Runs
- Debugging Common Terraform Errors
In the last few chapters we focused on the Terraform language. This included a heavy focus on the components of the language itself; resources and data sources, the providers they come from, and how we could use functions and expressions to create a variety of configurations. Terraform is more than a language though: it is also an engine that takes your code, compares it to the state of your infrastructure, and then comes up with a dynamic plan to change your infrastructure so it matches your program.
5.1 Directed Acyclic Graphs
5.1.1 Directed Acyclic Graphs
5.1.2 A TLS Example
5.2 The Terraform Resource Graph
5.2.1 Nodes
5.2.2 terraform graph command
5.2.3 Modules in the Graph
5.3 Plan
5.3.1 Planning Modes
5.3.2 Replace (previously known as taint)
5.3.3 Resource Targeting
5.3.4 Disabling Refresh
5.3.5 terraform refresh command
5.3.6 Review Planfiles with terraform show
5.4 Root Level Module Input Variables
5.4.1 Interactive
5.4.2 Variable Flag
5.4.3 Variable Files
5.4.4 Environment Variables
5.4.5 Input Precedence
5.4.6 A Note on Secrets and Inputs
5.5 Apply
5.5.1 Plan and Apply in a single command
5.5.2 Using a Plan file
5.5.3 Destroy
5.6 Apply and Plan Options
5.6.1 Parallelism
5.6.2 Locking
5.6.3 JSON
5.6.4 Formatting Flags
5.7 Common Pitfalls and Errors
5.7.1 Circular Dependencies
5.7.2 Cascading Changes
5.7.3 Hidden Dependencies
5.7.4 Always Detected Changes
5.7.5 Calculated Values and Iterations
5.7.6 Failed State Updates
5.8 Summary