Terraform Errors
This article covers errors specific to the Terraform layer that underlies Cloud Manager — template authoring errors, provider plugin issues, state conflicts, destroy failures, and variable injection problems. For higher-level issues (quota, credentials, network), see Provisioning Failures and Connectivity Issues.
Terraform errors are most relevant to custom Terraform models, but some can affect built-in blueprint models as well (blueprints are themselves Terraform templates running under the hood).
Reading a Terraform Error
Terraform errors follow a consistent structure. When you see one in the deployment log, look for:
- The resource block it occurred in (e.g.,
aws_instance.vdi_instance) - The specific error message from Terraform or the provider plugin
- The line number in the template (for syntax errors)
For provider-side errors, the message often includes the provider’s own error code and explanation (for example, AWS InsufficientInstanceCapacity). Use that provider-specific message to drill further into the provider’s documentation.
Provider Plugin Download Failed
Symptom: the deployment log shows an error early in the run mentioning failed to download provider plugin or could not connect to registry.terraform.io.
Terraform requires outbound HTTPS access from the broker host to registry.terraform.io and releases.hashicorp.com to download provider plugins. If the broker is behind a proxy or in an air-gapped environment, the network configuration for these endpoints is handled at the Workspace level — see Thinfinity® Workspace Best Practices for Production Environments for outbound connectivity and proxy guidance.
Authentication / Provider Credentials
Symptom: the log shows a provider-specific authentication error (e.g., InvalidAccessKeyId, AuthenticationFailed, 401 Unauthorized).
Cause: the credentials passed to the Terraform provider are invalid or lack the required permissions.
Resolution:
- Open the credential set in the Credentials tab (see Credentials) and confirm the values are current. Cloud Manager validates credentials when they are added or edited; if they were valid then but failing now, they may have been rotated or revoked at the provider.
- If the credential set was added successfully but Terraform still fails with an authentication error, the credentials may have read/list access but lack the write permissions Terraform needs for provisioning. Review the provider’s credential page in Credentials for the exact permissions required.
- Rotate the credentials at the provider, update them in Cloud Manager, and retry.
State Lock Conflict
Symptom: the deployment log mentions “state locked” or “could not acquire state lock”.
Cloud Manager runs Terraform with state locking disabled and keeps a separate local state for each deployment, so this error does not occur during normal Cloud Manager operation. If you see it, a Terraform operation was run manually against the broker’s working directory — for example, while inspecting or repairing a deployment by hand.
Resolution:
- Confirm that no manual Terraform operation is running against that deployment’s working directory on the broker host.
- Cloud Manager has no in-product unlock action. Clear the stale lock on the broker host — for example, run
terraform force-unlockin that deployment’s directory — then retry the operation from Cloud Manager.
Force-unlocking a state that is genuinely in use by another operation can corrupt the state file. Only force-unlock when you are certain no operation is active.
Missing Required Variables
Symptom: the log shows an error like No value for required variable "instance_type" or Missing required argument.
Cause: the template declares a variable that was not supplied by Cloud Manager. This happens when:
- A variable is declared in
variables.tfwithout a default and is not inschema.json— the wizard doesn’t know to ask for it, so it goes unset. - The variable name in
schema.jsondoesn’t match the name invariables.tf— the wizard collects input for one name; Terraform expects another.
Resolution:
- Verify every required variable in
variables.tfis either:- Declared with a
defaultvalue, OR - Exposed in
schema.jsonfor user input, OR - A reserved variable that Cloud Manager populates (
vdi_instances,vmname)
- Declared with a
- Verify the variable names match exactly between
variables.tf,schema.json, and the resource references inmain.tf. - See schema.json and uischema.json Reference.
Resource Label Mismatch
Symptom: the deployment succeeds on the provider side, but Cloud Manager cannot find or manage the provisioned VM afterward.
Cause: the VM resource in the template does not use the required label vdi_instance. Cloud Manager identifies the manageable resource by this label — without it, the VM exists at the provider but is invisible to Cloud Manager.
Resolution:
-
Open the template’s
main.tf. -
Locate the VM resource block.
-
Ensure it is labeled
vdi_instance:resource "aws_instance" "vdi_instance" { # ... } -
Update the model with the corrected template and redeploy.
See Terraform Overview — VM Template.
Multiple Instantiation Not Working
Symptom: the template runs but provisions only one VM, regardless of the model’s instance count configuration.
Cause: the template is not iterating over the vdi_instances list.
Resolution:
-
Ensure the VM resource uses
for_each = toset(var.vdi_instances):resource "aws_instance" "vdi_instance" { for_each = toset(var.vdi_instances) ami = var.ami instance_type = var.instance_type tags = { Name = each.value } } -
Ensure the variable
vdi_instancesis declared invariables.tfas alist(string). -
Ensure
vdi_instancesis not inschema.json— it is a reserved variable populated by Cloud Manager.
See Terraform Overview — Multiple Instantiation.
Shared Template Output Not Consumed
Symptom: the deployment fails with errors about missing resources that should have been created by the Shared Template.
Cause: the VM Template is not correctly consuming the outputs from the Shared Template.
Resolution:
-
Confirm the Shared Template declares outputs for all shared resources:
output "subnet_id" { value = azurerm_subnet.my_terraform_subnet.id } -
Confirm the VM Template declares matching input variables and uses
var.<name>to reference them:ip_configuration { subnet_id = var.subnet_id }
Destroy Operation Fails
Symptom: a Destroy operation (manual or triggered by the model’s Destroy Settings) fails or leaves resources behind.
Common causes are listed below.
| Cause | Resolution |
|---|---|
| Dependency loop between resources | Review the template for circular dependencies; Terraform normally handles ordering, but complex templates can confuse it |
| Provider returned an error during destroy | Review the log for the specific provider error; retry after resolving |
| State drift — Cloud Manager’s state doesn’t match the provider | Force-refresh state; if needed, manually destroy orphaned resources in the provider console |
| Credentials lack destroy permission | Verify credentials have full CRUD on the resources involved |
If a destroy leaves resources behind at the provider, clean them up manually in the provider console to prevent ongoing costs.
State Drift
Symptom: Cloud Manager shows an instance as Active that no longer exists at the provider, or as destroyed when it still exists.
Cause: the Terraform state and the actual provider resources have diverged, usually because:
- A resource was modified or deleted outside of Cloud Manager (directly in the provider console, via provider CLI)
- A Terraform operation crashed mid-way
- State storage corruption
Resolution:
- Use Refresh on the affected instance. Cloud Manager queries the provider directly and updates the instance’s recorded status. This resolves drift that is limited to the status Cloud Manager shows.
- If the underlying resources have actually diverged — not just the displayed status — destroy the affected deployment and reprovision. Cloud Manager does not expose a standalone
terraform refreshor reconcile action.
Template Validation Failed
Symptom: the deployment fails immediately with an HCL syntax error or validation error.
Resolution:
- Validate the template locally with
terraform fmtandterraform validatebefore importing. - Review the specific line number and error from the deployment log.
- Common issues: missing commas in maps, mismatched braces, invalid resource references, incorrect variable types.