Skip to content

Commit 532c2b8

Browse files
authored
add extra resource
1 parent c244cc1 commit 532c2b8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

terraform/ec2.tf

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,17 @@ resource "aws_instance" "ec2" {
1313
}
1414
}
1515

16+
resource "aws_instance" "ec2-1" {
17+
ami = var.ami_id
18+
instance_type = var.instance_type
19+
key_name = var.key_pair_name
20+
subnet_id = aws_subnet.public_subnet.id
21+
vpc_security_group_ids = [aws_security_group.sg.id]
22+
tags = {
23+
Name = var.ec2_name
24+
}
1625

26+
provisioner "local-exec" {
27+
command = "echo 'Instance provisioned: ${self.public_ip}'"
28+
}
29+
}

0 commit comments

Comments
 (0)