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. Correct
- DThe precise loops and conditionals that iterate over the provider until each resource exists.
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.