By Morgan Lucas (she/her) Original post **here from July 2021.* Share this post!*

What is Terraform?

Hashicorp’s once-open source language used to deploy infrastructure using Infrastructure As Code. Can be used in Azure and AWS — And I’ve used it in both.

9/20: Terraform is now OpenTofu

I got to teach myself Terraform, a tool that deploys cloud resources with code (”Here are some rules on how to do this”), but that's what this entire blog is about; Teaching myself things and hoping for work sometimes to make money and being employed by multiple people.

You can be the next one!

Anyway, what do I like about Terraform? A lot. Including all the troubleshooting and digging into new things.

The Numbers on What Was Made:

Project: 1

Resources created: 7

The Bullet Points

Many of these resources are attached to each other - The Network Interface (that allows the VM to communicate with the internet and other computers) is attached to the Virtual Machine, and they’re both in a Security Group which has Security Rules attached to it.

As some things can’t exist without the other, I use depends_on;

depends_on            = [azurerm_network_interface.CA-NetInt] 

The Virtual Network is attached to the Subnet, and the Public IP address is attached to the Network Security Group. This way, The Virtual Machine has internet access, but also has rules about who can access it.

Variables Used: 3

TLDR? Check out the code on GitHub. There are even tiny bonuses, like bits that can be activated later. As of March 2022, It's been cleaned up to be easily readable, with added outputs.

Likes:

It clearly tells you what an error is! Troubleshooting was mostly a breeze, and since I wasn't getting [too] annoyed, I could more easily learn where the mistakes where. For instance, the first line in the main code ('provider') - the azurerm part is not a random name;

provider "azurerm" is an actual thing that connects to Azure.