Bitzu

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

Single choice

What does a declarative IaC tool such as Terraform expect you to write?

  1. The desired end state of the infrastructure
  2. The ordered list of API calls to run
  3. A shell script that checks what already exists
  4. 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.

Select all that apply

Which statements about Terraform as an IaC tool are true?

  1. Configuration is human-readable text that can be versioned
  2. You must script the order of every API call yourself
  3. It records managed real-world objects in a state file
  4. It is declarative: you describe the desired state
  5. 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

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.

Download on the App StoreGet it on Google Play

More Terraform Associate 004 topics in this module