Table of Contents
Table of Contents
Further Reading
How Terraform works
Teams describe the desired infrastructure in HashiCorp Configuration Language (HCL). Terraform figures out what to create, change, or delete.
- Write: define resources in .tf files.
- Init: download the providers the configuration needs.
- Plan: preview exactly what will change.
- Apply: make the changes and record them in state.
- Destroy: tear down resources when no longer needed.
Key Terraform concepts
- Providers: plugins for AWS, Google Cloud, Azure, Kubernetes, Helm, and more
- Resources: the infrastructure objects Terraform manages
- State: a record of what Terraform has created
- Modules: reusable groups of resources
- Variables: inputs that customize a configuration per environment
Terraform vs. Helm
Teams often use both. They work at different layers.
Why Terraform matters
Terraform makes infrastructure consistent, repeatable, and version-controlled.
- Repeatability: the same files build the same environment every time
- Reviewable changes: plans show changes before they happen
- Multi-cloud: one workflow across many providers
- Modules: reusable building blocks across teams
- Auditability: Git history shows who changed what
Consider a SaaS team that needs a fresh test cluster for each major release. With Terraform, one command builds it, including networking, the cluster, and testing tools.
Common challenges with Terraform
- State management: shared state needs locking and secure storage
- Drift: manual changes break the match between code and reality
- Module sprawl: too many custom modules get hard to maintain
- Secrets: sensitive values must stay out of plain-text state and code
- Licensing: Terraform uses a source-available license; OpenTofu is an open-source fork
How Terraform relates to Testkube
Testkube fits into Terraform-managed infrastructure. Testing becomes part of how environments are built.
- Automated deployment: install and configure Testkube as part of Terraform runs
- Scalable environments: provision Testkube across regions or projects with modules
- Version control: Terraform code for Testkube lives in Git for GitOps and audits
- Simple onboarding: new clusters get Testkube and its dependencies in one apply
- Post-provision tests: pipelines can trigger Testkube after each Terraform change



