-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
52 lines (46 loc) · 1.01 KB
/
variables.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
variable "local_network" {
type = object({
cidr_block = string
gateway = string
})
default = {
cidr_block = "192.168.14.0/24"
gateway = "192.168.14.1"
}
}
variable "vpn_server" {
type = object({
name = string
interface = string
local_ip = string
username = string
ssh_key_file = string
})
default = {
name = "sonos"
interface = "eth0"
local_ip = "192.168.14.4"
username = "pi"
ssh_key_file = "~/.ssh/rpi"
}
}
variable "vpn_network" {
type = object({
endpoint = string
listen_port = number
cidr_block = string
})
default = {
endpoint = "sonos.mydomain.com" # DNS name or IP address
listen_port = 51820
cidr_block = "192.168.15.0/24"
}
}
variable "vpn_clients" {
type = list(string)
default = ["laptop", "ipad"]
}
locals {
vpn_server_vpn_ip = cidrhost(var.vpn_network.cidr_block, 1)
vpn_client_vpn_ips = [for client in var.vpn_clients : cidrhost(var.vpn_network.cidr_block, index(var.vpn_clients, client)+5)]
}