-
Notifications
You must be signed in to change notification settings - Fork 0
/
staging.tf
67 lines (61 loc) · 1.6 KB
/
staging.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#
# Create the staging server
#
resource "hcloud_primary_ip" "staging-ipv4" {
name = "staging-ipv4"
type = "ipv4"
assignee_type = "server"
auto_delete = false
datacenter = "nbg1-dc3"
delete_protection = true
}
resource "hcloud_primary_ip" "staging-ipv6" {
name = "staging-ipv6"
type = "ipv6"
assignee_type = "server"
auto_delete = false
datacenter = "nbg1-dc3"
delete_protection = true
}
resource "hcloud_server" "staging" {
name = "staging"
image = "debian-12"
server_type = "cx11"
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 = "staging.forgejo.dev"
})
public_net {
ipv4 = hcloud_primary_ip.staging-ipv4.id
ipv6 = hcloud_primary_ip.staging-ipv6.id
}
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 staging server IPv4
resource "hcloud_rdns" "staging-rdns-v4" {
server_id = hcloud_server.staging.id
ip_address = hcloud_server.staging.ipv4_address
dns_ptr = "staging.forgejo.dev"
}
# Set RDNS entry of staging server IPv6
resource "hcloud_rdns" "staging-rdns-v6" {
server_id = hcloud_server.staging.id
ip_address = hcloud_server.staging.ipv6_address
dns_ptr = "staging.forgejo.dev"
}
# Output Server Public IP address
output "server_ipv4_staging" {
value = "${hcloud_server.staging.ipv4_address}"
}
output "server_ipv6_staging" {
value = "${hcloud_server.staging.ipv6_address}"
}