mirror of
https://github.com/telekom-security/tpotce.git
synced 2025-07-02 01:27:27 -04:00
Rename ec2 to aws
This commit is contained in:
65
cloud/terraform/aws/main.tf
Normal file
65
cloud/terraform/aws/main.tf
Normal file
@ -0,0 +1,65 @@
|
||||
provider "aws" {
|
||||
region = var.ec2_region
|
||||
}
|
||||
|
||||
resource "aws_security_group" "tpot" {
|
||||
name = "T-Pot"
|
||||
description = "T-Pot Honeypot"
|
||||
vpc_id = var.ec2_vpc_id
|
||||
ingress {
|
||||
from_port = 0
|
||||
to_port = 64000
|
||||
protocol = "tcp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
ingress {
|
||||
from_port = 0
|
||||
to_port = 64000
|
||||
protocol = "udp"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
ingress {
|
||||
from_port = 64294
|
||||
to_port = 64294
|
||||
protocol = "tcp"
|
||||
cidr_blocks = var.admin_ip
|
||||
}
|
||||
ingress {
|
||||
from_port = 64295
|
||||
to_port = 64295
|
||||
protocol = "tcp"
|
||||
cidr_blocks = var.admin_ip
|
||||
}
|
||||
ingress {
|
||||
from_port = 64297
|
||||
to_port = 64297
|
||||
protocol = "tcp"
|
||||
cidr_blocks = var.admin_ip
|
||||
}
|
||||
egress {
|
||||
from_port = 0
|
||||
to_port = 0
|
||||
protocol = "-1"
|
||||
cidr_blocks = ["0.0.0.0/0"]
|
||||
}
|
||||
tags = {
|
||||
Name = "T-Pot"
|
||||
}
|
||||
}
|
||||
|
||||
resource "aws_instance" "tpot" {
|
||||
ami = var.ec2_ami[var.ec2_region]
|
||||
instance_type = var.ec2_instance_type
|
||||
key_name = var.ec2_ssh_key_name
|
||||
subnet_id = var.ec2_subnet_id
|
||||
tags = {
|
||||
Name = "T-Pot Honeypot"
|
||||
}
|
||||
root_block_device {
|
||||
volume_type = "gp2"
|
||||
volume_size = 128
|
||||
delete_on_termination = true
|
||||
}
|
||||
user_data = "${file("../cloud-init.yaml")} content: ${base64encode(file("../tpot.conf"))}"
|
||||
vpc_security_group_ids = [aws_security_group.tpot.id]
|
||||
}
|
12
cloud/terraform/aws/outputs.tf
Normal file
12
cloud/terraform/aws/outputs.tf
Normal file
@ -0,0 +1,12 @@
|
||||
output "Admin_UI" {
|
||||
value = "https://${aws_instance.tpot.public_dns}:64294/"
|
||||
}
|
||||
|
||||
output "SSH_Access" {
|
||||
value = "ssh -i {private_key_file} -p 64295 admin@${aws_instance.tpot.public_dns}"
|
||||
}
|
||||
|
||||
output "Web_UI" {
|
||||
value = "https://${aws_instance.tpot.public_dns}:64297/"
|
||||
}
|
||||
|
53
cloud/terraform/aws/variables.tf
Normal file
53
cloud/terraform/aws/variables.tf
Normal file
@ -0,0 +1,53 @@
|
||||
variable "admin_ip" {
|
||||
default = ["127.0.0.1/32"]
|
||||
description = "admin IP addresses in CIDR format"
|
||||
}
|
||||
|
||||
variable "ec2_vpc_id" {
|
||||
description = "ID of AWS VPC"
|
||||
default = "vpc-XXX"
|
||||
}
|
||||
|
||||
variable "ec2_subnet_id" {
|
||||
description = "ID of AWS VPC subnet"
|
||||
default = "subnet-YYY"
|
||||
}
|
||||
|
||||
variable "ec2_region" {
|
||||
description = "AWS region to launch servers"
|
||||
default = "eu-west-1"
|
||||
}
|
||||
|
||||
variable "ec2_ssh_key_name" {
|
||||
default = "default"
|
||||
}
|
||||
|
||||
# https://aws.amazon.com/ec2/instance-types/
|
||||
# t3.large = 2 vCPU, 8 GiB RAM
|
||||
variable "ec2_instance_type" {
|
||||
default = "t3.large"
|
||||
}
|
||||
|
||||
# Refer to https://wiki.debian.org/Cloud/AmazonEC2Image/Stretch
|
||||
variable "ec2_ami" {
|
||||
type = map(string)
|
||||
default = {
|
||||
"ap-northeast-1" = "ami-09fbcd30452841cb9"
|
||||
"ap-northeast-2" = "ami-08363ccce96df1fff"
|
||||
"ap-south-1" = "ami-0dc98cbb0d0e49162"
|
||||
"ap-southeast-1" = "ami-0555b1a5444087dd4"
|
||||
"ap-southeast-2" = "ami-029c54f988446691a"
|
||||
"ca-central-1" = "ami-04413a263a7d94982"
|
||||
"eu-central-1" = "ami-01fb3b7bab31acac5"
|
||||
"eu-north-1" = "ami-050f04ca573daa1fb"
|
||||
"eu-west-1" = "ami-0968f6a31fc6cffc0"
|
||||
"eu-west-2" = "ami-0faa9c9b5399088fd"
|
||||
"eu-west-3" = "ami-0cd23820af84edc85"
|
||||
"sa-east-1" = "ami-030580e61468e54bd"
|
||||
"us-east-1" = "ami-0357081a1383dc76b"
|
||||
"us-east-2" = "ami-09c10a66337c79669"
|
||||
"us-west-1" = "ami-0adbaf2e0ce044437"
|
||||
"us-west-2" = "ami-05a3ef6744aa96514"
|
||||
}
|
||||
}
|
||||
|
3
cloud/terraform/aws/versions.tf
Normal file
3
cloud/terraform/aws/versions.tf
Normal file
@ -0,0 +1,3 @@
|
||||
terraform {
|
||||
required_version = ">= 0.12"
|
||||
}
|
Reference in New Issue
Block a user