added ssh in fw rule
Some checks failed
Deployment / deploy-docker (push) Failing after 6s

This commit is contained in:
Melchior Reimers
2026-02-04 19:59:55 +01:00
parent 898dff0453
commit ef74051537
4 changed files with 59 additions and 5 deletions

16
main.tf
View File

@@ -1,6 +1,7 @@
# SSH Key (existing)
data "hcloud_ssh_key" "default" {
name = local.ssh_key_name
# SSH Key
resource "hcloud_ssh_key" "default" {
name = local.ssh_key_name
public_key = var.ssh_public_key
}
# Cloud-init script
@@ -21,7 +22,7 @@ resource "hcloud_server" "vps" {
image = var.image
server_type = data.hcloud_server_type.selected.name
location = data.hcloud_location.selected.name
ssh_keys = concat([data.hcloud_ssh_key.default.id])
ssh_keys = concat([hcloud_ssh_key.default.id])
user_data = local.user_data
labels = {
@@ -70,6 +71,13 @@ resource "hcloud_firewall" "vps" {
destination_ips = ["0.0.0.0/0", "::/0"]
description = "ICMP outbound"
}
rule {
direction = "in"
protocol = "tcp"
port = "22"
destination_ips = ["0.0.0.0/0", "::/0"]
description = "ssh outbound"
}
}
resource "hcloud_firewall_attachment" "vps" {