terraform-provider-coredns icon indicating copy to clipboard operation
terraform-provider-coredns copied to clipboard

Subdomain creation

Open johnmarcou opened this issue 7 years ago • 0 comments

Hello,

Another issue I found, but this time it comes with a workaround. Creating 2 records, one being a sub-domain of the other, make Terraform crashing.

2018/02/16 16:49:12 [DEBUG] plugin: waiting for all plugin processes to complete...
Error: Error refreshing state: 1 error(s) occurred:

* coredns_record.foo: 1 error(s) occurred:

* coredns_record.foo: coredns_record.foo: Failed to get DNS record foo.skydns.local. with error: Failed to unmarshall json data, err: unexpected end of JSON input

How to reproduce

provider "coredns" {
  etcd_endpoints = "http://10.24.0.250:2379"
  zones          = "skydns.local"
}

resource "coredns_record" "foo" {
  fqdn  = "foo.skydns.local"
  type  = "A"
  rdata = ["10.10.10.10", "10.10.10.20"]
  ttl   = "60"
}

resource "coredns_record" "bar" {
  fqdn  = "bar.foo.skydns.local"
  type  = "A"
  rdata = ["10.10.20.10", "10.10.20.20"]
  ttl   = "60"
}

Workaround

--- a/vendor/k8s.io/kubernetes/federation/pkg/dnsprovider/providers/coredns/rrsets.go
+++ b/vendor/k8s.io/kubernetes/federation/pkg/dnsprovider/providers/coredns/rrsets.go
@@ -61,6 +61,9 @@ func (rrsets ResourceRecordSets) Get(name string) ([]dnsprovider.ResourceRecordS
        var list []dnsprovider.ResourceRecordSet

        for _, node := range response.Node.Nodes {
+    if node.Dir {
+      continue
+    }
                service := dnsmsg.Service{}
                err = json.Unmarshal([]byte(node.Value), &service)
                if err != nil {

This workaround modifies a dependency code, so it's probably not the good place to submit the issue, but I wanted to let you know about it.

johnmarcou avatar Feb 16 '18 05:02 johnmarcou