-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
47 lines (43 loc) · 1.2 KB
/
main.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
#
# Create the production server
#
resource "hcloud_server" "production" {
name = "production"
image = "debian-12"
server_type = "cpx21"
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"
})
delete_protection = true
rebuild_protection = true
firewall_ids = [hcloud_firewall.forgejo-fw.id]
# Ignore image changes to prevent re-creation of the whole server
lifecycle {
ignore_changes = [
image,
]
}
}
# 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
output "server_ipv4_production" {
value = "${hcloud_server.production.ipv4_address}"
}
output "server_ipv6_production" {
value = "${hcloud_server.production.ipv6_address}"
}