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.
- 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"
}
- After specifying the Terraform Provider, execute:
$ terraform init
-
Documentation about specific configuration options can be found in the Terraform Turbot Provider documentation. This includes instructions on how to set static credentials as well as using environment variables to pass in access keys.
-
To specify a particular provider version when installing the Turbot provider, see the Terraform documentation on provider versioning.
Next Steps
- Download Terraform or OpenTofu if you haven't installed either yet
- See the Turbot Guardrails Provider Reference for configuration options, resources, and data sources
- Explore Terraform for Everything to learn how to manage Guardrails configuration as code