2023-01-15 15:52:26 +00:00
|
|
|
#
|
|
|
|
# Create the production server
|
|
|
|
#
|
|
|
|
|
|
|
|
resource "hcloud_server" "production" {
|
|
|
|
name = "production"
|
2024-07-21 08:34:05 +00:00
|
|
|
image = "debian-12"
|
2023-03-14 15:01:41 +00:00
|
|
|
server_type = "cpx21"
|
2023-01-15 15:52:26 +00:00
|
|
|
location = "nbg1"
|
|
|
|
ssh_keys = ["${data.hcloud_ssh_key.ssh_key.id}"]
|
|
|
|
user_data = templatefile("user_data.yml.tpl", {
|
|
|
|
ssh_pub_key = var.ssh_pub_key
|
|
|
|
passwd = var.passwd
|
|
|
|
fqdn = "forgejo.dev"
|
|
|
|
})
|
2023-03-30 07:14:21 +00:00
|
|
|
delete_protection = true
|
|
|
|
rebuild_protection = true
|
2023-04-06 09:23:26 +00:00
|
|
|
firewall_ids = [hcloud_firewall.forgejo-fw.id]
|
2024-07-21 08:34:05 +00:00
|
|
|
# Ignore image changes to prevent re-creation of the whole server
|
|
|
|
lifecycle {
|
|
|
|
ignore_changes = [
|
|
|
|
image,
|
|
|
|
]
|
|
|
|
}
|
2023-01-15 15:52:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Set RDNS entry of production server IPv4
|
|
|
|
resource "hcloud_rdns" "production-rdns-v4" {
|
|
|
|
server_id = hcloud_server.production.id
|
|
|
|
ip_address = hcloud_server.production.ipv4_address
|
|
|
|
dns_ptr = "forgejo.dev"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Set RDNS entry of production server IPv6
|
|
|
|
resource "hcloud_rdns" "production-rdns-v6" {
|
|
|
|
server_id = hcloud_server.production.id
|
|
|
|
ip_address = hcloud_server.production.ipv6_address
|
|
|
|
dns_ptr = "forgejo.dev"
|
|
|
|
}
|
|
|
|
|
|
|
|
# Output Server Public IP address
|
2023-03-22 10:01:28 +00:00
|
|
|
output "server_ipv4_production" {
|
2023-01-15 15:52:26 +00:00
|
|
|
value = "${hcloud_server.production.ipv4_address}"
|
|
|
|
}
|
2023-03-22 10:01:28 +00:00
|
|
|
output "server_ipv6_production" {
|
|
|
|
value = "${hcloud_server.production.ipv6_address}"
|
|
|
|
}
|