Operational Guides
Terraform Operations
Day-to-day Terraform commands and workflows for managing Ontopix infrastructure.
Production
All infrastructure operations are exposed through Taskfile. Never invoke terraform or aws CLI directly.
Common Workflows
View Current State
task infra:plan # Preview what Terraform would change
task infra:show # Show current state
task infra:list # List all managed resources
task infra:output # Show Terraform outputs
Make Changes
task infra:fmt # Format .tf files
task infra:validate # Validate configuration syntax
task infra:plan # Preview changes (always run first)
CONFIRM=yes task infra:apply # Apply changes (requires approval)
Check for Drift
task drift:check # Quick drift detection
task drift:report # Detailed drift report with plan file
Backend Operations
task bootstrap:init # Initialize S3 + DynamoDB backend (first time only)
task bootstrap:status # Check if backend resources exist
State Management
task infra:refresh # Refresh state from actual infrastructure
task infra:show-lock # View current state locks
LOCK_ID=<id> task infra:force-unlock # Force-unlock state (use with caution)
Cleanup
task clean # Remove .terraform, lock files, plan files
Task Reference
| Task | Safe? | Description |
|---|---|---|
infra:plan | Yes | Preview changes |
infra:show | Yes | Show current state |
infra:list | Yes | List managed resources |
infra:output | Yes | Show outputs |
infra:fmt | Yes | Format files |
infra:fmt-check | Yes | Check formatting |
infra:validate | Yes | Validate syntax |
drift:check | Yes | Detect drift |
drift:report | Yes | Detailed drift report |
infra:apply | No | Apply changes (requires CONFIRM=yes) |
infra:destroy | No | Destroy all resources (requires CONFIRM=DESTROY) |
infra:force-unlock | No | Force-unlock state (requires LOCK_ID) |
Validation Checks
Run all checks before committing:
task validate:all # Structure + Terraform checks
Or individually:
task validate:structure # Check required files exist
task validate:terraform # Format check + validate
AWS Utilities
task aws:whoami # Show current AWS identity
task aws:regions # Show regions used by this infrastructure