DevOps Classroom notes 22/Sep/2024

Azure Ntier Architecture

  • Overview
    Preview
  • Create network and subnets Refer Here
  • Create a webnsg where
    • 80,443 and 22 port are open from anywhere
  • Refer Here for the changes done to add web nsg
  • Now add app nsg which opens 8000 port within network Refer Here for changes done
  • create a public ip address Refer Here for the changes
  • create a network interface in web subnet with public ip and web nsg attached Refer Here for changes
  • now attach network interface to the vm
  • while creating the vm specify
    • size
    • os image
  • Refer Here for official docs of microsoft azure to create linux vm from terraform
  • Refer Here

Datasource

  • We can use Datasource in terraform to fetch the information about resource
  • Refer Here for official docs
  • View the classroom recording for examples
terraform {
  required_providers {
    azurerm = {
      source  = "hashicorp/azurerm"
      version = "4.3.0"
    }
    aws = {
      source  = "hashicorp/aws"
      version = "5.68.0"
    }
  }
}

provider "azurerm" {
  features {}
}

provider "aws" {
}

# lets fetch default vpc id of mumbai region
data "aws_vpc" "default" {
  default = true
}

output "default-vpc-id" {
  value = data.aws_vpc.default.id
}

data "azurerm_network_security_group" "web" {
    name = "web"
    resource_group_name = "ntier"

}

output "nsg_id" {
    value = data.azurerm_network_security_group.web.id
}

# get the resource group name and location and create a new network
data "azurerm_resource_group" "base" {
    name = "ntier1"
}

resource "azurerm_virtual_network" "new" {
    name = "new"
    resource_group_name = data.azurerm_resource_group.base.name
    location = data.azurerm_resource_group.base.location
    address_space = ["10.0.0.0/16"]

}

Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a Reply

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

Please turn AdBlock off
Plugin for Social Media by Acurax Wordpress Design Studio

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube