-
Notifications
You must be signed in to change notification settings - Fork 11
/
outputs.tf
40 lines (40 loc) · 1.72 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
# create output variables
output "admin_user" {
value = var.admin_user
}
output "admin_password" {
value = random_string.admin_password.result
}
output "private_ip" {
value = aws_instance.puppetted_host.private_ip
}
output "public_ip" {
value = aws_instance.puppetted_host.public_ip
}
output "bastion_host" {
value = var.bastion_public_ip
}
output "bastion_port" {
value = var.bastion_ssh_port
}
output "bastion_user" {
value = local.real_bastion_user
}
output "host_fqdn" {
value = ""
}
output "ssh_command" {
# disable host checking and store the received key in /dev/null to avoid false 'man-in-the-middle' warnings
value = "ssh -A -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o ProxyCommand='ssh -A -p ${var.bastion_ssh_port} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -W %h:%p ${local.real_bastion_user}@${local.real_bastion_public_ip}' ${var.admin_user}@${aws_instance.puppetted_host.public_ip}"
}
output "ssh_additional_port" {
value = var.ssh_additional_port
}
output "repuppet_command" {
# note live output streamed using tail but never completes; needs Ctrl+C to exit from tail -f
value = "sudo bash -c '${local.puppet_run} > /root/puppet_apply.out & 2>&1 ; tail -f -n1000 /root/puppet_apply.out'"
}
output "resend_puppet_scripts" {
# include puppet/* to avoid getting hidden folders (like .tmp or .rb)
value = "rsync -av --delete --rsh 'ssh -A -p ${var.bastion_ssh_port} -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null ${local.real_bastion_user}@${local.real_bastion_public_ip} ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' ${path.cwd}/${local.puppet_source}/* ${var.admin_user}@${aws_instance.puppetted_host.public_ip}:${local.puppet_target_repodir}/"
}