diff --git a/terraform/main.tf b/terraform/main.tf index e5e8e76..f841751 100644 --- a/terraform/main.tf +++ b/terraform/main.tf @@ -24,7 +24,7 @@ resource "hcloud_server" "wg_server" { hcloud_ssh_key.wg_server_ssh_key.id ] user_data = templatefile("${path.module}/templates/user-data.tpl", { - wg_server_own_privatekey = var.wg_server_own_privatekey - wg_server_peer_publickeys = var.wg_server_peer_publickeys + wg_server_wg_privatekey = var.wg_server_wg_privatekey + wg_server_wg_peer_publickeys = var.wg_server_wg_peer_publickeys }) } diff --git a/terraform/templates/user-data.tpl b/terraform/templates/user-data.tpl index 877195f..0a51b31 100644 --- a/terraform/templates/user-data.tpl +++ b/terraform/templates/user-data.tpl @@ -5,12 +5,12 @@ write_files: owner: "root:root" permissions: "0600" content: | - ${wg_server_own_privatekey} + ${wg_server_wg_privatekey} - path: "/etc/wireguard/wg0-peers.conf" owner: "root:root" permissions: "0644" content: | - %{~ for index, pubkey in wg_server_peer_publickeys ~} + %{~ for index, pubkey in wg_server_wg_peer_publickeys ~} [Peer] PublicKey = ${pubkey} AllowedIPs = 10.10.10.${index+2}/32, fd10:10:10::${index+2}/128 diff --git a/terraform/terraform.tfvars.sample b/terraform/terraform.tfvars.sample index b07ae3e..3cf04e3 100644 --- a/terraform/terraform.tfvars.sample +++ b/terraform/terraform.tfvars.sample @@ -7,5 +7,5 @@ wg_server_location = "" wg_server_ssh_publickey = "" wg_server_ssh_publickey_name = "" -wg_server_own_privatekey = "" -wg_server_peer_publickeys = [] +wg_server_wg_privatekey = "" +wg_server_wg_peer_publickeys = [] diff --git a/terraform/variables.tf b/terraform/variables.tf index cd66332..0ffb128 100644 --- a/terraform/variables.tf +++ b/terraform/variables.tf @@ -32,12 +32,12 @@ variable "wg_server_ssh_publickey_name" { description = "SSH public key name" } -variable "wg_server_own_privatekey" { +variable "wg_server_wg_privatekey" { type = string description = "WireGuard private key" } -variable "wg_server_peer_publickeys" { +variable "wg_server_wg_peer_publickeys" { type = list(string) description = "WireGuard peer public keys" }