TF-Associate-004 - Infrastructure as Code (IaC) with Terraform (8% of the exam) - Section 1a
Explain what Infrastructure as Code (IaC) is.
IaC is the practice of defining infrastructure in machine-readable configuration files that are version-controlled and applied by a tool rather than provisioned by hand. Candidates should be able to distinguish declarative configuration, which describes desired end state, from imperative scripting that lists steps, and explain why Terraform reads a configuration and reconciles reality toward it.
lock_openFree sampleInfrastructure as Code (IaC) with Terraformeasy
Terraform is often described as using a declarative approach to Infrastructure as Code. What does a declarative configuration specify?
AThe exact ordered sequence of API calls the tool must execute to build each resource.
BA shell script that engineers run by hand whenever a resource needs changing.
CThe desired end state of the infrastructure, leaving the tool to work out the actions needed to reach it.check_circle Correct
DThe precise loops and conditionals that iterate over the provider until each resource exists.
A declarative configuration states the desired end state and lets the tool decide the steps to achieve it. In a declarative model the practitioner defines the target state and the tool computes the difference between current and desired state, then performs the actions needed, rather than being told each step explicitly.
Why A is wrong: Specifying an ordered sequence of steps is the imperative approach; it is tempting because tools do make API calls, but the practitioner does not script that order in a declarative model.
Why B is wrong: Hand-run shell scripts are an imperative, manual technique; they may change resources but they do not describe a desired end state the tool reconciles to.
Why C is correct: A declarative configuration describes what the infrastructure should look like, and Terraform determines the operations required to reach that state.
Why D is wrong: Explicit loops and conditionals reflect imperative programming logic, which sounds plausible but is not how a declarative configuration expresses intent.
Exam traps in Infrastructure as Code (IaC) with Terraform
Answers that look right on this material and are not. Each one is a distractor from a different question in the TF-Associate-004 bank for this domain.
Because IaC prevents anyone from ever changing resources outside of Terraform, so drift cannot occur.
errorWhy it is wrong: IaC does not physically block console or API changes, so out-of-band edits and therefore drift can still happen; the benefit is detecting drift, not preventing all of it.
The cloud provider begins charging a flat monthly fee rather than billing per resource, because the resources are now managed by code.
errorWhy it is wrong: This is tempting because teams hope tooling changes cost, but Terraform does not alter provider billing models; you still pay the provider per resource regardless of how it was created.
As a package manager that installs and upgrades application software inside each running server after it has booted.
errorWhy it is wrong: This describes the in-guest configuration tool the colleague already uses; Terraform provisions the infrastructure rather than installing packages inside a booted machine.