homelab/terraform/cloud/server.tf

54 lines
1.0 KiB
Terraform
Raw Normal View History

2022-11-13 16:22:37 +00:00
resource "hcloud_server" "HomeLab2" {
2022-06-19 14:04:32 +00:00
count = var.instances
2022-11-13 16:22:37 +00:00
name = "corwin"
2023-09-17 16:28:12 +00:00
image = var.os_type
2022-06-19 14:04:32 +00:00
server_type = var.server_type
location = var.location
ssh_keys = [hcloud_ssh_key.default.id]
2023-10-01 17:29:19 +00:00
firewall_ids = [
hcloud_firewall.prod.id,
hcloud_firewall.Gitea_SSH.id,
2023-10-09 18:12:43 +00:00
hcloud_firewall.torrent.id,
2023-10-01 17:29:19 +00:00
hcloud_firewall.mail.id,
]
2022-06-19 14:04:32 +00:00
labels = {
}
2022-10-15 11:23:31 +00:00
lifecycle {
ignore_changes = [
ssh_keys,
]
}
2022-06-19 14:04:32 +00:00
}
2024-01-30 19:54:08 +00:00
data "hcloud_image" "arch" {
with_selector = "os-flavor=archlinux"
most_recent = true
with_status = ["available"]
}
resource "hcloud_server" "merlin" {
count = var.instances
name = "merlin"
image = data.hcloud_image.arch.id
server_type = "cx11"
location = var.location
ssh_keys = [hcloud_ssh_key.default.id]
firewall_ids = [
hcloud_firewall.prod.id,
hcloud_firewall.Gitea_SSH.id,
hcloud_firewall.torrent.id,
hcloud_firewall.mail.id,
hcloud_firewall.ssh.id,
]
labels = {
}
lifecycle {
ignore_changes = [
ssh_keys,
]
}
}