Renamed some variables

This commit is contained in:
Héctor Molinero Fernández 2021-06-14 22:51:25 +02:00
parent e9d9202616
commit 91d4d6df76
4 changed files with 8 additions and 8 deletions

View File

@ -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
})
}

View File

@ -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

View File

@ -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 = []

View File

@ -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"
}