oxid validate
Validate your HCL configuration files without running any infrastructure operations.
Usage
oxid validate
The validate command checks your .tf files for syntax errors, invalid references, missing variable definitions, and other configuration issues. No providers are contacted and no state is read or modified.
What It Checks
- HCL syntax - Ensures all .tf files parse correctly
- Provider references - Verifies that all resources reference a declared provider
- Variable definitions - Checks that all referenced variables are defined
- Variable types - Validates that variable defaults match declared types
- Output references - Ensures outputs reference valid expressions
- Resource references - Checks that cross-resource references use valid addresses
- Duplicate declarations - Detects duplicate resource, variable, or output names
Example: Valid Configuration
$ oxid validate Configuration is valid.
Example: Errors Detected
$ oxid validate
Error: Missing variable definition
on main.tf line 14:
14: instance_type = var.instance_size
Variable "instance_size" is not defined. Did you mean "instance_type"?
Error: Unknown provider
on storage.tf line 3:
3: resource "gcp_storage_bucket" "data" {
Provider "gcp" is not declared in required_providers.
Did you mean "google"?
Validation failed: 2 errors found.CI/CD Integration
Use oxid validate as a fast pre-check in your CI pipeline before running plan or apply:
# .github/workflows/infra.yml - name: Validate configuration run: oxid validate - name: Plan changes run: oxid plan --out plan.oxid
TipValidate runs in milliseconds since it only parses files locally. It does not download providers or contact any APIs.