Skip to content

Commit

Permalink
setting up ec2 instance on apache server
Browse files Browse the repository at this point in the history
  • Loading branch information
chibaba committed Feb 28, 2024
1 parent 9493384 commit b6d01b7
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions infras/gitops3/iteration3/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,23 @@ module "ssh_sg_ingress" {
to_port = 22
protocol = tcp
cidr_blocks = ["0.0.0.0/0"]
}

# AWS EC2 Resource creation

resource "aws_instance" "apache2_server" {
ami = data.aws_ami.ubuntu.id
instance_type = var.instance_type
vpc_security_group_ids = [module.http_sg_ingress.sg_id,
module.generic_sg_egress.sg_id,module.ssh_sg_ingress.sg_id]
key_name = var.ssh_key_name
user_data = file("scripts/user_data.sh")
tags = {
env = var.environment
name = "ec2-${local.name-suffix}"
}
depends_on = [
module.generic_sg_egress
]

}

0 comments on commit b6d01b7

Please sign in to comment.