AZURE HEROES
  • Home-Updates
  • Blog
    • Azure Blog
    • Azure Heroes Events >
      • Azure Heroes Sessions #1
      • Azure Heroes Sessions #2
      • Azure Heroes Sessions #3
      • Azure Heroes Sessions #4
      • Azure Heroes Sessions #5
      • Azure Heroes Sessions #6
      • Azure Heroes Sessions #7
  • Who We Are!
  • eBooks
  • Azure All In One!
    • Azure Disk & Storage
    • Azure Network
    • Azure VPN
    • Azure VMs
  • Free Azure Support!
  • Contact Us
  • Events
    • Beginners Event
    • Developers Event
    • Special Event
    • Azure Workshop #4
    • Azure Workshop #5
    • Azure Workshop #6
    • Azure Workshop #7
    • Azure Workshop #8
    • Upcoming Events
  • Registration Form
  • Privacy Policy
  • Home-Updates
  • Blog
    • Azure Blog
    • Azure Heroes Events >
      • Azure Heroes Sessions #1
      • Azure Heroes Sessions #2
      • Azure Heroes Sessions #3
      • Azure Heroes Sessions #4
      • Azure Heroes Sessions #5
      • Azure Heroes Sessions #6
      • Azure Heroes Sessions #7
  • Who We Are!
  • eBooks
  • Azure All In One!
    • Azure Disk & Storage
    • Azure Network
    • Azure VPN
    • Azure VMs
  • Free Azure Support!
  • Contact Us
  • Events
    • Beginners Event
    • Developers Event
    • Special Event
    • Azure Workshop #4
    • Azure Workshop #5
    • Azure Workshop #6
    • Azure Workshop #7
    • Azure Workshop #8
    • Upcoming Events
  • Registration Form
  • Privacy Policy

Terraform with Azure From Zero to Hero

1/20/2022

1 Comment

 
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
Picture
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:

  • Lowers the potential for human errors while deploying and managing infrastructure.
  • Deploys the same template multiple times to create identical development, test, and production environments.
  • Reduces the cost of development and test environments by creating them on-demand.
Prerequisites
  • Terraform 0.14.9 or later
  • The Azure CLI Tool installed
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:-
  • Open source
  • Declarative language
  • Replicating infrastructure
  • Platform Agnostic

Terraform Components
  • Core: Configuration, State file (terraform.tfstate)
  • Provider:  AWS, Azure,K8s,,,
Authenticate Terraform with Azure:
Picture
Picture
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:

Picture
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:
Picture
Best Practice/Recommended
Picture
Sample Example

Create Resource Group & Network Security Group
Picture
Picture
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.

    Picture
    Picture
    Top 10 Microsoft Azure Blogs

    Archives

    November 2022
    October 2022
    July 2022
    June 2022
    May 2022
    April 2022
    March 2022
    February 2022
    January 2022
    December 2021
    November 2021
    May 2021
    February 2021
    December 2020
    November 2020
    October 2020
    September 2020
    August 2020
    June 2020
    April 2020
    January 2020
    July 2019
    June 2019
    May 2019
    February 2019
    January 2019

    Categories

    All
    AKS
    Azure
    Beginner
    CDN
    DevOps
    End Of Support
    Fundamentals
    Guide
    Hybrid
    License
    Migration
    Network
    Security
    SQL
    Storage
    Virtual Machines
    WAF

    RSS Feed

    Follow
    Free counters!
Powered by Create your own unique website with customizable templates.