This chapter covers
- Controlling Terraform from another language
- Breaking down the Terraform machine-readable UI into usable data structures
- Creating hooks to respond to Terraform streaming events as they occur
- Generating valid Terraform using JSON
- Using the CDK for Terraform project to generate valid Terraform from other languages
Terraform is both a tool and a language. The tool is the Terraform or OpenTofu binary itself: an engine and command-line interface (CLI) application that is used to process code written in the Terraform language. The language, as we’ve seen throughout this book, is built on top of HashiCorp Configuration Language (HCL) and is populated with resources, data sources, and functions that are added with the use of providers.
What if you wanted to use Terraform without Terraform? As weird as that may sound, there are a lot of use cases where that comes up. Some teams simply don’t want to learn Terraform and HCL, so they may want to develop their infrastructure as code (IaC) using a language they’re more familiar with. Other teams may have a need to automatically generate Terraform, which is easier to do with JSON than it is with HCL. On the other side of things, teams may want to access the Terraform engine itself using their own language, with the goal of building their own tools on top of Terraform.