Terraform is an open-source tool for provisioning and managing cloud infrastructure. It codifies infrastructure in configuration files that describe the topology of cloud resources. These resources include virtual machines, storage accounts, and networking interfaces. The Terraform CLI provides a simple mechanism to deploy and version the configuration files to Azure Terraform's template-based configuration files enable you to define, provision, and configure Azure resources in a repeatable and predictable manner. Automating infrastructure has several benefits:
Prerequisites
Installation (Windows) PS C:\ > Invoke-WebRequest -Uri https://aka.ms/installazurecliwindows -OutFile .\AzureCLI.msi; Start-Process msiexec.exe -Wait -ArgumentList '/I AzureCLI.msi /quiet'; rm .\AzureCLI.msi PS C:\ > az login With Terraform you can Automate and manage your infrastructure, your platform and services that run on that platformWhy Terraform:-
Terraform Components
Authenticate Terraform with Azure: ![]() Which Tools is better for deploying Azure resources Terraform or Ansible, well while both tools can deploy and manage resources: As a conclusion we can say: Ansbile: Better for configuring the infrastructure Terraform: Better for configuring the infrastructure To write your configuration file, you will be using these syntax: Terraform Commands terraform refresh: Query infrastructure provider to get current state terraform plan: Create an execution plan terraform init: Prepare your working directory for other commands terraform validate: Check whether the configuration is valid terraform apply: Execute the plan terraform destroy: Destroy the resources/infrastructure terraform fmt: Reformat your configuration in the standard style Download Terraform Cheatsheet Organizing Your Terraform Code Either you wirte with the basic form or you use Best Practice/Recommended format Basic: Best Practice/Recommended Sample Example
Create Resource Group & Network Security Group
1 Comment
Maa'n Jn
2/1/2022 01:42:10 pm
Thank you for creating and sharing the sample
Reply
Leave a Reply. |
Author
Mohammad Al Rousan is a Microsoft MVP (Azure), Microsoft Certified Solution Expert (MCSE) in Cloud Platform & Azure DevOps & Infrastructure, An active community blogger and speaker.
Al Rousan has over 8 years of professional experience in IT Infrastructure and very passionate about Microsoft technologies and products. Top 10 Microsoft Azure Blogs
Archives
November 2022
Categories
All
|