Terraform Associate 004 ยท Infrastructure as Code basics
What is Infrastructure as Code (IaC)?
Declarative vs imperative, configuration as versioned text, desired state vs actual state, Terraform as a declarative IaC tool (1a).
Key points
- Managing infrastructure through human-readable configuration files instead of manual clicks. Terraform is declarative: you describe the desired state and it works out the steps, comparing the config with the recorded actual state.
Source: https://developer.hashicorp.com/terraform/intro
Practice questions
What does a declarative IaC tool such as Terraform expect you to write?
- The desired end state of the infrastructure
- The ordered list of API calls to run
- A shell script that checks what already exists
- A snapshot of the current servers
Show answer
Answer: A. The desired end state of the infrastructure
Declarative means describing the end result; the tool calculates the actions. Listing ordered commands is the imperative style.
Which statements about Terraform as an IaC tool are true?
- Configuration is human-readable text that can be versioned
- You must script the order of every API call yourself
- It records managed real-world objects in a state file
- It is declarative: you describe the desired state
- Configuration is stored as compiled binary images
Show answer
Answer: A. Configuration is human-readable text that can be versioned, C. It records managed real-world objects in a state file, D. It is declarative: you describe the desired state
Terraform is declarative, uses readable text configuration, and tracks real objects in state. It does not require you to script the order by hand, and config is not a binary image.
True or false: in Terraform you must write the exact sequence of steps to create resources, in the order they should run.
Show answer
Answer: False
False. Terraform builds a dependency graph from references and decides the order itself, running independent work in parallel.
Practice 8 questions on this topic in Bitzu
Short lessons, instant explanations and spaced review of what you get wrong. Free on iOS and Android.
