Skip to main content Link Menu Expand (external link) Document Search Copy Copied

Terraform Backend

You can specify a custom backend to use for your Terraform run. See backends

apiVersion: run.terraform-operator.io/v1alpha1
kind: Terraform
...
spec:
  ...
  backend: |
    backend "local" {
      path = "/tmp/tfmodule/mytfstate.tfstate"
    }

Using Kubernetes as a terraform backend

If the backend field was not provided, it will default to the Kubernetes backend. For more custom configuration, you can modify the backend field as below

apiVersion: run.terraform-operator.io/v1alpha1
kind: Terraform
...
spec:
  ...
  backend: |
   backend "kubernetes" {
    secret_suffix     = "example-module"
    in_cluster_config = true
  }

Suffix used when creating secrets. Secrets will be named in the format: tfstate-{workspace}-{secret_suffix}.