Find the Best Cosmetic Hospitals

Explore trusted cosmetic hospitals and make a confident choice for your transformation.

“Invest in yourself — your confidence is always worth it.”

Explore Cosmetic Hospitals

Start your journey today — compare options in one place.

Terraform Project – Assignment – Exercise – Lab#1: Variables

How to submit Assignment?

Please submit assignment @https://www.debug.school/ and POST url share in the comments of this post.

Assignment – 1

Write a terraform script using aws ec2 instance and github and apply following kind of variables

  • Types of Terraform variable – Number
  • Types of Terraform variable – String
  • Types of Terraform variable – List
  • Types of Terraform variable – Map
  • Types of Terraform variable – Boolean

and Decare variables in

  • Terraform file
  • Override through Command Line

Example – https://www.devopsschool.com/blog/terraform-variables-complete-reference-guide/

Where to publish – BestDevOps.com & Share a link with me

Assignment – 2

Write a Terraform script which create a ubuntu ec2-instance and copy a ansible playbook, install ansible and run it.

  • Step 1 – Create ec2-instance with key and group
  • Step 2 – Copy playbook using file terraform provisioner
  • Step 3 – Install Ansible using remote terraform provisioner
  • Step 4 – RUn Ansinle playbook command using remote terraform provisioner

Assignment – 3

Write a 2 Module in Terraform. One Local Module, Second remote module.

  • Local Module Spec – in Ubuntu – Setup a webserver
  • Remote module – Setup VPC

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services — all in one place.

Explore Hospitals
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I have worked at <a href="https://www.cotocus.com/">Cotocus</a>. I share tech blog at <a href="https://www.devopsschool.com/">DevOps School</a>, travel stories at <a href="https://www.holidaylandmark.com/">Holiday Landmark</a>, stock market tips at <a href="https://www.stocksmantra.in/">Stocks Mantra</a>, health and fitness guidance at <a href="https://www.mymedicplus.com/">My Medic Plus</a>, product reviews at <a href="https://www.truereviewnow.com/">TrueReviewNow</a> , and SEO strategies at <a href="https://www.wizbrand.com/">Wizbrand.</a> Do you want to learn <a href="https://www.quantumuting.com/">Quantum Computing</a>? <strong>Please find my social handles as below;</strong> <a href="https://www.rajeshkumar.xyz/">Rajesh Kumar Personal Website</a> <a href="https://www.youtube.com/TheDevOpsSchool">Rajesh Kumar at YOUTUBE</a> <a href="https://www.instagram.com/rajeshkumarin">Rajesh Kumar at INSTAGRAM</a> <a href="https://x.com/RajeshKumarIn">Rajesh Kumar at X</a> <a href="https://www.facebook.com/RajeshKumarLog">Rajesh Kumar at FACEBOOK</a> <a href="https://www.linkedin.com/in/rajeshkumarin/">Rajesh Kumar at LINKEDIN</a> <a href="https://www.wizbrand.com/rajeshkumar">Rajesh Kumar at WIZBRAND</a> <a href="https://www.rajeshkumar.xyz/dailylogs">Rajesh Kumar DailyLogs</a>

Related Posts

Top 10 Loan Management Software Tools in 2026: Features, Pros, Cons & Comparison

Introduction As the financial services sector continues to evolve, Loan Management Software (LMS) plays a pivotal role in helping businesses streamline their loan operations, from origination to…

Read More

Top 10 AI Presentation Design Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI presentation design tools have become indispensable for professionals, educators, and students aiming to create visually stunning and impactful slide decks with minimal effort….

Read More

Top 10 Web Design Software Tools in 2026: Features, Pros, Cons & Comparison

Introduction Web design software is a vital tool for both professionals and businesses looking to create visually appealing and functional websites. In 2026, with the increase in…

Read More

Top 10 AI Graphic Design Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI graphic design tools have transformed the creative landscape, empowering designers, marketers, and business owners to produce stunning visuals with unprecedented speed and efficiency….

