Loading...

Skip to main content

Terraform

Terraform is HashiCorp's open-source Infrastructure as Code (IaC) tool for provisioning and managing cloud infrastructure using declarative HCL configuration files. It is the primary IaC tool for infrastructure work at Aliz, jointly maintained by Google and HashiCorp with first-class Google Cloud support.

What is Terraform​

Terraform uses a declarative configuration language (HCL) to describe desired infrastructure state, then reconciles actual infrastructure to match. It manages the full lifecycle — create, update, and destroy — across 6,700+ providers covering every major cloud and SaaS platform. The current stable release is in the 1.x series, with the Google Cloud provider at v7.37.0 (15.1M downloads/week).

Why we recommend it​

  • Official Google Cloud partner integration — the google and google-beta providers are jointly maintained by Google and HashiCorp, ensuring timely support for new GCP services
  • Multi-cloud unified syntax — a single language and workflow manages GCP, AWS, Azure, and other providers without tool switching
  • Plan-apply separation — terraform plan shows exactly what will change before any mutation, preventing production surprises
  • State-driven infrastructure — Terraform tracks resource state, enabling drift detection and incremental updates rather than full re-provisioning
  • Collaborative workflows — HCP Terraform (formerly Terraform Cloud) provides remote state, policy enforcement, and run pipelines for teams
  • Automatic dependency management — the resource graph resolves creation and destruction order, parallelizing where safe

When to use​

  • Multi-tier GCP deployments (networking, compute, databases, IAM)
  • Multi-cloud or hybrid environments requiring unified tooling
  • Infrastructure requiring version control and code review workflows
  • Team environments needing access control, audit trails, and approval gates
  • Kubernetes cluster provisioning (google_container_cluster)
  • Repeatable infrastructure patterns via reusable modules

When NOT to use​

  • Complex procedural logic — combine Terraform with shell scripts or a general-purpose language when heavy conditionals or loops are needed
  • Application configuration management — use Ansible, Chef, or Puppet for OS-level and application-layer configuration
  • Static, simple infrastructure — a single VM or Cloud Run service may be faster to manage via the console or gcloud CLI
  • Teams without IaC experience — the learning curve for state management and HCL can slow initial delivery; invest in training first
  • Rapid one-off prototyping — disposable experiments are faster with imperative CLI commands
caution

State files contain sensitive data (resource IDs, outputs, and sometimes secrets). Always encrypt and secure state, especially in team environments. Use HCP Terraform or a remote state backend (e.g., GCS with encryption) — never commit state files to version control.

Resources​