Loading README.md +2 −0 Original line number Diff line number Diff line Loading @@ -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: Loading caa.tf +7 −6 Original line number Diff line number Diff line 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) } } multirecord.tf +8 −7 Original line number Diff line number Diff line 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 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 } srvrecord.tf +10 −9 Original line number Diff line number Diff line 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) } } variables.tf +9 −6 Original line number Diff line number Diff line 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 = [] } Loading
README.md +2 −0 Original line number Diff line number Diff line Loading @@ -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: Loading
caa.tf +7 −6 Original line number Diff line number Diff line 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) } }
multirecord.tf +8 −7 Original line number Diff line number Diff line 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 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 }
srvrecord.tf +10 −9 Original line number Diff line number Diff line 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) } }
variables.tf +9 −6 Original line number Diff line number Diff line 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 = [] }