top of page
  • Akmod

Idem: A Declarative Language for Managing Cloud Infrastructure

Idem is a declarative language that empowers you to describe and manage cloud infrastructure with an idempotent approach. By amalgamating the versatility of the Jinja templating engine with the structured clarity of YAML, Idem furnishes a syntax that is both intuitive and conducive to crafting reusable, maintainable configurations. This post delves into the intricate grammar and the myriad components of Idem, encompassing states, reusability through params, argbinding syntax, and plugin extensions.

The Render Pipe: Jinja + YAML

At the heart of Idem lies the Structured Layer State (SLS) file, processed through a render pipe designated as jinja|yaml. Here, the Jinja templating is executed first, giving you the power to incorporate dynamic expressions. Subsequently, YAML takes over, transforming the document into a Python dictionary that symbolizes structured data. However, the flexibility doesn’t end here. The render pipe is extensible, allowing additional renderers or even custom "rend" plugins to be added, paving the way for limitless possibilities.

State Structure

An impeccable structure is quintessential for describing cloud infrastructures in Idem. States adhere to this template after they are rendered:

    "<state_id>": {
        "<state_reference>": [
            {"<requisite|state_kwarg>": "<value_or_arg_bind_statement>"},

This structure forms the base language of Idem and is essential for describing cloud infrastructure.

State ID

The state_id serves as an anchor, offering Idem a unique, arbitrary identifier for the resource you wish to manage. It's a reference handle that can be used elsewhere within the SLS file.

State Reference

state_reference is a crucial component that specifies the type of resource, like aws.ec2.instance.present for an AWS EC2 instance you want to ensure is present. It includes the full path to the resource on the hub, allowing Idem to correctly map and handle the state.


Requisites are the guardians of order, ensuring that states are executed in a sequence that respects dependencies. They are the architects behind intricate relationships between states. Some examples are require, watch, and onfail, each playing a unique role in the orchestration of resources.

State kwargs

state_kwargs are your resource’s characteristics. They encapsulate attributes such as the size of a VM, or the location of a file, and are defined as keywords within the state.

Argbinding Syntax

The argbinding syntax binds values from resources to states:


<attribute> can be a dictionary, string, or list. For dictionaries, you can further delve into keys with :<attribute>, while [0] can be used to access elements of lists.

Accessing the Hub and Params through Jinja

Jinja bridges the SLS file with the hub and params. The params is a treasure trove – a dictionary of key-value pairs that can be wielded to populate values in the SLS file. This bestows upon the SLS files an unparalleled reusability factor. Additionally, Jinja offers the prowess to execute modules and functions on the hub.


Idem’s capabilities can be dramatically extended through plugins like idem-aws and idem-gcp. These plugins enrich Idem with a plethora of additional states, widening the range of state_references and fortifying Idem’s dexterity.


Here is a simplified example illustrating the structure and syntax of an SLS file in Idem:

    - cidr_block_association_set:
      - CidrBlock:
    - tags:
      idem_demo_key: {{ params.value }}

    - vpc_id: ${aws.ec2.vpc:my_idem_vpc:resource_id}
    - cidr_block:
    - tags:
      - Key: idem_demo_keys
        Value: {{ params.value }}

This example creates a subnet machine using a vpc resource named my_idem_vpc. It utilizes params from jinja to get the value for the tag on each resource


Idem is an empowering language that gracefully balances the robustness and intricacy required for cloud infrastructure management, with an emphasis on reusability, idempotency, and maintainability. Armed with a grasp of its grammar, states, argbinding syntax, and plugins, you are poised to architect powerful, scalable, and streamlined cloud infrastructures.

Recent Posts

See All


bottom of page