Man things are changing in IT. It changes every day, a matter of fact every second. From AI chatbots like ChatGPT that draft up a whole essay in one go to impersonating someone's whole face and demeanor with DeepFakes, nothing seems out of reach anymore. I mean just 42 years ago not a lot of people knew about Microsoft and that flying cars were the future. So now when I heard you can generate Terraform templates without coding them from scratch I was intrigued. We're going to be looking at Azure Terrafy and NubesGen just to see what they can do.
NubesGen doesn't have too much to choose from in terms of resources but just enough to launch a web application so we'll do just that.
I'm going to name this project demowebapp which will be the name for all my resources. Spin up a web application with spring boot.
Give it a serverless Azure SQL Database and put everything in a private VNET and add on a blob storage. Export the configuration file and voila! this is what the code looks like.
Now let's go ahead and deploy this bad boy in our environment.
Looks like everything worked!
When I heard Terrafy can convert your infrastructure into Terraform code I was like no way I gotta try it! and shocked me when it did. There's a catch though, it only does it on a resource group and resource level (would've been too much power if it did it on a subscription level). So let us go through it together, shall we? For installation guidance, you can follow the guide here.
Let's use the resources we launched for our demowebapp. Going to put it into a folder I made on my desktop. The code to launch the extraction is:
aztfy resource-group <resource group name>
Looks like all the resources have been found. You can use the up and down arrows to look through them 🙂 now let's type 'w' to get the terraform template.
Everything looks good!
Both tools can be used to speed up the process of building environments. I know there are a lot of flaws to them in terms of 'clean code' and 'filing system' but it can be used as a template as intended. Please use caution in using these tools in terms of security and company policy, everything that glitters isn't gold...thank you April Edwards for bringing these tools to our attention, hopefully, it will help someone out there