This commit is contained in:
16
main.tf
16
main.tf
@@ -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" {
|
||||
|
||||
Reference in New Issue
Block a user