Declarative infrastructure & Terraform JSON
Describe the state you want
Lesson 1 of 20 · 12 min · Module 1: Declare a configuration contract
A configuration records an intended state that can be reviewed alongside code.
Start this lesson →Free. No installation: you write and run the code in your browser, and it is checked automatically.
By the end, you’ll be able to…
- Distinguish a desired state from a command sequence
- Use a supported Terraform representation
The idea
Terraform accepts .tf.json as an alternative configuration representation. Here, built-in terraform_data values make state and plan concepts inspectable without provisioning a cloud resource.
{
"resource": {
"terraform_data": {
"example": {
"input": {
"message": "hello"
}
}
}
}
}
01Distinguish a desired state from a command sequence
Declarative configuration states the result you want. Planning compares that result with recorded state rather than blindly repeating an imperative script.
02Use a supported Terraform representation
Terraform accepts .tf.json configuration as an alternative to its native HCL syntax. The lab uses built-in terraform_data input values to teach state without pretending to provision cloud resources.
03Review the proposed change
The practice planner reports create, update, delete, or no-op for its bounded resource model. It is a teaching model, not the Terraform CLI.
Your turn
What the checks look for
- Describes the service input
- Plans a new resource
Take this with you
Review the intended state and the changes that would reconcile it.
Go a little further
Compare this JSON representation with the equivalent HCL resource block.