From 7f948f0ca7e44f08ad0fabc4887dfcb4fadae204 Mon Sep 17 00:00:00 2001 From: Paul Stack Date: Fri, 1 Jul 2016 10:26:01 +0100 Subject: [PATCH] provider/azurerm: `azurerm_dns_zone` now returns `name_servers` (#7434) Fixes #7374 The introduction of the AzureRM SDK 3.0.0-beta means that the `name_servers` for the DNS Zone are returned from the API This PR has a dependency on #7420 being merged first ``` make testacc TEST=./builtin/providers/azurerm TESTARGS='-run=TestAccAzureRMDnsZone_' ==> Checking that code complies with gofmt requirements... /Users/stacko/Code/go/bin/stringer go generate $(go list ./... | grep -v /vendor/) 2016/06/30 15:20:01 Generated command/internal_plugin_list.go TF_ACC=1 go test ./builtin/providers/azurerm -v -run=TestAccAzureRMDnsZone_ -timeout 120m === RUN TestAccAzureRMDnsZone_basic --- PASS: TestAccAzureRMDnsZone_basic (92.42s) PASS ok github.com/hashicorp/terraform/builtin/providers/azurerm 92.444s ``` --- .../azurerm/resource_arm_dns_zone.go | 15 +++++++++++++ .../riviera/dns/get_dns_cname_recordset.go | 12 +++++----- .../jen20/riviera/dns/get_dns_zone.go | 1 + vendor/vendor.json | 22 +++++++++---------- 4 files changed, 33 insertions(+), 17 deletions(-) diff --git a/builtin/providers/azurerm/resource_arm_dns_zone.go b/builtin/providers/azurerm/resource_arm_dns_zone.go index 2571e761c..8b552983a 100644 --- a/builtin/providers/azurerm/resource_arm_dns_zone.go +++ b/builtin/providers/azurerm/resource_arm_dns_zone.go @@ -39,6 +39,13 @@ func resourceArmDnsZone() *schema.Resource { Optional: true, Computed: true, }, + + "name_servers": &schema.Schema{ + Type: schema.TypeSet, + Computed: true, + Elem: &schema.Schema{Type: schema.TypeString}, + Set: schema.HashString, + }, }, } } @@ -104,6 +111,14 @@ func resourceArmDnsZoneRead(d *schema.ResourceData, meta interface{}) error { d.Set("number_of_record_sets", resp.NumberOfRecordSets) d.Set("max_number_of_record_sets", resp.MaxNumberOfRecordSets) + nameServers := make([]string, 0, len(resp.NameServers)) + for _, ns := range resp.NameServers { + nameServers = append(nameServers, *ns) + } + if err := d.Set("name_servers", nameServers); err != nil { + return err + } + return nil } diff --git a/vendor/github.com/jen20/riviera/dns/get_dns_cname_recordset.go b/vendor/github.com/jen20/riviera/dns/get_dns_cname_recordset.go index b880bfb9c..959bcc85a 100644 --- a/vendor/github.com/jen20/riviera/dns/get_dns_cname_recordset.go +++ b/vendor/github.com/jen20/riviera/dns/get_dns_cname_recordset.go @@ -3,12 +3,12 @@ package dns import "github.com/jen20/riviera/azure" type GetCNAMERecordSetResponse struct { - ID string `mapstructure:"id"` - Name string `mapstructure:"name"` - Location string `mapstructure:"location"` - Tags map[string]*string `mapstructure:"tags"` - TTL *int `mapstructure:"TTL"` - CNAMERecord CNAMERecord `mapstructure:"CNAMERecord"` + ID string `mapstructure:"id"` + Name string `mapstructure:"name"` + Location string `mapstructure:"location"` + Tags map[string]*string `mapstructure:"tags"` + TTL *int `mapstructure:"TTL"` + CNAMERecord CNAMERecord `mapstructure:"CNAMERecord"` } type GetCNAMERecordSet struct { diff --git a/vendor/github.com/jen20/riviera/dns/get_dns_zone.go b/vendor/github.com/jen20/riviera/dns/get_dns_zone.go index 6be00cbb5..a588f6587 100644 --- a/vendor/github.com/jen20/riviera/dns/get_dns_zone.go +++ b/vendor/github.com/jen20/riviera/dns/get_dns_zone.go @@ -9,6 +9,7 @@ type GetDNSZoneResponse struct { Tags *map[string]*string `mapstructure:"tags"` NumberOfRecordSets *string `mapstructure:"numberOfRecordSets"` MaxNumberOfRecordSets *string `mapstructure:"maxNumberOfRecordSets"` + NameServers []*string `mapstructure:"nameServers"` } type GetDNSZone struct { diff --git a/vendor/vendor.json b/vendor/vendor.json index 231a96c07..d9635eb2a 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -951,32 +951,32 @@ { "checksumSHA1": "oPpOfZn11Ef6DWOoETxSW9Venzs=", "path": "github.com/jen20/riviera/azure", - "revision": "2f01b8f5b09bbc20a591b1dc4b48af0665106b3f", - "revisionTime": "2016-06-10T12:18:12Z" + "revision": "1159d86fc8144abafeb29ee7c5a3e2e85af336ba", + "revisionTime": "2016-06-30T14:11:29Z" }, { - "checksumSHA1": "A2Ycn6MySifUKTHOnsG9oLwjitE=", + "checksumSHA1": "ncdT+1PFEF5ly0niXuQc9/pKzT0=", "path": "github.com/jen20/riviera/dns", - "revision": "2f01b8f5b09bbc20a591b1dc4b48af0665106b3f", - "revisionTime": "2016-06-10T12:18:12Z" + "revision": "1159d86fc8144abafeb29ee7c5a3e2e85af336ba", + "revisionTime": "2016-06-30T14:11:29Z" }, { "checksumSHA1": "zVXx6ha3bt0N4ukRbRHXjSl91S4=", "path": "github.com/jen20/riviera/search", - "revision": "2f01b8f5b09bbc20a591b1dc4b48af0665106b3f", - "revisionTime": "2016-06-10T12:18:12Z" + "revision": "1159d86fc8144abafeb29ee7c5a3e2e85af336ba", + "revisionTime": "2016-06-30T14:11:29Z" }, { "checksumSHA1": "KfquDaeBPGchw92QnojlJFsJKgk=", "path": "github.com/jen20/riviera/sql", - "revision": "2f01b8f5b09bbc20a591b1dc4b48af0665106b3f", - "revisionTime": "2016-06-10T12:18:12Z" + "revision": "1159d86fc8144abafeb29ee7c5a3e2e85af336ba", + "revisionTime": "2016-06-30T14:11:29Z" }, { "checksumSHA1": "nKUCquNpJ9ifHgkXoT4K3Xar6R8=", "path": "github.com/jen20/riviera/storage", - "revision": "64de55fa8cdd0c52f7d59494c1b03c1b583c52b4", - "revisionTime": "2016-02-18T23:50:40Z" + "revision": "1159d86fc8144abafeb29ee7c5a3e2e85af336ba", + "revisionTime": "2016-06-30T14:11:29Z" }, { "comment": "0.2.2-2-gc01cf91",