From Cloud Dev Station to Terraform landscaping in Azure

Introduction

A lot of people always keep telling me that they love Azure’s Cloud Shell. Oddly enough, I use it more occasionally and find my self using the WSL (Windows Subsystem for Linux) more. If I analyze it a bit, I recon it’s because I want to easily edit & use files with the Azure CLI (etc). Now, the Azure Cloud Shell has a way to persist files! Therefor I embarked on a small test to see what kind of workflow would work whilst working with Terraform and leveraging the Cloud Shell to apply the configurations.

 

Basic Workflow

So what did I come up with? As you know, I’m running my development workstation in the cloud. In addition, I’ve mounted the CloudDrive onto my workstation and cloned my GitHub repo to that location. Next up, I can author my files locally and afterwards push to my repository. As the local files are synced with the CloudDrive, they’ll immediately pop up in my Cloud Shell too. So I can apply them there…

Sounds great? Let’s take it for spin!

 

Setup Cloud Drive

Browse to the storage account that you linked your Cloud Shell. Here you’ll see a share (under Files) called “cloudshell”. Click on the “Connect” button and follow the instructions… 😉

Just as I did onto “My Little Dev Machine” ;

If you would browse to Z:\ (in this case), you’ll see the contents of the CloudDrive.

 

Clone Project

Next up… Cloning the GitHub project, and selecting the cloudshell share that was mounted locally ;

Choose the repo, and “Clone”!

 

Test Drive!

Now let’s go to the Azure Cloud Shell. We can navigate to the newly created folder structure (our “repo”). This contains a terraform file, so let’s start with a “terraform init” ;

 

We see that everything is being set up for first use. Now, let’s apply our configuration.

We’re prompted to confirm that we want to apply this configuration, which seems like a good plan.

Now we’ll see that the configuration is being applied, and that our mega complex setup (just kidding, in this case it was just one resource group) is being deployed.

Now let’s add some tags to the configuration…

Reapply…

And our resource group will be altered to match our desired state!

 

Closing Thoughts

If you found yourself looking for a workflow where you could combine the cloud shell (“managed CLI environment”) with your development workstation… Then I hope this proved as valuable to you, as it did to me. Next to that, if you are unfamiliar with Terraform, do take a good look at it. If automating is (even slightly) part of your day-to-day business, then this should be a tool on your belt!

 

 

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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