This commit introduces the foundational Infrastructure-as-Code for provisioning a test environment on Hetzner Cloud. It defines server nodes, private networking, comprehensive firewalls, and includes documentation on resource lifecycle and safe configuration practices.
47 lines
1.1 KiB
HCL
47 lines
1.1 KiB
HCL
output "ansible_inventory_yaml" {
|
|
description = "Ansible inventory in YAML format — write to ansible/inventory/generated/test.yml"
|
|
sensitive = false
|
|
value = yamlencode({
|
|
all = {
|
|
children = {
|
|
swarm = {
|
|
hosts = {
|
|
(hcloud_server.swarm.name) = {
|
|
ansible_host = hcloud_server.swarm.ipv4_address
|
|
private_ip = local.swarm_private_ip
|
|
ansible_user = "root"
|
|
}
|
|
}
|
|
}
|
|
db = {
|
|
hosts = {
|
|
(hcloud_server.db.name) = {
|
|
ansible_host = hcloud_server.db.ipv4_address
|
|
private_ip = local.db_private_ip
|
|
ansible_user = "root"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
})
|
|
}
|
|
|
|
output "test_private_ips" {
|
|
description = "Private IPs assigned to test nodes"
|
|
sensitive = false
|
|
value = {
|
|
swarm_01 = local.swarm_private_ip
|
|
db_01 = local.db_private_ip
|
|
}
|
|
}
|
|
|
|
output "test_public_ips" {
|
|
description = "Public IPv4 addresses of test nodes"
|
|
sensitive = false
|
|
value = {
|
|
swarm_01 = hcloud_server.swarm.ipv4_address
|
|
db_01 = hcloud_server.db.ipv4_address
|
|
}
|
|
}
|