A very basic Terraform example to spin up a server on a vRa host and run Chef on it.
I've left this repo in a working state as an example to build more advanced automation off of.
I've made it as generic as possible, parameterized everything, etc. There are still a few places where you need your own files - specifically, the <username>.pem
file that is created by the chef server when setting up your chef account. I don't know of a way around this at this time. I'm sure someone smarter than me already knows the answer - please share here!
The chef provisioning is tested and it works!
-
Clone it down to your local.
-
Install Terraform 11, and make sure it's on your
$PATH
- As of this writing, the vra7 driver was not compatible with TF 12, so stick with 11 for now.
-
Set your environment variables: see my powershell profile gist
-
Copy your chef private key into the local repo:
cp ~/.chef/<username>.pem .
-
Run
terraform init
- This will automatically install the vra7 provider driver for you.
-
Run
terraform plan
-
Run
terraform apply -auto-approve
-
Bask in the ease with which you can now spin up any number of vRa machines!
-
The
server_count
default is 1. To change this:- Edit
main.tf
orvariables.tf
depending on your needs, or - Run TF with a command-line variable argument:
terraform [plan, apply] -var server_count=10
- This applies to any variable defined in
variables.tf
.
- Edit
Get Chef working as a Terraform ProvisionerUpdate node names and other identifying info to be compatible with multi-machine runs.I haven't tested that it doesn't work, but i have a feeling it'll collide with itself without dynamically-incrementing names/id's.
- Get and POC production permisisons and workflow