In this article we will go discuss what is IDEM, where we can use it and how to get started within 30 mins.

Before we proceed It will be useful to familiarise with relevant concepts, platforms and services.

What is Idem ?

Idem is an open source python based project developed by VMware working as aninfrastructure as data.
It is an idempotent dataflow programming language. Exposes in a simple way stateful programming constructs enforcing the state of an application, configuration, SaaS systems, etc.

Idem is a programming language used for data processing and pipelining. You can manage the configuration of interfaces as well as complex rule engines, processing files or workflows.

The concept of Idempotent is simple. Every time an action is executed, will always produce same result regardless of the state of a system before execution. Additional details can be found in Idem`s getting started documentation..

Where can Idem be implemented in our environment?

It is one stop shop for managing the multi cloud environments and works in a plugin based approach. It supports many plugins as idem-vra, idem-aws, idem-gcp and idem-azure, etc. Allows us to implement our own plugin, based on specific use-case or flavour of cloud. To get started with plugin development it is beneficial to review Create an Idem Provider Plugin page.

While idem has a long list of features, in our idem-vra plugin example will cover a subset of features coming handy in the daily activities of an engineer.

Prerequisites :
Installation requires python 3.8 or higher version installed in our system.
For Windows or Mac, can check the current version of python using command below.

In this scenario I am using MAC and PyCharm as IDE.

Next step is to install Idem.

pip install idem

In case it has previously being installed, you can upgrade it using:

pip install idem --upgrade

Once installed to validate if all idem related commands are loading, you can execute it in a command prompt/terminal window.

Following successful validation of installation, based on our requirements we can install specific idem plugin.

In this article we will be installing idem-vra plugin for managing ABX component and content.

What is Aria Automation (vRA)

VMware Aria Automation is an platform allowing you build and manage modern applications. It provides a consistent self-service experience for users, regardless of the underlying cloud provider. Aria Automation also provides governance and resource lifecycle management capabilities, helping organisations to control costs and ensure compliance with policies.


What is Action based Extensibility(ABX)

Action Based Extensibility (ABX) Actions are small, lightweight stateless containers allowing us to create scripts in different language such as Python, NodeJS, Powershell. We can create extensibility actions by either writing a user-defined action script code or importing a predefined script code as a .ZIP package.  More details about ABX is here 


Plugin installation requires cloning the Idem-vra gitlab repository.

Installation details of Idem-vRA can be found following the Idem-vra readme file.

After completion of the cloning process, folder structure will look as follows:


Idem authentication with a Plugin

To connect idem with a plugin which is vRA , we need to prepare credentials.yaml file. Sample of file’s content can be retrieved using the credential’s section of Idem-vra ReadMe documentation.


Executing the command below generates encrypted key and will also create another file called credential.yaml.fernet

idem encrypt credentials.yaml

Before executing below commands, change the content between the quotes based on your idem encrypt output and your path to the credentials.yaml.fernet.  

Add environment variables’ content executing updated commands:

export ACCT_KEY="encrypted key which we generated above"
export ACCT_FILE="path to credentials.yaml.fernet"

Idem describe

One of the great features of Idem is the ability to generate the SLS file holding a configuration representation of existing environment resource, which can be later utilized for resource management.

Example of ABX action using idem describe in Aria Automation.
Review existing number of ABX actions in our environment by logging in to Aria Automation’s Assembler UI -> Extensibility tab -> select “Actions” link 

Current environment consists of 2 actions. Leveraging idem describe allows us to export the configuration of ABX actions. 

Describe is one of the three currently existing idem states (present, absent and describe) and we will be looking at  State => abx => actions section in Actions idem documentation which will represent path in our command.

idem describe vra.abx.actions




The output is in a form of a nice yaml content with source code savable as an sls format using below command:

idem describe vra.abx.actions > abx.sls

Idem state

Idem consists of 3 states. Present state creates/updates the resource (idem-vra currently supports  create), Absent state deletes the resource & Describe state generates sls file for a resource.

It is time to dig more to understand how managing SLS files allow us to manage ABX actions.
An example use-case is the creation of a new ABX action with different name using previously exported sls file.
In a previous step idem describe generated the sls file with present state.

The diagram presents different states of an idem resource.  

In this action we will change the name of the ABX action in the exported sls file. The screenshot presents changes for line 29 and 46 including a new name and removed ID.

Execute updated sls file by running the command below.

idem state abx.sls

Output presents the new created ABX action with a new name, without changes to the second one called “Initial Power On”.

It is that easy to manage existing resources using Idem and automatically generated SLS files. 

Idem exec

Another feature of Idem is the ability to directly run functions using the command line. To construct the command we will refer Idem actions’ functions.

To list all actions in a command line we can execute:

idem exec vra.abx.actions.get_all_using_get

Idem Validate

Idem validate will perform content validation of our sls files against syntax and jinja error.

Idem doc

The command generates documentation currently for exec and state module functions.
Below example covers the steps of generating a documentation for a specific exec function using idem doc.

idem doc exec.vra.abx.actions.create_using_post

Note: Idem-vra currently supports Create and Delete operation only.