From 532c2b8e16fae203b801166beef12bc02e2e1c12 Mon Sep 17 00:00:00 2001 From: Okesanya Odunayo <94924061+DrInTech22@users.noreply.github.com> Date: Tue, 10 Dec 2024 22:42:56 +0100 Subject: [PATCH] add extra resource --- terraform/ec2.tf | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/terraform/ec2.tf b/terraform/ec2.tf index b305cfc..83f614b 100644 --- a/terraform/ec2.tf +++ b/terraform/ec2.tf @@ -13,4 +13,17 @@ resource "aws_instance" "ec2" { } } +resource "aws_instance" "ec2-1" { + ami = var.ami_id + instance_type = var.instance_type + key_name = var.key_pair_name + subnet_id = aws_subnet.public_subnet.id + vpc_security_group_ids = [aws_security_group.sg.id] + tags = { + Name = var.ec2_name + } + provisioner "local-exec" { + command = "echo 'Instance provisioned: ${self.public_ip}'" + } +} \ No newline at end of file