Project creation guide

This guide explains how to create a project. For detailed documentation see: project.yml.

Create a new source project

The Inmanta compiler expects a project with basic configuration. This project is a directory that contains the source code of the configuration model. This project also matches with a project defined on the server, from which multiple environments can be deployed.

1pip install cookiecutter
2cookiecutter gh:inmanta/inmanta-project-template

Note

The cookiecutter template also sets up git for the new project. This is a best practice to version control your infrastructure code.

Inside the project the compiler expects a project.yml file that defines metadata about the project, the location to store modules, repositories where to find modules and possibly specific versions of modules. project.yml provides an overview about the supported metadata attributes.

An example project.yml could be:

 1name: test
 2description: a test project
 3author: Inmanta
 4author_email: code@inmanta.com
 5license: ASL 2.0
 6copyright: 2020 Inmanta
 7modulepath: libs
 8downloadpath: libs
 9repo:
10    - url: https://github.com/inmanta/
11      type: git
12install_mode: release
13requires:
14pip:
15    index-url: https://pypi.org/simple
16    extra-index-url: []
17    pre: false
18    use-system-config: false

Warning

Using more than one Python package index in the project config is discouraged. It is a security risk and using more than one should be done with extreme care. Only proceed if you are aware of dependency confusion attacks. For more information see the pip documentation and the draft PEP 708

The main file

The main.cf is the place where the compiler starts executing code first. For example, the main.cf below calls the print plugin from the std module.

1std::print("hello world")

Note

The std module is the only module that does not have to be imported explicitly.

Before the project can be executed, the std module has to be installed. This is done by executing the following command in the project directory:

inmanta project install

The example can be executed with inmanta compile. This prints out “hello world” on stdout.