Troubleshooting¶
This guide helps you diagnose and resolve common issues with the terraform-provider-qbee. Each problem includes the symptom, possible cause, and resolution steps.
Authentication Issues¶
Problem: Authentication Failed¶
Authentication failed
You see Error: authentication failed or 401 Unauthorized when running terraform plan or terraform apply.
Possible Cause: Incorrect username or password, expired credentials, or wrong base URL.
Tip
- Verify your credentials by logging in to the Qbee web UI at
https://www.app.qbee.io - Check that environment variables are set correctly:
echo $QBEE_USERNAME echo $QBEE_BASE_URL - If using provider block credentials, verify they match your Qbee account
- Check that
base_urlmatches your Qbee instance (default:https://www.app.qbee.io) - Prefer environment variables for credentials. If you need to test provider block configuration, do not commit credentials to version control; use variables instead of hardcoded values:
provider "qbee" { username = var.qbee_username password = var.qbee_password } variable "qbee_username" { type = string } variable "qbee_password" { type = string sensitive = true }
Problem: Environment Variables Not Recognized¶
Provider ignores environment variables
You set QBEE_USERNAME and QBEE_PASSWORD but the provider still asks for credentials.
Possible Cause: Environment variables not exported, or set in a different shell session.
Tip
- Verify the variables are exported (not just set):
export QBEE_USERNAME="your-email@example.com" export QBEE_PASSWORD="your-password" - Verify they are visible to Terraform:
env | grep QBEE - If using a CI/CD pipeline, ensure variables are set in the correct job context
Plan Failures¶
Problem: Plan Shows Unexpected Changes¶
Unexpected changes in terraform plan
terraform plan shows changes you did not make to your configuration files.
Possible Cause: Configuration was changed outside Terraform (via web UI or API), causing state drift.
Tip
- Run
terraform planto see the full list of changes - For each unexpected change, determine if it was made manually
- If the manual change should be kept, update your
.tffiles to match - If the manual change should be reverted, run
terraform applyto restore your desired state
Problem: Plan Fails with Validation Error¶
Validation error during plan
terraform plan fails with Error: Invalid value for argument or similar validation errors.
Possible Cause: Required argument missing, wrong type, or mutually exclusive arguments used together.
Tip
- Read the error message carefully — it indicates which argument is invalid
- Check the Resource Reference for the correct argument types and requirements
- Ensure either
tagornodeis specified (not both, not neither) for resources that require targeting - Verify
extendis set (it is required for most resources) - Run
terraform validatefor a quick syntax check:terraform validate
Apply Failures¶
Problem: Apply Fails with API Error¶
API error during apply
terraform apply fails with Error: API request failed or an HTTP status code error.
Possible Cause: Qbee API rejected the request due to invalid configuration, permissions, or server issues.
Tip
- Check the error message for the HTTP status code:
- 400 Bad Request — Invalid configuration values
- 403 Forbidden — Insufficient permissions
- 404 Not Found — Resource or tag/node does not exist
- 429 Too Many Requests — Rate limit exceeded
- 500 Internal Server Error — Qbee platform issue
- For 400 errors, verify your configuration values match the expected format
- For 403 errors, verify your Qbee account has the required permissions
- For 404 errors, verify the tag or node ID exists in Qbee
- For 429 errors, wait and retry (reduce parallelism with
-parallelism=1)
Problem: Apply Timeout¶
Timeout during apply
terraform apply hangs or times out waiting for the Qbee API to respond.
Possible Cause: Network connectivity issues, Qbee API downtime, or large configuration changes.
Tip
- Check your internet connectivity
- Verify the Qbee API is accessible:
curl -s -o /dev/null -w "%{http_code}" https://www.app.qbee.io - Check the Qbee status page for platform issues
- If applying many resources, reduce parallelism:
terraform apply -parallelism=1
Problem: Partial Apply Failure¶
Some resources applied, others failed
terraform apply partially succeeded — some resources were created but others failed.
Possible Cause: Terraform applies resources in parallel; some may succeed while others fail due to dependencies or API errors.
Tip
- Run
terraform planto see the current state — successfully applied resources show no changes - Fix the failing resource configuration based on the error message
- Run
terraform applyagain — Terraform only applies the remaining changes - If stuck, use
terraform state listto see managed resources andterraform state rmto remove problematic resources from state
State File Issues¶
Problem: State File Corrupted¶
State file is corrupted or unreadable
Terraform reports Error: Failed to load state or state file appears to contain invalid JSON.
Possible Cause: Concurrent writes, disk failure, or manual editing of the state file.
Tip
- Check for a backup state file (
terraform.tfstate.backup) - If backup exists, restore it:
cp terraform.tfstate.backup terraform.tfstate - If no backup and you are using a local backend, move the current state file aside instead of deleting it, then re-import resources:
mv terraform.tfstate terraform.tfstate.corrupt terraform import qbee_parameters.example tag:production - If you are using a remote backend, do not delete or overwrite state directly. Check whether the backend supports versioning/snapshots or run
terraform state pull > terraform.tfstate.backupto create a backup before restoring or re-importing resources
Problem: State Lock Timeout¶
State lock timeout
Terraform reports Error: Error acquiring the state lock when running plan or apply.
Possible Cause: Another Terraform process holds the lock, or a previous run crashed without releasing it.
Tip
- Wait for the other process to complete
- If no other process is running, force-unlock:
terraform force-unlock LOCK_ID - The LOCK_ID is shown in the error message
- Only force-unlock when you are certain no other process is running
Problem: State Drift Detected¶
State shows resources that no longer exist
terraform plan shows resources to be created that you know already exist, or shows deletions for resources still running.
Possible Cause: State file is out of sync with actual Qbee configuration.
Tip
- Run
terraform refreshto update state from the actual Qbee configuration - If resources need re-importing:
terraform import qbee_parameters.example tag:production - If state contains resources that were deleted manually, remove them from state:
terraform state rm qbee_parameters.old_resource
Import Failures¶
Problem: Import Resource Not Found¶
Resource not found during import
terraform import fails with Error: resource not found or 404 Not Found.
Possible Cause: The tag or node does not have the specified configuration in Qbee, or the import ID format is wrong.
Tip
- Verify the configuration exists in the Qbee web UI
- Check the import ID format — it must be
tag:TAG_NAMEornode:NODE_ID - Verify the tag name or node ID is spelled correctly (case-sensitive)
- Example:
terraform import qbee_parameters.example tag:production
Problem: Import ID Format Incorrect¶
Invalid import ID
terraform import fails with Error: invalid import ID format.
Possible Cause: Missing scope prefix (tag: or node:) or wrong separator.
Tip
- Use the correct format:
SCOPE:IDENTIFIER - For tag-targeted resources:
tag:TAG_NAME - For node-targeted resources:
node:NODE_ID - For non-targeted resources (filemanager, role, bootstrap_key, grouptree_group), use the resource-specific ID format — see Terraform Registry documentation
Configuration Drift¶
Problem: Configuration Changed Outside Terraform¶
Someone changed configuration through the Qbee web UI
terraform plan shows changes you did not make, indicating manual modifications.
Possible Cause: A team member or automated process modified Qbee configuration outside of Terraform.
Tip
- Run
terraform planto see all drift - Decide for each change:
- Keep Terraform version: Run
terraform applyto overwrite the manual change - Keep manual change: Update your
.tffiles to match, then runterraform planto confirm no changes
- Keep Terraform version: Run
- To prevent future drift:
- Restrict web UI access for Terraform-managed configurations
- Run
terraform planon a schedule to detect drift early
Parameter Expansion Issues¶
Problem: Parameter Not Expanded¶
Parameter value shows literal $(parameter-name) instead of the resolved value
Devices show $(parameter-name) as a literal string instead of the parameter value.
Possible Cause: The parameter is not defined, the parameter name is misspelled, or qbee_parameters has not been applied yet.
Tip
- Verify the parameter is defined in a
qbee_parametersresource:resource "qbee_parameters" "config" { tag = "production" extend = true parameters = [ { key = "parameter-name", value = "actual-value" } ] } - Verify the parameter name matches exactly (case-sensitive)
- Ensure the
qbee_parametersresource has been applied before the resource that references it - Check that the parameter is defined for the same tag or an ancestor tag
Problem: Circular Reference Detected¶
Configuration fails with circular reference error
Applying configuration fails because parameters reference each other in a loop.
Possible Cause: Parameter A references Parameter B, which references Parameter A.
Tip
- Map out your parameter dependencies
- Break the cycle by introducing a non-referencing intermediate parameter
- Simplify parameter chains — avoid more than 2 levels of expansion
Secrets Issues¶
Problem: Secrets Not Stored in State¶
After apply, terraform plan shows secrets need to be rewritten
terraform plan always shows changes for secrets_wo attributes, even after successful apply.
Possible Cause: Write-only secrets are intentionally not stored in state. Terraform cannot compare the current value and assumes a change is needed.
Tip
- This is expected behavior for
secrets_woattributes - Use
secrets_wo_versionto control when secrets are rewritten:resource "qbee_parameters" "secrets" { tag = "production" extend = true secrets_wo_version = 1 secrets_wo = [ { key = "api_key", value = var.api_key } ] } - Only increment
secrets_wo_versionwhen you need to force a secret update
Problem: Secret Value Drift Detection¶
Cannot detect if secrets changed on the Qbee side
You suspect secrets were changed outside Terraform but cannot verify because secrets are write-only.
Possible Cause: Write-only attributes cannot be read back from the API, so Terraform cannot detect drift for these values.
Tip
- Increment
secrets_wo_versionand runterraform applyto force rewrite all secrets - Use Terraform as the sole source of truth for secrets
- Restrict direct API/UI access to secret values
Timeout Issues¶
Problem: Connection Timeout¶
Connection to Qbee API times out
Terraform reports timeout errors when connecting to the Qbee API.
Possible Cause: Network issues, firewall blocking HTTPS, or Qbee API outage.
Tip
- Test connectivity to the Qbee API:
curl -v https://www.app.qbee.io - Check your firewall and proxy settings
- Verify
base_urlis correct - Check the Qbee status page
Problem: Plan Timeout on Large Configurations¶
terraform plan is very slow with many resources
Planning takes several minutes when managing many Qbee resources.
Possible Cause: Terraform reads the current state of every resource from the Qbee API during plan. Many resources means many API calls.
Tip
- Split large configurations into smaller state files (one per environment or module)
- Use
-targetto plan specific resources:terraform plan -target=qbee_parameters.production - Use Terraform workspaces or separate directories for different environments
Common Error Messages¶
| Error Message | Cause | Resolution |
|---|---|---|
authentication failed | Invalid credentials | Verify username/password and base_url |
tag or node is required | Missing targeting | Add tag or node to resource block |
extend is required | Missing extend flag | Add extend = true or extend = false |
resource not found | Import target missing | Verify tag/node exists in Qbee |
invalid import ID format | Wrong import syntax | Use tag:NAME or node:ID format |
API request failed: 403 | Insufficient permissions | Check Qbee account permissions |
API request failed: 429 | Rate limit exceeded | Reduce parallelism, wait and retry |
Getting More Help¶
| Resource | URL |
|---|---|
| Qbee Documentation | https://docs.qbee.io |
| Terraform Documentation | https://developer.hashicorp.com/terraform |
| Provider on Terraform Registry | registry.terraform.io/providers/qbee-io/qbee |
| Qbee Support | qbee.io/contact |
Enable debug logging to get more information about API requests. Warning: TF_LOG=DEBUG can include sensitive details in logs, such as request/response payloads and, depending on provider logging, secrets. Avoid sharing these logs publicly; only share them through trusted support channels if needed.
export TF_LOG=DEBUG
terraform apply
unset TF_LOG
See Also¶
| I want to... | Document |
|---|---|
| Install and authenticate | Getting Started |
| Look up a resource's arguments | Resource Reference |