blob: 2328bb174f1852a6b5815409a46964a855a418bf (
plain) (
blame)
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
|
variable "ssh_key_name" {
type = "string"
}
variable "location" {
type = "string"
}
resource "random_id" "server" {
prefix = "peter-"
byte_length = 2
}
resource "hcloud_server" "server" {
name = "${random_id.server.hex}.crashbox.io"
image = "debian-9"
server_type = "cx11"
location = "${var.location}"
ssh_keys = ["${var.ssh_key_name}"]
}
resource "cloudflare_record" "record_a" {
domain = "crashbox.io"
name = "${hcloud_server.server.name}"
value = "${hcloud_server.server.ipv4_address}"
type = "A"
}
resource "cloudflare_record" "record_aaaa" {
domain = "crashbox.io"
name = "${hcloud_server.server.name}"
value = "${hcloud_server.server.ipv6_address}1"
type = "AAAA"
}
output "ipv4" {
value = "${hcloud_server.server.ipv4_address}"
}
output "ipv6" {
value = "${hcloud_server.server.ipv6_address}"
}
output "fqdn" {
value = "${cloudflare_record.record_aaaa.hostname}"
}
output "id" {
value = "${hcloud_server.server.id}"
}
output "name" {
value = "${hcloud_server.server.name}"
}
|