Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 13 additions & 12 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,16 @@ resource "aws_security_group" "web" {
}
}

# EC2 instance will be added here by the AI agent
# Example:
# resource "aws_instance" "web" {
# ami = "ami-0c55b159cbfafe1f0"
# instance_type = "t2.micro"
# subnet_id = aws_subnet.public.id
# security_groups = [aws_security_group.web.id]
#
# tags = {
# Name = "web-server"
# }
# }
# EC2 instance resource
resource "aws_instance" "web" {
ami = var.ami_id
instance_type = var.instance_type
subnet_id = aws_subnet.public.id
vpc_security_group_ids = [aws_security_group.web.id]

associate_public_ip_address = true

tags = {
Name = "web-server"
}
}
19 changes: 9 additions & 10 deletions outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@ output "security_group_id" {
value = aws_security_group.web.id
}

# Future outputs for the EC2 instance
# output "instance_id" {
# description = "ID of the EC2 instance"
# value = aws_instance.web.id
# }
#
# output "public_ip" {
# description = "Public IP of the EC2 instance"
# value = aws_instance.web.public_ip
# }
output "instance_id" {
description = "ID of the EC2 instance"
value = aws_instance.web.id
}

output "public_ip" {
description = "Public IP of the EC2 instance"
value = aws_instance.web.public_ip
}
3 changes: 1 addition & 2 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ variable "subnet_cidr" {
default = "10.0.1.0/24"
}

# Variables that would be needed for the EC2 instance
variable "ami_id" {
description = "AMI ID for the EC2 instance"
type = string
Expand All @@ -27,4 +26,4 @@ variable "instance_type" {
description = "EC2 instance type"
type = string
default = "t2.micro"
}
}
Loading