forked from darrelldavis/terraform-aws-minecraft
-
Notifications
You must be signed in to change notification settings - Fork 0
/
outputs.tf
54 lines (40 loc) · 1.16 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
output "vpc_id" {
value = local.vpc_id
}
output "subnet_id" {
value = local.subnet_id
}
output "public_ip" {
value = module.ec2_minecraft.public_ip
}
output "id" {
value = module.ec2_minecraft.id
}
output "public_key_openssh" {
value = tls_private_key.ec2_ssh.*.public_key_openssh
}
output "public_key" {
value = tls_private_key.ec2_ssh.*.public_key_pem
}
output "private_key" {
value = tls_private_key.ec2_ssh.*.private_key_pem
}
resource "local_file" "private_key" {
count = length(var.key_name) > 0 ? 0 : 1
content = tls_private_key.ec2_ssh[0].private_key_pem
filename = "${path.module}/ec2-private-key.pem"
directory_permission = "0700"
file_permission = "0700"
}
output "zzz_ec2_ssh" {
value = length(var.key_name) > 0 ? "" : <<EOT
Ubuntu: ssh -i ${path.module}/ec2-private-key.pem ubuntu@${module.ec2_minecraft.public_ip[0]}
Amazon Linux: ssh -i ${path.module}/ec2-private-key.pem ec2-user@${module.ec2_minecraft.public_ip[0]}
EOT
}
output "ec2_instance_profile" {
value = "${aws_iam_instance_profile.mc.name}"
}
output "minecraft_server" {
value = "${module.ec2_minecraft[0].public_ip}:${var.mc_port}"
}