Azure Terrafy

Infrastructure as code (Iac) is a perfect way to automate your deployment. But sometime it’s difficult to find a point where to start. So here comes Azure Terrafy for rescue. It is an open-source tool that allows you to quickly import your existing Azure infrastructure into Terraform HCL and import it into Terraform state. Below are the steps to use this tool. Just make sure you have Azure CLI installed.

  1. Install Azure Terrafy from go toolchain. Run below cmdlt to install.
    • go install github.com/Azure/aztfy@latest
  2. Once aztfy is installed successfully.
  3. Time to test the newly installed tool. Pick any of the resource group from your Azure infrastructure and run below command.
    • aztfy <Resource-group name>
  4. In our case we are using Resource group named as Win10.

5. Just wait for a while and you will see below output. It will start gathering information about current resources under specified Resource group.

6. Hit w onto the keyboard and you will see import process will start.

7. Wait for a while and you will see the specified resource group is imported into current directory.

8. Go to the folder and open the file and you will complete Terraform files being generated. In our case it’s c:\aztfy

So you can see above how easy it is now to import your existing infrastructure into code.

Happy Learning !!

This entry was posted in Azure. Bookmark the permalink.

Leave a Reply

Your email address will not be published.