Skip to content

Commit

Permalink
add2
Browse files Browse the repository at this point in the history
  • Loading branch information
dibakarpatro committed May 23, 2024
1 parent c775da6 commit a61ad9d
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
10 changes: 10 additions & 0 deletions day02_create_ec2_by_variable/main.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "aws_instance" "name" {
ami = var.ami_id
instance_type = var.instance_type
key_name = var.keyname

tags = {
Name = "newtag"
}

}
11 changes: 11 additions & 0 deletions day02_create_ec2_by_variable/output.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
output "ip" {
value=aws_instance.name.public_ip
description = "calling public ip of ec2 instance"
}

output "private_ip" {
value=aws_instance.name.private_ip
description = "calling private ip of ec2 instance"
sensitive = true

}
4 changes: 4 additions & 0 deletions day02_create_ec2_by_variable/provider.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
provider "aws" {

# Configuration options
}
3 changes: 3 additions & 0 deletions day02_create_ec2_by_variable/terraform.tfvars
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
ami_id = "ami-0bb84b8ffd87024d8"
instance_type = "t2.micro"
keyname = "linux-key"
17 changes: 17 additions & 0 deletions day02_create_ec2_by_variable/variable.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
variable "ami_id" {
description = "we will give the value of ami"
type = string
default = ""
}

variable "instance_type" {
description = "we will five the of instance type"
type = string
default = ""
}

variable "keyname" {
type = string
default = ""

}

0 comments on commit a61ad9d

Please sign in to comment.