Terraform with VirtualBox

So I wanted to learn how to use Terraform, it is something that is quite interesting but I have never got to use it.

I had to sort that out. 👍

I could have made it build me a VM instance on the cloud but I currently don't have the need for that as I have the Kali VM that I use for messing around with CTFs hosted locally.

So I decided to go with Virtual Box, also this stops any issues like for example me building the wrong VM instance and my card screaming at me.

So my first order of business was to create a new folder and create the terraform.tf file in there.

I then used the boiler plate code that can be found on the HashiCorp website here : https://registry.terraform.io/providers/terra-farm/virtualbox/latest/docs. 

Using "terraform init" to initialise a Terraform instance then "terraform apply".

But I ran into some issues with that.

For starters the first issue that will arise is that the version specified in this template is no longer the current version and a error like below will be given.


To sort this error all that you will need to do is change the version number. From "0.2.1" to "0.2.2-alpha.1"

 

Then after re-running the terraform you will get another issue saying Error: [ERROR] Starting VM: exit status 1

This was because the network adapter hadn't been created in Virtual Box. After creating a network adapter in Virtual Box and changing the name in the terraform file and I was finally able to create my first VMs with terraform.

I plan on playing around with Terraform in the cloud later on this week as I think that could be quite fun and I could get up to all sorts.

Hope this helped anyone who experienced similar issues.






Comments

Popular posts from this blog

Finding all Network Interfaces that are connected to Virtual Machines in Azure

AD PowerShell script to add/remove a list of users from a group