Create a template | Infrastructure as Code | Northflank Application docs

Infrastructure as Code /

Create a template

You can create a new template from the templates page within a project, or the templates page in your team or user account settings.

Click here to view your account templates page.

Templates are encrypted at rest on the platform, so any secrets and sensitive data are kept secure.

Template scopes

Your account templates page will display all templates created within your account, and your projects template page will only show templates that have been created or run on that project.

As examples, you can use templates at the account level to automate common deployments across different projects, and templates at the project level to manage specific deployments, or automate specific tasks.

Select template project

You can create a new project using a template, or choose an existing project for the template to run in. You can specify the name, colour, and region of the project to be created. The project region cannot be changed after creation. If your account or team uses another cloud provider, you can also choose from available clusters on your own cloud account.

If you run a template that creates a project with the same name as an existing project in the account, it will update the project according to the template. If the template specifies a region different to the existing project, the template run will fail.

If you run a template that specifies (but does not create) a project that doesn't exist in the account, the template run will fail.

Enable GitOps

You can enable GitOps to create a copy of the template in a specified repository branch as a JSON file at the given path. If a template already exists you can select the repository and branch, enter the file path, and click fetch to retrieve the existing template. Learn more about GitOps on Northflank.

Enable CI/CD

You can enable the template to run automatically whenever the template is updated - whether it's updated in the Northflank UI, via the API, or changed in the Git repository (if GitOps is enabled).

Override arguments for a template run

You can configure argument overrides for a template which will override all arguments set in the template. Arguments can be accessed in the template in the form: ${args.argName}.

Add and preview template

Enter the content of your template using Northflank's editor. The editor includes code hints, autocompletion, and error checking to help you include required properties in the correct format.

Only the apiVersion and spec object, which contains the template workflow, are required when you are editing a template in the Northflank application, other properties such as the project are configured in the form. If you paste a template into the editor which includes these properties, they will be removed from the JSON and used to populate the form fields.

Learn more about writing templates.

You can preview the workflow of your template by opening the preview view. Each step of the workflow will be displayed as a node, linked to the next step in the sequence. You can expand each node to view the specific JSON configuration.

Preview of a template in the Northflank application

© 2023 Northflank Ltd. All rights reserved.