-
Notifications
You must be signed in to change notification settings - Fork 56
/
Copy pathoutputs.tf
74 lines (47 loc) · 2.26 KB
/
outputs.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
// more output examples:
// https://github.com/terraform-aws-modules/terraform-aws-ec2-instance/blob/master/outputs.tf
// Save Kali Private key on local file kali.pem
resource "local_file" "private_key" {
content = tls_private_key.kali-rsa-key.private_key_pem
filename = "kali.pem"
file_permission = "400"
}
output "ssh_ec2_kali_linux_connect" {
#value = "ssh -i kali.pem -L 3390:127.0.0.1:3389 -o StrictHostKeyChecking=no -o IdentitiesOnly=yes kali@${aws_instance.kali.public_ip}"
value = "ssh -i kali.pem -L 3390:127.0.0.1:3389 -o StrictHostKeyChecking=no -o IdentitiesOnly=yes kali@${var.duckdns_domain}.duckdns.org"
depends_on = [aws_instance.kali]
}
output "ssh_ec2_kali_linux_wireguard" {
value = "scp -i kali.pem -o StrictHostKeyChecking=no -o IdentitiesOnly=yes kali@${var.duckdns_domain}.duckdns.org:/home/kali/client_vpn.wg ."
depends_on = [aws_instance.kali]
}
# Output ssh for each user
output "ssh_ec2_user_linux_connect" {
value = [for user in local.usernames : "ssh -i outputs/${user}/${user}.key -L 3390:127.0.0.1:3389 -o StrictHostKeyChecking=no -o IdentitiesOnly=yes ${user}@${var.duckdns_domain}.duckdns.org" ]
depends_on = [aws_instance.kali]
}
output "metasploitable3_output_ip" {
value = length(aws_instance.metasploitable3) > 0 ? "metasploit ip: @${aws_instance.metasploitable3[0].private_ip}" : null
depends_on = [aws_instance.metasploitable3]
}
output "windowsserver2012R2_output_ip" {
value = length(aws_instance.windowsserver2012R2) > 0 ? "windowsserver2012R2 ip: @${aws_instance.windowsserver2012R2[0].private_ip}" : null
depends_on = [aws_instance.windowsserver2012R2]
}
output "dvca_output_ip" {
value = length(aws_instance.dvca) > 0 ? "dvca ip: @${aws_instance.dvca[0].private_ip}" : null
depends_on = [aws_instance.dvca]
}
#output "serveless_goat_output" {
# value = length(aws_instance.serveless-goat) > 0 ? "serveless-goat outputs: @${aws_cloudformation_stack.serverless-goat.outputs}" : null
#
# depends_on = [
# aws_instance.serveless-goat,
# ]
#}
#output "ssh_eip_kali_linux_connect" {
# value = "ssh -i kali.pem -o IdentitiesOnly=yes kali@${aws_eip.ElasticIP.public_ip}"
#}
output "kali_dyndns" {
value = "nslookup ${var.duckdns_domain}.duckdns.org # {aws_instance.kali.public_ip} "
}