Cloudflare SRV records

206 views
Skip to first unread message

javier...@flywire.com

unread,
Jul 4, 2018, 6:53:19 AM7/4/18
to Terraform
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



kromm77

unread,
Jul 6, 2018, 5:31:06 AM7/6/18
to Terraform
same problem , found out that validation now requires that  json values must be explictitly integer instead of string for parameters to be int ,
for example:   instead of     "port" :"443"  send   "port" :443  , same for  priority  and weight . 

kromm77

unread,
Jul 6, 2018, 5:34:19 AM7/6/18
to Terraform
I'm not using terraform but a custom tool , so you should ask for a bug fix . 

javier...@flywire.com

unread,
Jul 6, 2018, 5:59:17 AM7/6/18
to Terraform
Reply all
Reply to author
Forward
0 new messages