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

Variable Files

Variable files can be mounted into the run job from configmap or a secret. Here is an example

apiVersion: v1
kind: ConfigMap
metadata:
  name: common-cfg
data:
  common.tfvars: |-
    length = 20
---
apiVersion: run.terraform-operator.io/v1alpha1
kind: Terraform
...
spec:
  ...
  variableFiles:
    - key: common-config
      valueFrom:
        configMap:
          name: common-cfg

        # secret:
        #   secretName: my-secret-var-file

The configmap/secret key must end with the an extension .tfvars or .tf