Hi, I'm trying to use cloudflare records with terraform but I'm having a issue with SRV records in weight whit this code:
resource "cloudflare_record" "_sipfederationtls_tcp_SRV" {
domain = "${var.cloudflare_domain}"
name = "_sipfederationtls._tcp.${var.cloudflare_domain}"
type = "SRV"
data = {
service = "_sipfederationtls"
proto = "_tcp"
name = "${var.cloudflare_domain}."
priority = 100
weight = 1
port = 443
target = "sipfed.online.lync.com."
}
}
The thing is that I'm getting a error validating the DNS, the response from the cloudflare API:
2018-07-04T11:57:25.165+0200 [DEBUG] plugin.terraform-provider-cloudflare_v1.0.0_x4:
2018/07/04 11:57:25 [DEBUG] CloudFlare Record create configuration: cloudflare.DNSRecord{
ID:"",
Type:"SRV",
Name:"_sipfederationtls._tcp.DOMAIN.com",
Content:"",
Proxiable:false,
Proxied:false,
TTL:0, Locked:false,
ZoneID:"e51da254a970ea32cd0a36f6189f8186",
ZoneName:"DOMAIN.com", CreatedOn:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)},
ModifiedOn:time.Time{wall:0x0, ext:0, loc:(*time.Location)(nil)},
Data:map[string]interface {}{
"weight":"1",
"service":"_sipfederationtls",
"target":"sipfed.online.lync.com.",
"priority":"100", "proto":"_tcp",
"port":"443",
"name":"DOMAIN.com."},
Meta:interface {}(nil),Priority:0}
2018/07/04 11:57:25 [ERROR] root: eval: *terraform.EvalApplyPost, err: 1 error(s) occurred:
* cloudflare_record._sipfederationtls_tcp_SRV: Failed to create record: error from makeRequest: HTTP status 400: content "{\"success\":false,\"errors\":[{\"code\":1004,\"message\":\"DNS Validation Error\",\"error_chain\":[{\"code\":9104,\"message\":\"weight must be an int between 0 and 65535.\"}]}],\"messages\":[],\"result\":null}"
Why I'm having this error? I'm writing anything in a wrong format? I see that is passing the weight as a string, but can I change it to int? is that the error? as I know a MAP is a lookup table from string keys to string values, but it's the only way to pass that data to cloudflare_record
Thanks