AI Just Deployed My Azure VM Using Terraform

I let AI write my Terraform code... and it just deployed an Azure VM

Hey DevOps Engineers,

Today I put Mistral AI to the test — and it wrote the entire Terraform code needed to deploy an Ubuntu VM on Azure.

It took less than 30 seconds. Here’s exactly how I did it 👇

🚀 What I Wanted:

I needed to deploy:

  • Ubuntu 22.04 VM on Azure

  • Standard_B1s size

  • VNet + Subnet

  • Public IP + NIC

  • SSH access using my own locally generated key

  • And yes — a Network Security Group to allow port 22

🤖 What I Asked Mistral AI:

“Generate Terraform code to deploy an Ubuntu 22.04 VM on Azure with a VNet, subnet, public IP, NSG that allows port 22, and use a public SSH key located at ~/.ssh/azure_terraform_key.pub. Output the VM’s public IP.”

⚙️ What I Did Next:

  1. Pasted the output into main.tf

  2. Ran terraform init + terraform apply

  3. Azure spun up my VM in less than 3 minutes

🔐 How I Generated the SSH Key:

If you’re following along:

bash

CopyEdit

ssh-keygen -t rsa -b 4096 -f ~/.ssh/azure_terraform_key

Then inject it in Terraform:

hcl

CopyEdit

public_key = file("~/.ssh/azure_terraform_key.pub")

✅ How I Checked It Worked:

bash

az vm get-instance-view --name myUbuntuVM --resource-group my-rg --query "instanceView.statuses[?starts_with(code,'PowerState/')].displayStatus" -o tsv

Output: VM running

Then I SSH’d in:

bash

ssh -i ~/.ssh/azure_terraform_key azureuser@<public-ip>

Boom — live Ubuntu VM in the cloud. AI-generated. Terraform-applied.

🧠 Why This Matters:

This is where DevOps is headed:

  • You describe infrastructure in plain English.

  • AI writes the Terraform.

  • You deploy to azure in minutes.

📥 Want the Full Source Code?

Subscribe and I’ll send you:

✅ The complete Terraform setup for Azure
✅ main.tf with AI-generated infrastructure code
✅ SSH key instructions and config
✅ Pre-baked VNet, Subnet, NSG, and VM blocks
✅ Public IP + NIC config
✅ Mistral AI prompt used to generate everything
✅ Deployment and teardown instructions (terraform apply / destroy)
✅ Access to upcoming AI + DevOps labs

📺 Full YouTube Breakdown

🙌 If this helped, share it with your team, your feed, or your future self.