Commit d94b58ef authored by Mike Horwath's avatar Mike Horwath

0.12 in the house

parent 3e0c4914
Pipeline #197 failed with stage
in 20 seconds
......@@ -2,6 +2,8 @@
Terraform [cloudflare_record](https://www.terraform.io/docs/providers/cloudflare/r/record.html)
> **Requires Terraform 0.12 or higher**
This module will loop over a passed `list` variables to create records in Cloudflare.
This module as tested supports:
......
resource "cloudflare_record" "caa" {
count = "${length(var.caa_records)}"
domain = "${var.domain}"
name = "${element(var.caa_records[count.index], 0)}"
count = length(var.caa_records)
domain = var.domain
name = element(var.caa_records[count.index], 0)
type = "CAA"
data = {
flags = "${element(var.caa_records[count.index], 1)}"
tag = "${element(var.caa_records[count.index], 2)}"
value = "${element(var.caa_records[count.index], 3)}"
flags = element(var.caa_records[count.index], 1)
tag = element(var.caa_records[count.index], 2)
value = element(var.caa_records[count.index], 3)
}
}
resource "cloudflare_record" "multi" {
count = "${length(var.multi_records)}"
domain = "${var.domain}" # required
name = "${element(var.multi_records[count.index], 0)}" # required
value = "${element(var.multi_records[count.index], 1)}" # required
priority = "${element(var.multi_records[count.index], 2)}" # optional IRL, required in var passing, can be ""
type = "${element(var.multi_records[count.index], 3)}" # required
proxied = "${element(var.multi_records[count.index], 4)}" # optional IRL, required in var passing, boolean
ttl = "1" # this is default
count = length(var.multi_records)
domain = var.domain # required
name = element(var.multi_records[count.index], 0) # required
value = element(var.multi_records[count.index], 1) # required
priority = element(var.multi_records[count.index], 2) # optional IRL, required in var passing, can be ""
type = element(var.multi_records[count.index], 3) # required
proxied = element(var.multi_records[count.index], 4) # optional IRL, required in var passing, boolean
ttl = "1" # this is default
}
resource "cloudflare_record" "srv" {
count = "${length(var.srv_records)}"
domain = "${var.domain}"
count = length(var.srv_records)
domain = var.domain
name = "${element(var.srv_records[count.index], 0)}.${element(var.srv_records[count.index], 1)}.${var.domain}"
type = "SRV"
data = {
service = "${element(var.srv_records[count.index], 0)}"
proto = "${element(var.srv_records[count.index], 1)}"
name = "${var.domain}"
priority = "${element(var.srv_records[count.index], 2)}"
weight = "${element(var.srv_records[count.index], 3)}"
port = "${element(var.srv_records[count.index], 4)}"
target = "${element(var.srv_records[count.index], 5)}"
service = element(var.srv_records[count.index], 0)
proto = element(var.srv_records[count.index], 1)
name = var.domain
priority = element(var.srv_records[count.index], 2)
weight = element(var.srv_records[count.index], 3)
port = element(var.srv_records[count.index], 4)
target = element(var.srv_records[count.index], 5)
}
}
variable "domain" {}
variable "domain" {
}
# still need to figure out SRV and LOC records
# name, value, priority (integer), type, proxied
variable "multi_records" {
type = "list"
default = []
# type = list(string)
type = list(tuple([string, string, number, string, bool]))
}
# item, proto, priority (integer), weight (integer), port (integer), target (no trailing dot)
variable "srv_records" {
type = "list"
#type = list(string)
type = list(tuple([string, string, number, number, number, string]))
default = []
}
# name, flags, tag, value
# name, flags, issue, value
variable "caa_records" {
type = "list"
#type = list(string)
type = list(tuple([string,number,string,string]))
default = []
}
terraform {
required_version = ">= 0.12"
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment