Added all machines to the terraform list

This commit is contained in:
VakarisZ 2019-12-12 17:26:40 +02:00
parent dd435be8e2
commit 79dade2a3f
3 changed files with 185 additions and 19 deletions

View File

@ -1,6 +1,6 @@
resource "aws_instance" "os_test_machine" { resource "aws_instance" "os_test_machine" {
ami = "${var.ami}" ami = "${var.ami}"
instance_type = "t2.micro" instance_type = "${var.type}"
private_ip = "${var.ip}" private_ip = "${var.ip}"
subnet_id = "${data.aws_subnet.main.id}" subnet_id = "${data.aws_subnet.main.id}"
key_name = "os_compat" key_name = "os_compat"

View File

@ -1,6 +1,10 @@
variable "ami" {type=string} variable "ami" {type=string}
variable "ip" {type=string} variable "ip" {type=string}
variable "name" {type=string} variable "name" {type=string}
variable "type" {
type=string
default="t2.micro"
}
variable "user_data" { variable "user_data" {
type=string type=string
default="" default=""

View File

@ -47,6 +47,32 @@ wget --no-check-certificate https://10.0.0.251:5000/api/monkey/download/monkey-l
chmod +x ./monkey-linux-64 chmod +x ./monkey-linux-64
./monkey-linux-64 m0nk3y -s 10.0.0.251:5000 ./monkey-linux-64 m0nk3y -s 10.0.0.251:5000
--// --//
EOF
user_data_linux_32 = <<EOF
Content-Type: multipart/mixed; boundary="//"
MIME-Version: 1.0
--//
Content-Type: text/cloud-config; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="cloud-config.txt"
#cloud-config
cloud_final_modules:
- [scripts-user, always]
--//
Content-Type: text/x-shellscript; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment; filename="userdata.txt"
#!/bin/bash
wget --no-check-certificate https://10.0.0.251:5000/api/monkey/download/monkey-linux-32 || curl https://10.0.0.251:5000/api/monkey/download/monkey-linux-32 -k -o monkey-linux-32
chmod +x ./monkey-linux-32
./monkey-linux-32 m0nk3y -s 10.0.0.251:5000
--//
EOF EOF
user_data_windows_64 = <<EOF user_data_windows_64 = <<EOF
@ -90,15 +116,51 @@ C:\windows\temp\monkey-windows-32.exe m0nk3y -s 10.0.0.251:5000
</powershell> </powershell>
<persist>true</persist> <persist>true</persist>
EOF EOF
}
user_data_windows_bits_32 = <<EOF module "centos_6" {
<script> source = "./instance_template"
bitsadmin /transfer Update /download /priority high https://10.0.0.251:5000/api/monkey/download/monkey-windows-32.exe C:\windows\temp\monkey-windows-32.exe name = "centos_6"
powershell -Command "(New-Object Net.WebClient).DownloadFile('https://github.com/guardicore/monkey/releases/download/1.6/monkey-linux-32', 'package.zip')" ami = "ami-07fa74e425f2abf29"
C:\windows\temp\monkey-windows-32.exe m0nk3y -s 10.0.0.251:5000 ip = "10.0.0.36"
</script> env_vars = "${local.env_vars}"
<persist>true</persist> user_data = "${local.user_data_linux_64}"
EOF }
module "centos_7" {
source = "./instance_template"
name = "centos_7"
ami = "ami-0034b52a39b9fb0e8"
ip = "10.0.0.37"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}"
}
module "centos_8" {
source = "./instance_template"
name = "centos_8"
ami = "ami-0034c84e4e9c557bd"
ip = "10.0.0.38"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}"
}
module "suse_12" {
source = "./instance_template"
name = "suse_12"
ami = "ami-07b12b913a7e36b08"
ip = "10.0.0.42"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}"
}
module "suse_11" {
source = "./instance_template"
name = "suse_11"
ami = "ami-0083986c"
ip = "10.0.0.41"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}"
} }
module "kali_2019" { module "kali_2019" {
@ -109,6 +171,34 @@ module "kali_2019" {
env_vars = "${local.env_vars}" env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}" user_data = "${local.user_data_linux_64}"
} }
// Requires m3.medium
//module "rhel_5" {
// source = "./instance_template"
// name = "rhel_5"
// ami = "ami-a48cbfb9"
// type = "m3.medium"
// ip = "10.0.0.85"
// env_vars = "${local.env_vars}"
// user_data = "${local.user_data_linux_64}"
//}
module "rhel_6" {
source = "./instance_template"
name = "rhel_6"
ami = "ami-0af3f0e0918f47bcf"
ip = "10.0.0.86"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}"
}
module "rhel_7" {
source = "./instance_template"
name = "rhel_7"
ami = "ami-0b5edb134b768706c"
ip = "10.0.0.87"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}"
}
module "rhel_8" { module "rhel_8" {
source = "./instance_template" source = "./instance_template"
@ -119,6 +209,51 @@ module "rhel_8" {
user_data = "${local.user_data_linux_64}" user_data = "${local.user_data_linux_64}"
} }
module "debian_7" {
source = "./instance_template"
name = "debian_7"
ami = "ami-0badcc5b522737046"
ip = "10.0.0.77"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}"
}
module "debian_8" {
source = "./instance_template"
name = "debian_8"
ami = "ami-0badcc5b522737046"
ip = "10.0.0.78"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}"
}
module "debian_9" {
source = "./instance_template"
name = "debian_9"
ami = "ami-0badcc5b522737046"
ip = "10.0.0.79"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}"
}
module "oracle_6" {
source = "./instance_template"
name = "oracle_6"
ami = "ami-0f9b69f34108a3770"
ip = "10.0.0.66"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}"
}
module "oracle_7" {
source = "./instance_template"
name = "oracle_7"
ami = "ami-001e494dc0f3372bc"
ip = "10.0.0.67"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}"
}
module "ubuntu_12" { module "ubuntu_12" {
source = "./instance_template" source = "./instance_template"
name = "ubuntu_12" name = "ubuntu_12"
@ -128,6 +263,16 @@ module "ubuntu_12" {
user_data = "${local.user_data_linux_64}" user_data = "${local.user_data_linux_64}"
} }
// Requires m3.medium instance
// module "ubuntu_12_32" {
// source = "./instance_template"
// name = "ubuntu_12_32"
// ami = "ami-06003c1b"
// ip = "10.0.0.23"
// env_vars = "${local.env_vars}"
// user_data = "${local.user_data_linux_32}"
// }
module "ubuntu_14" { module "ubuntu_14" {
source = "./instance_template" source = "./instance_template"
name = "ubuntu_14" name = "ubuntu_14"
@ -146,16 +291,6 @@ module "ubuntu_19" {
user_data = "${local.user_data_linux_64}" user_data = "${local.user_data_linux_64}"
} }
module "centos" {
source = "./instance_template"
name = "centos_8"
ami = "ami-0034c84e4e9c557bd"
ip = "10.0.0.33"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_linux_64}"
}
module "windows_2003_r2_32" { module "windows_2003_r2_32" {
source = "./instance_template" source = "./instance_template"
name = "windows_2003_r2_32" name = "windows_2003_r2_32"
@ -165,6 +300,15 @@ module "windows_2003_r2_32" {
user_data = "${local.user_data_windows_64}" user_data = "${local.user_data_windows_64}"
} }
module "windows_2003" {
source = "./instance_template"
name = "windows_2003"
ami = "ami-9e023183"
ip = "10.0.0.5"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_windows_64}"
}
module "windows_2008" { module "windows_2008" {
source = "./instance_template" source = "./instance_template"
name = "windows_2008" name = "windows_2008"
@ -174,6 +318,15 @@ module "windows_2008" {
user_data = "${local.user_data_windows_64}" user_data = "${local.user_data_windows_64}"
} }
module "windows_2008_32" {
source = "./instance_template"
name = "windows_2008"
ami = "ami-0acaec54bac5cbb8f"
ip = "10.0.0.6"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_windows_32}"
}
module "windows_2008_r2" { module "windows_2008_r2" {
source = "./instance_template" source = "./instance_template"
name = "windows_2008_r2" name = "windows_2008_r2"
@ -201,6 +354,15 @@ module "windows_2012_r2" {
user_data = "${local.user_data_windows_64}" user_data = "${local.user_data_windows_64}"
} }
module "windows_2016" {
source = "./instance_template"
name = "windows_2016"
ami = "ami-02a6791b44938cfcd"
ip = "10.0.0.16"
env_vars = "${local.env_vars}"
user_data = "${local.user_data_windows_64}"
}
module "windows_2019" { module "windows_2019" {
source = "./instance_template" source = "./instance_template"
name = "windows_2019" name = "windows_2019"