DevOps Classroom notes 06/Nov/2025

Scenario – 1: Ntier application infra – AWS – cont

resource <Type> <LABEL> {
    arg1 = value1
    arg2 = valun2
    ..
    argn = valuen

}
  • Types in Hashicorp configuraion language
    • string x = '<value>'
    • number
    • boolean
    • list
    • set
    • map { name='qt', age = 10 }

Creating vpc as desired state in terraform

  • We have written the following block in a file network.tf
# vpc

resource "aws_vpc" "base" {
    cidr_block = "192.168.0.0/16"
    enable_dns_hostnames = true
    tags = {
      Name = "from-tf"
      Env = "Dev"
    }

}
  • Workflow
    • Lets format terraform template terraform fmt
    • Lets validate terraform template terraform validate
    • Lets create infra terraform apply
  • To view the attributes
    • resource: <type>.<label> in console

Now lets create subnets

  • Refer Here for subnet resource
  • To define order of creation we have two options
    • implicit dependency: see the example below
    • explicit depenency: this is acheived by depends_on
resource "aws_subnet" "web" {
  # implicit dependency
  vpc_id            = aws_vpc.base.id 
  availability_zone = "ap-south-1a"
  cidr_block        = "192.168.0.0/24"
  tags = {
    Name = "web"
    Env  = "Dev"
  }
  # explicit dependency
  depends_on = [ aws_vpc.base ]

}
  • Refer Here for the changes done to create vpc with 3 subnets
  • Lets create internet gateway and two route tables Refer Here for changes
Published
Categorized as Uncategorized Tagged

By continuous learner

devops & cloud enthusiastic learner

Leave a ReplyCancel reply

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

Discover more from Direct DevOps from Quality Thought

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

Continue reading

Exit mobile version
%%footer%%