The following is a list of configurable parameters of the Terraform CRD. A brief description about each parameter will be defined here. Fore more in-depth details about the features, see Core Concepts.
TerraformSpec v1alpha1 tf
| Field | Description | 
|---|---|
| terraformModulestring | A remote URL to fetch the Terraform module. The URL uses a variation of Terraform’s “Module Source” URL-like syntax. This value will be parsed into all the components of an address, like host,port,path,scheme, etc. See ParsedAddress for a detailed explanation the parser. | 
| terraformModuleConfigMapConfigMapSelector | Mount a ConfigMap as the Terraform module. | 
| terraformModuleInlinestring | Write the terraform module as a string. | 
| terraformVersionstring | the Terraform version to use for the module. Defaults to 1.1.3 | 
| terraformRunnerExecutionScriptConfigMapConfigMapKeySelector | Allows the user to define a custom script for the Terraform Runner pod. The custom-script replaces the default script executed by the image. | 
| scriptRunnerExecutionScriptConfigMapConfigMapKeySelector | Allows the user to define a custom script for the Script Runner pod. The custom-script replaces the default script executed by the image. | 
| setupRunnerExecutionScriptConfigMapConfigMapKeySelector | Allows the user to define a custom script for the Setup Runner pod. The custom-script replaces the default script executed by the image. | 
| keepLatestPodsOnlyboolean | When truewill keep only the pods that match the current generation of the terraform k8s-resource. This overrides the behavior ofkeepCompletedPods.The keepLatestPodsOnlyoption should reap all generational resources that are generated by the terraform-operator controller including:
 
 | 
