forked from gendall/terraform-cloudflare-records-tls
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvariables.tf
32 lines (28 loc) · 812 Bytes
/
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
variable "zone" {
type = string
description = "The main domain that DNS records will be provided within."
}
variable "records" {
type = map
description = "A map of DNS name=addresses pairs, where name is a string and addresses is a tuple of IPs."
}
variable "proxied" {
type = bool
default = false
description = "True if the DNS record gets Cloudflare's origin protection."
}
locals {
# transforms the records from map(name => [address1, address2]) to map(index => [name, address])
resources = {
for index, tuple in chunklist(flatten([
for name, address in var.records:
setproduct([name], address)
]), 2):
index => tuple
}
# adds the environment and zone to the records names
domains = [
for name, addresses in var.records:
"${name}.${var.zone}"
]
}