Can I provision workflows using code (git ops)?

Hi,

I maintain my workflows in a git repo as a set of JSONs but right now I need to manually import all changes from the repo to the n8n deployment. Is there a way to provision these updates automatically? Is there a terraform like integration available or even a way for n8n to pick workflows from the filesystem (a locally cloned git repo)?

Thanks!

Hi @nch21, welcome to the community :tada:

I am not familiar with Terraform but you could import workflows from the filesystem through the CLI (and also run them through the CLI if needed).

You can also run workflows from the filesystem (or even a remote URL if you like) through the Execute Workflow node.

Is this what you had in mind?

Thanks @MutedJam, yes thats helpful.

Its not as robust as a solution like say Terraform, (see how ChecklyHQ etc uses it) or inbuilt like in Grafana. Perhaps a possible feature to consider to allow GitOps like provisioning for n8n workflows and to facilitate better use of git for managing workflows.

But, for now, I think I can repurpose the CLI or even the Execute Workflow node to pickup the workflows from a Git repo.

Hi @MutedJam - I saw that n8n.cloud doesn’t support some node types (like execute?). Does the CLI work with n8n.cloud? We’re looking for a Zapier alternative that allows us to manage our pipelines as code (just like what the OP is asking about), and want to make sure this ability isn’t just for the self-hosted OSS version.

Hey @tammersaleh,

Welcome to the community :cake:

Would you be able to open a new thread for this one? A lot has changed over the last year, to answer the question quickly though… The CLI is only available for self hosted instances as it runs as part of the container or as the npm command and doesn’t support talking to remote instances. What you might be interested in is our public API which would allow you to create and update workflows through a REST API.