Terraform Setup

Download and Install Terraform

Download and install Terraform from HashiCorp. Alternatively, you can use OpenTofu, an open-source Terraform-compatible alternative. The Guardrails provider works with both.

Set up the Turbot Guardrails Terraform Provider

The Turbot Guardrails Terraform Provider is available in the official Hashicorp provider registry. This allows you to easily create a configuration file and install the Guardrails Terraform provider with little effort.

The Guardrails Terraform provider uses the same credentials storage as the Turbot Guardrails CLI. If you haven't already done so, set up your Turbot Guardrails CLI credentials.

  1. To install the Turbot Guardrails provider, define a provider configuration in the working directory. Terraform will automatically install the provider in the chosen directory.
terraform {
  required_providers {
    turbot  = {
    source  =  "turbot/turbot"
    version  =  "1.9.1"
    }
  }
}

provider "turbot" {
  # Configuration options
  # profile = 'default'
  # OR
  # workspace           = "https://turbot-customer.cloud.turbot.com"
  # access_key          = "b05*****-****-****-****-********580a"
  # secret_key          = "d79*****-****-****-****-********b28"
}
  1. After specifying the Terraform Provider, execute:
$ terraform init

Next Steps