Read More

Top 10 AI Poster & Flyer Design Tools in 2026: Features, Pros, Cons & Comparison

Introduction In 2026, AI-powered poster and flyer design tools have revolutionized the way businesses, marketers, educators, and creators produce visually stunning promotional materials. These tools leverage artificial…

Read More

Top 10 AI Privacy Compliance Tools in 2026: Features, Pros, Cons & Comparison

Introduction Artificial Intelligence is powering everything from personalized marketing to autonomous systems. But with great power comes greater responsibility—especially when it comes to privacy compliance. In 2026,…

Read More
Subscribe
Notify of
guest
2 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Mak
Mak
2 years ago

2nd
variable “aws_key” {
 default = “/root/terraform/default_ec2.pem”
}

provider “aws” {
 region   = “us-east-1”
 access_key = “”
 secret_key = “”
}
resource “aws_default_vpc” “default” {
}

resource “aws_security_group” “http_server_sg” {
 name  = “http_server_sg”
 vpc_id = aws_default_vpc.default.id

 ingress {
  from_port  = 80
  to_port   = 80
  protocol  = “tcp”
  cidr_blocks = [“0.0.0.0/0”]
 }

 ingress {
  from_port  = 22
  to_port   = 22
  protocol  = “tcp”
  cidr_blocks = [“0.0.0.0/0”]
 }

 egress {
  from_port  = 0
  to_port   = 0
  protocol  = -1
  cidr_blocks = [“0.0.0.0/0”]
 }
}

resource “aws_instance” “ubuntu_instance” {
 ami          = “ami-0261755bbcb8c4a84”
 key_name        = “default_ec2”
 instance_type     = “t2.micro”
 vpc_security_group_ids = [aws_security_group.http_server_sg.id]

 connection {
  type    = “ssh”
  host    = self.public_ip
  user    = “ubuntu”
  private_key = file(var.aws_key)
 }
 provisioner “remote-exec” {
  inline = [
   “sudo apt-add-repository ppa:ansible/ansible -y”,
   “sudo apt update”,
   “sudo apt install ansible -y”
  ]
 }

 provisioner “file” {
  source   = “/root/terraform/playbook.yaml”
  destination = “/home/ubuntu/playbook.yaml”
 }
 provisioner “remote-exec” {
  inline = [
   “sudo ansible-playbook playbook.yaml”
  ]
 }

}


– hosts: localhost
 connection: local
 remote_user: root

 tasks:
 – name: ensure apache is at the latest version
  apt:
   name: apache2
   state: present

Mak
Mak
2 years ago

1st
provider “aws” {
 region   = “us-east-1”
 access_key = “”
 secret_key = “”
}

variable “create_vm” {
 description = “if set to true then create ec2”
 type    = bool
}

variable “number” {
 type  = number
 default = 1
}

data “aws_ami” “aws_linux_2_latest” {
 most_recent = true
 owners   = [“amazon”]
 filter {
  name  = “name”
  values = [“amzn2-ami-hvm-*”]
 }
}

variable “ami” {
 type  = string
 default = “data.aws_ami.aws_linux_2_latest.id”
}

variable “instance_type” {
 type  = string
 default = “t2.micro”
}

variable “names” {
 type  = string
 default = “testing”
}

resource “aws_instance” “instance_string” {
 count     = var.create_vm ? 1 : 0
 ami      = var.ami
 instance_type = var.instance_type
 tags = {
  name = var.names
 }
}

variable “security_list” {
 type  = list(string)
 default = [“sg-0541801a7a059ba17”]
}

variable “instance_tags” {
 type = map(string)
 default = {
  name = “my-instance”
 }
}

resource “aws_instance” “inatance_list” {
 ami          = var.ami
 instance_type     = var.instance_type
 vpc_security_group_ids = var.security_list
 tags          = var.instance_tags
}

2
0
Would love your thoughts, please comment.x
()
x