A machine-readable index of this documentation for AI agents is available at https://kubevela.io/llms.txt. Markdown versions of documentation pages are available by appending .md to their URLs.
Skip to main content
Version: Terraform Controller 0.9

Troubleshooting

Start from the Configuration's status, then the Job it ran, then the controller.

kubectl get configuration <name>
kubectl get configuration <name> -o jsonpath='{.status.apply.message}'; echo

The APPLY column is status.apply.state; How It Works lists each state.

The Terraform log​

The apply Job is <name>-apply (or <uid>-apply with controllerNamespace set). Terraform's output is in the terraform-executor container; terraform init runs before it in the terraform-init init container:

kubectl logs job/<name>-apply -n <namespace> -c terraform-init
kubectl logs job/<name>-apply -n <namespace> -c terraform-executor

With controllerNamespace set, the Job runs there and is named after the Configuration's UID:

CFG_UID=$(kubectl get configuration <name> -n <namespace> -o jsonpath='{.metadata.uid}')
kubectl logs job/$CFG_UID-apply -n <controllerNamespace> -c terraform-executor

A remote module is cloned by the git-configuration init container first. If the clone fails, the Pod stops at Init:Error and the Configuration stays ProvisioningAndChecking, so read that container's log: kubectl logs job/<name>-apply -n <namespace> -c git-configuration, or job/$CFG_UID-apply -n <controllerNamespace> with controllerNamespace set. TerraformInitError is for terraform init itself failing.

Common cases​

What you seeWhy, and what to do
ProviderNotFoundNo Provider called default in default, or the one providerRef names. Create it (vela config create ... -t terraform-<cloud>), set providerRef, or for Terraform that needs no credentials, set inlineCredentials: true.
ProviderNotReadyThe Provider's Secret is missing or lacks a key that cloud needs: kubectl get provider <name> -o yaml has the message.
Stays in ProvisioningAndCheckingCheck the Job's pod: an image that can't be pulled, a pod that can't be scheduled (jobNodeSelector, resources), or Terraform still working. Cloud resources such as databases can take many minutes.
ProvisioningAndChecking, the Job's pod in Init:ImagePullBackOff with no match for platform in manifestAn arm64 node: the default terraformImage is amd64 only. See Install.
Stays in ProvisioningAndChecking, the Job's pod in Error and restartingTerraform refused or the cloud API failed: the terraform-executor log has the error (v0.9.1 never sets ApplyFailed). Fix the HCL or the variables and re-apply; each change starts a new Job.
Stuck in GeneratingTerraformOutputsThe apply worked, but the connection Secret was refused: see Upgrade.
terraform-init fails with Error loading state: namespaces "..." not foundbackend.namespace (or spec.backend.kubernetes.namespace) names a namespace that doesn't exist (the vela-system default, outside KubeVela). Create it, or reinstall the chart with backend.namespace set.
Deletion hangs in DestroyingThe destroy Job is failing: read its terraform-executor log. If the resources are already gone by other means, set forceDelete: true on the Configuration and delete it again.

The controller​

kubectl logs -n <namespace> deploy/terraform-controller

The controller logs each reconcile with the Configuration's name. For a field you set that seems to have no effect, check it survived: kubectl get configuration <name> -o yaml. A field missing there was pruned by an old CRD: see Upgrade.