> ## Documentation Index
> Fetch the complete documentation index at: https://docs.incident.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Managing workflows in Terraform

Managing workflows in terraform is useful if you:

* Want to use version control to preview and roll-back changes to a workflow
* Want to apply complex access control (e.g. only members of the SRE team can edit specific core SRE workflows)
* Want to create workflows programmatically based on other data that you store in Terraform

## Building your Terraform

Workflows have a pretty complex structure, so we’d recommend you build your workflow in the UI using our visual builder, and then copy the Terraform that we generate into your repo.

<img src="https://mintcdn.com/incidentio-18bb4170/iopR3BNEfSUPs05k/images/help-centre/managing-workflows-in-terraform/screenshot-1.png?fit=max&auto=format&n=iopR3BNEfSUPs05k&q=85&s=c6e39e60a6eb628af493d200ceffa0e8" alt="" width="2000" height="2179" data-path="images/help-centre/managing-workflows-in-terraform/screenshot-1.png" />

## Making the dashboard ‘Terraform aware’

We want to make sure the dashboard understands that you’re managing a workflow via Terraform, and can adapt accordingly.

You can easily see which workflows are managed via Terraform:

<img src="https://mintcdn.com/incidentio-18bb4170/iopR3BNEfSUPs05k/images/help-centre/managing-workflows-in-terraform/screenshot-2.png?fit=max&auto=format&n=iopR3BNEfSUPs05k&q=85&s=04fb11c2ecb1c54a9184738dbd076bc5" alt="" width="2000" height="597" data-path="images/help-centre/managing-workflows-in-terraform/screenshot-2.png" />

You can tell us where your Terraform code is stored, so it’s easy for your colleagues to find and update it:

<img src="https://mintcdn.com/incidentio-18bb4170/iopR3BNEfSUPs05k/images/help-centre/managing-workflows-in-terraform/screenshot-3.png?fit=max&auto=format&n=iopR3BNEfSUPs05k&q=85&s=14e740227eb41c1f39f82cc08b0be983" alt="" width="2000" height="386" data-path="images/help-centre/managing-workflows-in-terraform/screenshot-3.png" />

We warn you before you make a change that would pull the workflow out of sync with your Terraform state:

<img src="https://mintcdn.com/incidentio-18bb4170/iopR3BNEfSUPs05k/images/help-centre/managing-workflows-in-terraform/screenshot-4.png?fit=max&auto=format&n=iopR3BNEfSUPs05k&q=85&s=68bb0e9c6b30779ecfbad9a0c8c4f501" alt="" width="2000" height="1387" data-path="images/help-centre/managing-workflows-in-terraform/screenshot-4.png" />

You can find out more in our [Terraform provider docs.](https://registry.terraform.io/providers/incident-io/incident/latest/docs/resources/workflow) ​

## API Key Permissions

As part of the setup you'll need to create an incident.io API Key. To do *all the things* we currently support in Terraform, you'll want to look at giving the key the following permissions. However, you can always refine this if you're only looking to manage certain components. ​

<img src="https://mintcdn.com/incidentio-18bb4170/iopR3BNEfSUPs05k/images/help-centre/managing-workflows-in-terraform/screenshot-5.png?fit=max&auto=format&n=iopR3BNEfSUPs05k&q=85&s=95323422284782178d732fd5415a3d2d" alt="" width="553" height="681" data-path="images/help-centre/managing-workflows-in-terraform/screenshot-5.png" />
