Terraform is an Infrastructure as Code (IaC) tool developed by HashiCorp.
Think of it as a universal remote control for cloud infrastructure. Instead of clicking buttons in the cloud console, you write code (in HCL – HashiCorp Configuration Language) to describe what you want, and Terraform makes it happen.
terraform plan shows you what will change before applying.| Term | Meaning |
|---|---|
| Provider | The plugin that knows how to talk to your cloud (e.g., google, azurerm) |
| Resource | A cloud thing you want to create (VM, network, firewall, etc.) |
| Variable | A parameter you can set to reuse code |
| State | Terraform’s record of what’s been created, so it knows what to change |
| Attribute | Properties or configurations of the resources, often required to create or manage it |
We’ll create this exact setup in both GCP and Azure:
+-------------------+ +-------------------+
| VPC | | Virtual Network|
| (Google Cloud) | | (Azure) |
+---------+----------+ +---------+---------+
| |
+-----+-----+ +-----+-----+
| Subnet | | Subnet |
+-----+-----+ +-----+-----+
| |
+-----+-----+ +-----+-----+
| Firewall | | NSG Rule |
+-----+-----+ +-----+-----+
| |
+-----+-----+ +-----+-----+
| Compute VM | | Virtual VM |
+-----------+ +------------+
Before creating resources:
Install Terraform