Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Terraform demo #77

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Day-2/PROJECT-vpc-with-ec2/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -76,16 +76,16 @@ resource "aws_s3_bucket" "example" {


resource "aws_instance" "webserver1" {
ami = "ami-0261755bbcb8c4a84"
instance_type = "t2.micro"
ami = var.ami_id
instance_type = var.instance_type
vpc_security_group_ids = [aws_security_group.webSg.id]
subnet_id = aws_subnet.sub1.id
user_data = base64encode(file("userdata.sh"))
}

resource "aws_instance" "webserver2" {
ami = "ami-0261755bbcb8c4a84"
instance_type = "t2.micro"
ami = var.ami_id
instance_type = var.instance_type
vpc_security_group_ids = [aws_security_group.webSg.id]
subnet_id = aws_subnet.sub2.id
user_data = base64encode(file("userdata1.sh"))
Expand Down
2 changes: 2 additions & 0 deletions Day-2/PROJECT-vpc-with-ec2/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ami_id = "ami-0261755bbcb8c4a84"
instance_type = "t2.micro"
8 changes: 8 additions & 0 deletions Day-2/PROJECT-vpc-with-ec2/variables.tf
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
variable "cidr" {
default = "10.0.0.0/16"
}
variable "ami_id" {
description = "EC2 AMI Id"
type = string
}
variable "instance_type" {
description = "EC2 Instance Type"
type = string
}