File tree Expand file tree Collapse file tree 2 files changed +17
-34
lines changed Expand file tree Collapse file tree 2 files changed +17
-34
lines changed Original file line number Diff line number Diff line change @@ -103,15 +103,14 @@ resource "aws_security_group" "web" {
103103 }
104104}
105105
106- # EC2 instance will be added here by the AI agent
107- # Example:
108- # resource "aws_instance" "web" {
109- # ami = "ami-0c55b159cbfafe1f0"
110- # instance_type = "t2.micro"
111- # subnet_id = aws_subnet.public.id
112- # security_groups = [aws_security_group.web.id]
113- #
114- # tags = {
115- # Name = "web-server"
116- # }
117- # }
106+ # EC2 instance resource
107+ resource "aws_instance" "web" {
108+ ami = var. ami_id
109+ instance_type = var. instance_type
110+ subnet_id = aws_subnet. public . id
111+ vpc_security_group_ids = [aws_security_group . web . id ]
112+
113+ tags = {
114+ Name = " web-server"
115+ }
116+ }
Original file line number Diff line number Diff line change 1- output "vpc_id " {
2- description = " ID of the VPC "
3- value = aws_vpc . main . id
1+ output "instance_id " {
2+ description = " ID of the EC2 instance "
3+ value = aws_instance . web . id
44}
55
6- output "subnet_id " {
7- description = " ID of the public subnet "
8- value = aws_subnet . public . id
6+ output "instance_public_ip " {
7+ description = " Public IP address of the EC2 instance "
8+ value = aws_instance . web . public_ip
99}
10-
11- output "security_group_id" {
12- description = " ID of the security group"
13- value = aws_security_group. web . id
14- }
15-
16- # Future outputs for the EC2 instance
17- # output "instance_id" {
18- # description = "ID of the EC2 instance"
19- # value = aws_instance.web.id
20- # }
21- #
22- # output "public_ip" {
23- # description = "Public IP of the EC2 instance"
24- # value = aws_instance.web.public_ip
25- # }
You can’t perform that action at this time.
0 commit comments