VMware Cloud on AWS

VMware Cloud on AWS Terraform deployment – Phase 3

After SDDC deployment in phase 1 and networking and security deployment in phase 2, we are now ready to deploy Virtual Machines in our SDDC. The goal of this final phase is to use Terraform vSphere provider to deploy a Content Library in VMware Cloud on AWS and clone VMs to the 2 NSX segments created earlier. As noted in the phase 1, all source files are available for download here.

Main.tf

Our main.tf module is simple and is used to initiate our state file’s locations and the Virtual Machine module.

Initialization

Similar to phase 1 and 2, we will set a local path for phase 3 state file and read phase 1 and phase 2 data.

vSphere Terraform Provider Setup

The vSphere provider will use vCenter username, password, and vCenter URL from phase 1. The NSX-T provider uses the NSX proxy URL and VMC token from phase 1 as well.

Virtual Machine Module

In this module, we read the outputs from phase 2 and use the two segments created (subnet 12 and 13) where Virtual Machines will be attached.

Variables

In the variables.tf files we will code the standard names for VMware Cloud on AWS data center SDDC

SDDC data

First step is to read the SDDC data using vSphere provider.

Create a Content Library

We will use a Content library from AWS S3 bucket in Frankfurt.

We will wait 30 seconds and read the “blue VM” data.

Then we will:

  • Clone 3 blue Virtual Machines using the demo-count set to 3
  • Attach them to network 12
  • Set a fixed IP address starting at .10
  • Set a default gateway at .1

Note the 2 CPUs, 1GB RAM, and 20 GB disk.

We then repeat the process for 3 “Red Virtual Machines”.

NSX tags

Apply NSX tags using NSXT provider as shown below.

vSphere tags

Apply vSphere tags that are used in the distributed firewall (DFW) rules that we set in phase2.

Deployment

The deploy.sh script will execute terraform init and terraform apply. After 1m30s our 6 VMs are deployed and powered on. Note that with Terraform, a Virtual Machine has only 2 states: ON or GONE!

vCenter view

Tags

This concludes our blog post series on deploying a VMware Cloud on AWS environment from scratch using Terraform. We hope this series helps you in automating some or all your Day 1 and Day 2 tasks. As always, any feedback or comments are welcome!