Add ssh-keys to hetzner-cloud

This commit is contained in:
2025-03-08 21:37:15 +01:00
parent f37c92c439
commit 2d93766c09
3 changed files with 23 additions and 1 deletions

View File

@@ -77,3 +77,9 @@ module "dns" {
records = lookup(each.value, "records") records = lookup(each.value, "records")
} }
resource "hcloud_ssh_key" "this" {
for_each = var.ssh_keys
name = each.key
public_key = each.value
}

View File

@@ -1,4 +1,8 @@
variable "hetzner_apitoken" { variable "hetzner_dns_apitoken" {
type = string
}
variable "hetzner_cloud_apitoken" {
type = string type = string
} }
@@ -11,3 +15,7 @@ variable "sozpaedil_net_dkim" {
type = string type = string
sensitive = true sensitive = true
} }
variable "ssh_keys" {
type = map(string)
}

View File

@@ -4,9 +4,17 @@ terraform {
source = "timohirt/hetznerdns" source = "timohirt/hetznerdns"
version = "2.2.0" version = "2.2.0"
} }
hcloud = {
source = "hetznercloud/hcloud"
version = "1.50.0"
}
} }
} }
provider "hetznerdns" { provider "hetznerdns" {
apitoken = var.hetzner_dns_apitoken apitoken = var.hetzner_dns_apitoken
} }
provider "hcloud" {
token = var.hetzner_cloud_apitoken
}