thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Commonly confused · DevOps & Automation

Declarative vs Imperative Configuration: What's the Difference?

Declarative configuration describes the desired end state and lets the tool figure out how to reach it. Imperative configuration lists the exact commands or steps to run in order. Declarative tools are naturally idempotent; imperative scripts must be written carefully to be.

Declarative

vs

Imperative

DeclarativeImperative
DescribesWhat the end state should beHow to get there, step by step
IdempotencyBuilt inMust be coded by the author
Drift handlingTool reconciles toward desired stateRerunning may duplicate or fail
ReadabilityShows final configurationShows procedure
ExamplesTerraform HCL, Kubernetes YAML, SQL queriesBash scripts, kubectl create/run commands, CLI command sequences
AnalogyGive a taxi the destinationGive turn-by-turn directions
Remember it

Declarative says where; imperative says how.

Exam tip

Questions classify tools or snippets: Kubernetes manifests applied with kubectl apply are declarative, while kubectl run or a shell script is imperative. Idempotency is the usual follow-up concept.

Tested on

More DevOps & Automation look-alikes