Output public IPs of terraformed servers

This commit is contained in:
Johannes Rothe 2023-09-14 21:56:24 +02:00
parent 84f2e2a4af
commit f9eb145876
Signed by: onjen
GPG Key ID: 73F092605AF3286C
3 changed files with 12 additions and 1 deletions

View File

@ -38,6 +38,6 @@ resource "hcloud_network_subnet" "main" {
resource "hcloud_ssh_key" "main" {
count = length(var.ssh_keys)
name = "ssh-key-${count.index}"
name = "ssh-key${count.index}"
public_key = file(var.ssh_keys[count.index])
}

View File

@ -14,6 +14,10 @@ output "server_network" {
value = hcloud_server.private_node[*].network
}
output "server_public_ips" {
value = { for s in hcloud_server.private_node : s.name => s.ipv4_address }
}
output "ssh_key_ids" {
value = hcloud_ssh_key.main[*].id
}

7
terraform/outputs.tf Normal file
View File

@ -0,0 +1,7 @@
output "lb_public_ip" {
value = module.loadbalancer.lb_public_ip
}
output "server_ips" {
value = module.private_server_group.server_public_ips
}