DevOps Classroom notes 20/Aug/2026

terraform local variable

Referhere

variable conditions

Referhere

terraform null resource

Referhere Ex: created multiple resources i need that details

provisioner

  1. copy files to existing ec2 instance
  2. run commands or do patching ec2 instance

Azure with terraform

Pre-requests:

  1. azure cli
  2. terraform
  3. git

Local & cicd

az login service prinical

azure providers

terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "=5.0.0"
    }
  }
}

# Configure the Microsoft Azure Provider
provider "azurerm" {
  features {}
}

create resource group

### variables

variable "resource_group_names" {
    type = list(string)
    default = [ "devops", "demo-2" ]
  
}

variable "locations" {
    type = list(string)
    default = [ "Central India", "Central US" ]
  
}

### resources


resource "azurerm_resource_group" "rg" {
  count    = length(var.resource_group_names)

  name     = var.resource_group_names[count.index]
  location = var.locations[count.index]

  managed_by = "devops"

  tags = {
    env = "prod"
  }
}

try task in azure

  1. create resource_group
  2. vnet and subnets
  3. create public ip

Leave a comment

Turn on JavaScript to leave a comment.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Media Icons Powered by Acurax Web Design Company
Exit mobile version
%%footer%%