NSX-T Automation using Terraform: The why!


Hi all, I hope you are all doing well during these trying times.

For months, possibly even years, I’ve been convincing myself I’d dive into automation.  What better time than one where I am forced into isolation with my laptop.  In truth, I was jolted into action by a business requirement for automating the build of a number of environments.  These environments had to be standardised and utilise many of the same configuration elements.

I’ve spent the better part of a month learning about Cloud (AWS and VMC on AWS) along with Network Automation, which brings us onto our first section…

Why Terraform?

I first began by googling ‘Network Automation Tools’ and reading a ton of articles.  Whittling down my options based on my requirements, I decided to talk to a number of Automation engineers. Asking them what they thought about Terraform and Ansible, my top 2 prospective tools.  I learnt a ton from both of these methods!

If like me, you research the 2, you’ll find Terraform appears to be more of an Orchestrator and Ansible is more of a Configuration Management System. The way I differentiate between the 2 is Orchestration is about standing up the foundational infrastructure and the Configuration Management System is about keeping systems standardised (think webserver).

There seems to be a fair amount of overlap between Terraform and Ansible, which I expected.  I decided learning both would only strengthen my understanding of Network Automation.  Allowing me to pick the best tool for the job in the future.

Disclaimer: At this stage, I’ve only worked with Terraform.  I plan to take Ansible for a long drive in the coming weeks.

I decided I would start with Terraform as one of my favourite bloggers Nico wrote a number of pieces around VMC and Terraform automation.  He also pointed me in Gilles direction, who also had a number of superb articles.  Nico and Gilles got me showing tangible results in a matter of hours/days. Spinning up VMC environments using Terraform (my main requirement).

My experience with Terraform.

Over the past few weeks, I’ve enjoyed working with Terraform.   First using it to spin up VMC instances and then moving onto using it in native NSX-T environments.  While there are a number of use cases listed on terraform.io, I was most intrigued with Terraforms declarative native, the disposable environments and the scaling ability.

If you decide to play with Terraform, you’ll find out your file structure gets built up by provider(s), modules and Terraform files (.tf).  I’ll cover this in more detail in a future blog.  The structure of the file system and the semi-readable code meant this was easy to pick up.

Most importantly, did Terraform allow me to meet my requirements? In short, yes! I’m using the “vmc” and “nsxt” provider to automate the build of VMC environments. I’m able to use common configuration elements by using modules. This has allowed me to deploy different environments with the same IP sets/groups for example. Then using terraform files with variables for the custom elements. What has really helped during the proof of concept stage, is the ability to spin these environments up and down quickly and with ease (disposable environments).

Closing.

The post was a lot fluffier than I originally intended.  I wanted to get into the meat of Terraform, but it was recommended I start the series with the why and then move into the how in my next post.

I plan on getting these blog posts out fairly quickly as I have well and truly been bitten by the automation bug.  If you enjoyed reading this and want to follow me on Twitter or LinkedIn, please feel free.

Before I sign off, one last shout out to Rutger and the great post on Terraform and NSX-T.


Be the first to comment

Leave a Reply

Your email address will not be published.


*


This site uses Akismet to reduce spam. Learn how your comment data is processed.