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.
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.
Next up… Cloning the GitHub project, and selecting the cloudshell share that was mounted locally ;
Choose the repo, and “Clone”!
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.
Now let’s add some tags to the configuration…
And our resource group will be altered to match our desired state!
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!