From e9f03d8df7da3196527871f7083a00c5cbb77df3 Mon Sep 17 00:00:00 2001 From: YJ <83238190+yj1910@users.noreply.github.com> Date: Fri, 9 Feb 2024 20:14:56 +0530 Subject: [PATCH 1/3] Update ec2.tf --- beginners/aws/modules/ec2/ec2.tf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/beginners/aws/modules/ec2/ec2.tf b/beginners/aws/modules/ec2/ec2.tf index ff5c256..1c752b9 100755 --- a/beginners/aws/modules/ec2/ec2.tf +++ b/beginners/aws/modules/ec2/ec2.tf @@ -16,7 +16,7 @@ data "aws_ami" "ubuntu" { resource "aws_instance" "instance" { ami = data.aws_ami.ubuntu.id - instance_type = "t2.micro" + instance_type = var.instance_type key_name = var.key_pair_name network_interface { @@ -27,5 +27,6 @@ resource "aws_instance" "instance" { tags = { project = "Collabnix" department = "Automation" + Name = "myinstance" } } From 3900ce78097005993d1e58e084d718e175e314a7 Mon Sep 17 00:00:00 2001 From: YJ <83238190+yj1910@users.noreply.github.com> Date: Fri, 9 Feb 2024 20:16:10 +0530 Subject: [PATCH 2/3] Update variables.tf --- beginners/aws/modules/ec2/variables.tf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/beginners/aws/modules/ec2/variables.tf b/beginners/aws/modules/ec2/variables.tf index bd9bcb9..030d410 100755 --- a/beginners/aws/modules/ec2/variables.tf +++ b/beginners/aws/modules/ec2/variables.tf @@ -5,3 +5,7 @@ variable "key_pair_name" { type = string default = "keypair" } + +variable "instance_type" { + default = "t2.micro" +} From 4de805bc58d1f8705d90aad5e72b39a45d72f80b Mon Sep 17 00:00:00 2001 From: YJ <83238190+yj1910@users.noreply.github.com> Date: Fri, 9 Feb 2024 20:21:28 +0530 Subject: [PATCH 3/3] Update outputs.tf --- beginners/aws/modules/ec2/outputs.tf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/beginners/aws/modules/ec2/outputs.tf b/beginners/aws/modules/ec2/outputs.tf index e69de29..3ad4173 100755 --- a/beginners/aws/modules/ec2/outputs.tf +++ b/beginners/aws/modules/ec2/outputs.tf @@ -0,0 +1,3 @@ +output "Instance_Name" { + value= aws_instance.instance.Tags["Name"] +}