Declarative vs Imperative
Last updated
What is Declarative vs Imperative?
When it comes to Infrastructure as Code (IaC), there are two fundamental styles: imperative and declarative.
In imperative IaC, you specify a list of steps the IaC tool should follow to provision a new resource. You tell your IaC tool how to create each environment using a sequence of command imperatives. Imperative IaC can offer more flexibility as it allows you to dictate each step. However, this can result in increased complexity. Popular imperative IaC tools are Chef and Puppet
In declarative IaC, you specify the name and properties of the infrastructure resources you wish to provision, and then the IaC tool figures out how to achieve that end result on its own. You declare to your IaC tool what you want, but not how to get there. Declarative IaC, while less flexible, tends to be simpler and more manageable. Terraform is the most popular declarative IaC tool
Free resources to learn Declarative vs Imperative
More in stage 33: Infrastructure as Code - IaC
Declarative vs Imperative: common questions
Can I learn Declarative vs Imperative in Hindi?
This lesson is written in English. Once you sign in, open it in the interactive course and ask the AI tutor to explain Declarative vs Imperative in Hindi or Hinglish. The tutor answers from this lesson’s own text, so it stays on the syllabus, and it runs on your own Google, OpenAI or Anthropic key.
Is this Declarative vs Imperative tutorial for beginners?
It is lesson 148 of 186 in the free Data Engineer roadmap, in stage 33, Infrastructure as Code - IaC. If you are new to Data Engineer, start from stage 1 and come back here in order; if you already know the earlier stages, this lesson stands on its own.