| keepCompletedPodsboolean | When truewill keep completed pods. Default isfalseand completed pods are removed. | 
| cleanupDiskboolean | CleanupDisk will clear out previous terraform run data from the persistent volume. | 
| persistentVolumeSizestring | Define the size of the disk used to store terraform run data. If not defined, a default of “2Gi” is used. | 
| runnerRulesPolicyRule | RunnerRules are RBAC rules that will be added to all runner pods. | 
| runnerLabelsobject | RunnerLabels is an unstructured key value map of labels that will be added to all runner pods. | 
| runnerAnnotationsobject | RunnerAnnotations is an unstructured key value map of annotations that will be added to all runner pods. | 
| outputsSecretstring | OutputsSecret will create a secret with the outputs from the terraform module. All outputs from the module will be written to the secret unless the user defines “outputsToInclude” or “outputsToOmit”. | 
| outputsToIncludestring array | A whitelist of the terraform module’s outputs to save to the OutputsSecretorTerraformStatus | 
| outputsToOmitstring array | A blacklist of the terraform module’s outputs to omit when writing the to the OutputsSecretorTerraformStatus | 
| writeOutputsToStatusboolean | When truethe terraform module’s outputs get written to theTerraformStatus | 
| scriptRunnerVersionstring | The tag of the Script Runner image. | 
| setupRunnerVersionstring | The tag of the Setup Runner image. | 
| terraformRunnerstring | The repo of the Terraform Runner image. | 
| scriptRunnerstring | The repo of the Script Runner image. | 
| setupRunnerstring | The repo of the Setup Runner image. | 
| terraformRunnerPullPolicystring | The pullPolicyfor the Terraform Runner pod. | 
| scriptRunnerPullPolicystring | The pullPolicyfor the Script Runner pod. | 
| setupRunnerPullPolicystring | The pullPolicyfor the Setup Runner pod. | 
| resourceDownloadsResourceDownload array | ResourceDownloads defines other files to download into a path relative to the terraform module’s directory.  The tfvartype is a special file that does not get added into the terraform module’s directory. Thetfvartype gets added to a special directory and gets utilized when making the “terraform plan”. Thetfvarspecial directory is also used by the Export Repo feature. | 
| envEnvVar array | Define environment variables used by all workflow runners. A common use case is the TF_VAR_prefixed variables that get consumed in the “terraform plan”.TF_VAR_prefixed variables are also utilized by the Export Repo feature. | 
| serviceAccountstring | Use a specific kubernetes ServiceAccount for workflow runner pods. If not specified, a new ServiceAccount is created per generation. | 
| credentialsCredentials array | Credentials generally used for Terraform providers | 
| ignoreDeleteboolean | Bypass the finalization process in order to remove the Terraform resource from kubernetes without running any delete jobs. | 
| customBackendstring | Configure the terraform backend by writing an inline Terraform Backend Configuration. If this field is omitted, a default consul backend configuration will be used, which will require a consul installation into the cluster. | 
| exportRepoExportRepo | Consolidate and save the “tfvar"s to a single file, then export the file to a remote github repo. Specify the repo and the path and the Export Runner will run after the setup phase. | 
| preInitScriptstring | A script, written as an inline yaml string, that will run before “terraform init”. “ pre*” scripts run as Init Containers in a Terraform Runner pod. All scripts get executed from within the root of the terraform module’s directory. Therefore, files created, changed, or removed from this directory, or anywhere in the user’s$HOMEdirectory, will persist for the next stage in the workflow. | 
| postInitScriptstring | A script, written as an inline yaml string, that will run after “terraform init”. “ post*” scripts run as standalone pods in the workflow. All scripts get executed from within the root of the terraform module’s directory. Therefore, files created, changed, or removed from this directory, or anywhere in the user’s$HOMEdirectory, will persist for the next stage in the workflow. | 
| prePlanScriptstring | A script, written as an inline yaml string, that will run before “terraform plan”. “ pre*” scripts run as Init Containers in a Terraform Runner pod. All scripts get executed from within the root of the terraform module’s directory. Therefore, files created, changed, or removed from this directory, or anywhere in the user’s$HOMEdirectory, will persist for the next stage in the workflow. | 
| postPlanScriptstring | A script, written as an inline yaml string, that will run after “terraform plan”. “ post*” scripts run as standalone pods in the workflow. All scripts get executed from within the root of the terraform module’s directory. Therefore, files created, changed, or removed from this directory, or anywhere in the user’s$HOMEdirectory, will persist for the next stage in the workflow. | 
| preApplyScriptstring | A script, written as an inline yaml string, that will run before “terraform apply”. “ pre*” scripts run as Init Containers in a Terraform Runner pod. All scripts get executed from within the root of the terraform module’s directory. Therefore, files created, changed, or removed from this directory, or anywhere in the user’s$HOMEdirectory, will persist for the next stage in the workflow. | 
| postApplyScriptstring | A script, written as an inline yaml string, that will run after “terraform apply”. “ post*” scripts run as standalone pods in the workflow. All scripts get executed from within the root of the terraform module’s directory. Therefore, files created, changed, or removed from this directory, or anywhere in the user’s$HOMEdirectory, will persist for the next stage in the workflow. | 
| preInitDeleteScriptstring | A script, written as an inline yaml string, that will run before “terraform init”. “ pre*” scripts run as Init Containers in a Terraform Runner pod. All scripts get executed from within the root of the terraform module’s directory. Therefore, files created, changed, or removed from this directory, or anywhere in the user’s$HOMEdirectory, will persist for the next stage in the workflow. | 
| postInitDeleteScriptstring | A script, written as an inline yaml string, that will run after “terraform init”. “ post*” scripts run as standalone pods in the workflow. All scripts get executed from within the root of the terraform module’s directory. Therefore, files created, changed, or removed from this directory, or anywhere in the user’s$HOMEdirectory, will persist for the next stage in the workflow. | 
| prePlanDeleteScriptstring | A script, written as an inline yaml string, that will run before “terraform plan -destroy”. “ pre*” scripts run as Init Containers in a Terraform Runner pod. All scripts get executed from within the root of the terraform module’s directory. Therefore, files created, changed, or removed from this directory, or anywhere in the user’s$HOMEdirectory, will persist for the next stage in the workflow. | 
| postPlanDeleteScriptstring | A script, written as an inline yaml string, that will run after “terraform plan -destroy”. “ post*” scripts run as standalone pods in the workflow. All scripts get executed from within the root of the terraform module’s directory. Therefore, files created, changed, or removed from this directory, or anywhere in the user’s$HOMEdirectory, will persist for the next stage in the workflow. | 
| preApplyDeleteScriptstring | A script, written as an inline yaml string, that will run before “terraform apply”. “ pre*” scripts run as Init Containers in a Terraform Runner pod. All scripts get executed from within the root of the terraform module’s directory. Therefore, files created, changed, or removed from this directory, or anywhere in the user’s$HOMEdirectory, will persist for the next stage in the workflow. | 
| postApplyDeleteScriptstring | A script, written as an inline yaml string, that will run after “terraform apply”. “ post*” scripts run as standalone pods in the workflow. All scripts get executed from within the root of the terraform module’s directory. Therefore, files created, changed, or removed from this directory, or anywhere in the user’s$HOMEdirectory, will persist for the next stage in the workflow. | 
| sshTunnelProxyOpts | SSHTunnel can be defined for pulling from scm sources that cannot be accessed by the network the operator/runner runs in. An example is trying to reach an Enterprise Github server running on a private network. | 
| scmAuthMethodsSCMAuthMethod array | A SCMAuthMethod is used to select the kubernetes secrets that provide the passwords, tokens or ssh-keys required to access private servers and repos. The actual creation of the kubernetes secret is not handled by Terraform Operator. | 
ResourceDownload v1alpha1 tf
| Field | Description | 
|---|---|
| addressstring | Source url of resources to fetch. The URL uses a variation of Terraform’s “Module Source” URL-like syntax. This value will be parsed into all the components of an address, like host,port,path,scheme, etc. See ParsedAddress for a detailed explanation the parser. | 
| pathstring | When defined, the downloaded resource(s) will be added to this path relative to the main module directory. | 
| useAsVarboolean | Add the downloaded resource file as a tfvar via the -var-fileflag of the “terraform plan” command. The downloaded resource must not be a directory. | 
Credentials v1alpha1 tf
| Field | Description | 
|---|---|
| secretNameRefSecretNameRef | Load environment variables into the workflow runner pods from a kubernetes Secret. | 
| awsCredentialsAWSCredentials | Methods to load AWS-specific credentials into the workflow runner pods. If using AWS_ACCESS_KEY_IDand/or environment variables for credentials, use thesecretNameRefinstead. For IRSA, using theserviceAccountAnnotationsto add the expectedeks.amazonaws.com/role-arnis effectively the same thing. | 
| serviceAccountAnnotationsobject | ServiceAccountAnnotations is an unstructured key value map of annotations that is added to the kubernetes ServiceAccount that gets mounted by the workflow runner pods. Cloud IAM roles, such as Workload Identity on GCP and IRSA on AWS use this method of providing credentials to pods without haven’t to manage secrets on the cluster. | 
ExportRepo v1alpha1 tf
| Field | Description | 
|---|---|
| addressstring | Destination url of the repo to push tfvarandconfigfiles. The URL uses a variation of Terraform’s “Module Source” URL-like syntax. This value will be parsed into all the components of an address, likehost,port,path,scheme, etc. See ParsedAddress for a detailed explanation the parser. | 
| tfvarsFilestring | The full path, including the directories and filename, relative to the root of the repo. The suffix of the file is not automatically added, so manually include the .tfvarsfile if desired. | 
| confFilestring | The full path, including the directories and filename, relative to the root of the repo. The suffix of the file is not automatically added, so manually include the .conffile if desired. | 
| retryOnFailureboolean | Sets the export pod’s restartPolicy to “OnFailure” | 
| gitUsernamestring | The name of the user who pushes to git. This name is typically an automation user and probably the user whose token or sshkey is configured in SCMAuthMethod | 
| gitEmailstring | The email of the user who pushes to git. This email is typically an automation user and probably the user whose token or sshkey is configured in SCMAuthMethod | 
ProxyOpts v1alpha1 tf
| Field | Description | 
|---|---|
| hoststring | The host name or ip-address of the ssh tunnel host. | 
| userstring | The username that can access the ssh tunnel host for the configured secret. | 
| sshKeySecretRefSSHKeySecretRef | Specifies the kubernetes Secret where a SSH key is stored. | 
SCMAuthMethod v1alpha1 tf
| Field | Description | 
|---|---|
| hoststring | The host where private repos or servers are stored. | 
| gitGitSCM | Configuration options for auth methods of git. | 
GitSCM v1alpha1 tf
| Field | Description | 
|---|---|
| sshGitSSH | SSH options for accessing git over ssh. | 
| httpsGitHTTPS | HTTPS options for access git over https. | 
GitSSH v1alpha1 tf
| Field | Description | 
|---|---|
| requireProxyboolean | Specifies if the target host of the SCMAuthMethod requires a proxy to access. If true, the configured SSHTunnel is the proxy used. | 
| sshKeySecretRefSSHKeySecretRef | Specifies the kubernetes Secret where a SSH key is stored. | 
GitHTTPS v1alpha1 tf
| Field | Description | 
|---|---|
| requireProxyboolean | Specifies if the target host of the SCMAuthMethod requires a proxy to access. If true, the configured SSHTunnel is the proxy used. | 
| tokenSecretRefTokenSecretRef | Specifies the kubernetes Secret where a token key is stored. | 
ConfigMapSelector v1alpha1 tf
| Field | Description | 
|---|---|
| namestring | Name of a ConfigMap | 
| keystring | The key to select | 
SecretNameRef v1alpha1 tf
| Field | Description | 
|---|---|
| namestring | Name of a kubernetes Secret | 
| namespacestring | The namespace the secret is in. Omitting will select the same namespace as the resource | 
| keystring | The key to select | 
SSHKeySecretRef v1alpha1 tf
| Field | Description | 
|---|---|
| namestring | Name of a kubernetes Secret | 
| namespacestring | The namespace the secret is in. Omitting will select the same namespace as the resource | 
| keystring | The key to select | 
TokenSecretRef v1alpha1 tf
| Field | Description | 
|---|---|
| namestring | Name of a kubernetes Secret | 
| namespacestring | The namespace the secret is in. Omitting will select the same namespace as the resource | 
| keystring | The key to select | 
AWSCredentials v1alpha1 tf
| Field | Description | 
|---|---|
| irsastring | When defined will add the special IRSA annotation to the kubernetes ServiceAccount that get added to workflow runner pods. Using the serviceAccountAnnotations to add the expected eks.amazonaws.com/role-arnis effectively the same thing. | 
| kiamstring | When defined will add the special KIAM annotation to the workflow runner pods. Using runnerAnnotationsto add the expectediam.amazonaws.com/roleis effectively the same thing. | 
TerraformStatus v1alpha1 tf
| Field | Description | 
|---|
Kubernetes APIs
Some APIs used by Terraform Operator are adopted from Kubernetes itself. Below are the relevant APIs used by the Terraform CRD.
EnvVar v1 core
| Field | Description | 
|---|---|
| namestring | Name of the environment variable. Must be a C_IDENTIFIER. | 
| valuestring | Variable references $(VAR_NAME) are expanded using the previous defined environment variables in the container and any service environment variables. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Defaults to “”. | 
| valueFromEnvVarSource | Source for the environment variable’s value. Cannot be used if value is not empty. | 
ConfigMapKeySelector v1 core
| Field | Description | 
|---|---|
| namestring | Name of a ConfigMap | 
| keystring | The key to select | 
PolicyRule v1 rbac.authorization.k8s.io
| Field | Description | 
|---|---|
| apiGroupsstring array | APIGroups is the name of the APIGroup that contains the resources. If multiple API groups are specified, any action requested against one of the enumerated resources in any API group will be allowed. | 
| nonResourceURLsstring array | NonResourceURLs is a set of partial urls that a user should have access to. *s are allowed, but only as the full, final step in the path Since non-resource URLs are not namespaced, this field is only applicable for ClusterRoles referenced from a ClusterRoleBinding. Rules can either apply to API resources (such as “pods” or “secrets”) or non-resource URL paths (such as “/api”), but not both. | 
| resourceNamesstring array | ResourceNames is an optional white list of names that the rule applies to. An empty set means that everything is allowed. | 
| resourcesstring array | Resources is a list of resources this rule applies to. ResourceAll represents all resources. | 
| verbsstring array | Verbs is a list of Verbs that apply to ALL the ResourceKinds and AttributeRestrictions contained in this rule. VerbAll represents all kinds. | 
Other articles in this section:
