Skip to content

Commit

Permalink
Added EC2 instance to host Defect Dojo
Browse files Browse the repository at this point in the history
  • Loading branch information
jodiejones-moj committed Oct 31, 2024
1 parent e8082af commit ff85ff1
Showing 1 changed file with 48 additions and 1 deletion.
49 changes: 48 additions & 1 deletion terraform/environments/panda-cyber-appsec-lab/ec2.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Kali Linux Instance
resource "aws_instance" "kali_linux" {
#checkov:skip=CKV_AWS_88:instance requires internet access
ami = "ami-0f398bcc12f72f967" // aws-marketplace/kali-last-snapshot-amd64-2024.2.0-804fcc46-63fc-4eb6-85a1-50e66d6c7215
associate_public_ip_address = true
instance_type = "t2.micro"
Expand Down Expand Up @@ -50,6 +49,54 @@ resource "aws_instance" "kali_linux" {
}
}


# Defect Dojo Instance
resource "aws_instance" "defect_dojo" {
ami = "ami-0e8d228ad90af673b"
associate_public_ip_address = true
instance_type = "t2.micro"
subnet_id = module.vpc.private_subnets.0
vpc_security_group_ids = [aws_security_group.kali_linux_sg.id]
iam_instance_profile = aws_iam_instance_profile.ssm_instance_profile.name
ebs_optimized = true
metadata_options {
http_tokens = "required"
}
root_block_device {
encrypted = true
volume_size = 60
}
ebs_block_device {
device_name = "/dev/xvda"
volume_size = 5
encrypted = true
}
user_data = <<-EOF
#!/bin/bash
# Update and install dependencies
apt-get update
apt-get upgrade
apt-get install -y docker.io docker-compose
# Start Docker
systemctl start docker
systemctl enable docker
# Clone DefectDojo Docker repo
git clone https://github.com/DefectDojo/django-DefectDojo.git /opt/defectdojo
cd /opt/defectdojo
# Run DefectDojo using Docker Compose
docker-compose up -d
EOF

tags = {
Name = "Defect-Dojo"
}
}


# Security Group for Kali instance
# trivy:ignore:AVD-AWS-0104
resource "aws_security_group" "kali_linux_sg" {
Expand Down

0 comments on commit ff85ff1

Please sign in to comment.