top of page
  • Akmod

Creating a Cloud Plugin Using Pop-create

Updated: Jul 12, 2023

In this blog post, we'll guide you through creating a cloud plugin for a REST API using the Pop and Idem tools from SaltStack. We'll use the PetStore API as an example because it is a real, publicly accessible API with an OpenAPI3 specification.


Before we start, make sure you have the following installed:

  • Python 3.8 or higher

  • pip install pop-create-idem

Step 1: Setup Your Environment

First, we'll create a new directory for our project. We'll name it petstore. Navigate to the directory where you want to create the project, and run the following commands:

mkdir idem-petstore
cd idem-petstore

Step 2: Create the Project

Next, we'll use the pop-create openapi3 command to generate our new project. The --create-plugin option is set to state_modules because we want to create managed resources for our cloud.

pop-create openapi3 --create-plugin state_modules --project-name petstore --simple-service-name petstore_api --specification --directory .

This command will create a new idem-cloud project in the current directory, with the name petstore. The project will include state modules generated from the PetStore API OpenAPI3 specification.

Step 3: Explore the Project Structure

After running the above command, your project should have the following structure:

├── build.conf
├── docs
│   ├── ...
├── petstore
│   ├── acct
│   │   ├── ...
│   ├── autogen
│   │   ├── ...
│   ├──
│   ├── exec
│   │   ├── ...
│   ├── states
│   │   ├── ...
│   ├── tool
│   │   ├── ...
│   └──

Some of the important directories and files include:

  • docs: Contains the Sphinx tooling for your project.

  • petstore: Contains the POP subsystems for your project.

  • exec: Contains the exec modules for utilities that hit the cloud API and are exposed on the CLI.

  • states: Contains the idempotent present and absent states.

  • tool: Contains the tool plugins for utilities that hit the cloud API but aren't exposed on the CLI.

Step 4: Customize Your Project

Now that you have a basic project set up, you can start customizing it. You might need to modify the generated code to suit your specific needs, especially when it comes to authentication and error handling. Also, you might need to implement any cloud-specific logic not covered by the OpenAPI specification.


In this blog post, we demonstrated how to create a cloud plugin for a REST API using Pop and Idem. These tools make it easy to create managed resources for your cloud, which is essential for developing scalable and reliable cloud services. Happy coding!

52 views0 comments


bottom of page