Skip to content

Commit

Permalink
WIP: support Private DNS zones
Browse files Browse the repository at this point in the history
  • Loading branch information
stintel committed Jun 11, 2018
1 parent d12cabf commit 68305e1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
6 changes: 6 additions & 0 deletions azurerm/data_source_dns_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ func dataSourceArmDnsZone() *schema.Resource {
Set: schema.HashString,
},

"zone_type": {
Type: schema.TypeString,
Computed: true,
},

"tags": tagsForDataSourceSchema(),
},
}
Expand Down Expand Up @@ -87,6 +92,7 @@ func dataSourceArmDnsZoneRead(d *schema.ResourceData, meta interface{}) error {
if props := resp.ZoneProperties; props != nil {
d.Set("number_of_record_sets", props.NumberOfRecordSets)
d.Set("max_number_of_record_sets", props.MaxNumberOfRecordSets)
d.Set("zone_type", props.ZoneType)

if ns := props.NameServers; ns != nil {
nameServers := make([]string, 0, len(*ns))
Expand Down
11 changes: 11 additions & 0 deletions azurerm/resource_arm_dns_zone.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,12 @@ func resourceArmDnsZone() *schema.Resource {
Set: schema.HashString,
},

"zone_type": {
Type: schema.TypeString,
Default: "Public",
Optional: true,
},

"tags": tagsSchema(),
},
}
Expand All @@ -57,12 +63,16 @@ func resourceArmDnsZoneCreate(d *schema.ResourceData, meta interface{}) error {
name := d.Get("name").(string)
resGroup := d.Get("resource_group_name").(string)
location := "global"
zone_type := d.Get("zone_type").(string)

tags := d.Get("tags").(map[string]interface{})

parameters := dns.Zone{
Location: &location,
Tags: expandTags(tags),
ZoneProperties: &dns.ZoneProperties{
ZoneType: dns.ZoneType(zone_type),
},
}

etag := ""
Expand Down Expand Up @@ -106,6 +116,7 @@ func resourceArmDnsZoneRead(d *schema.ResourceData, meta interface{}) error {
d.Set("resource_group_name", resGroup)
d.Set("number_of_record_sets", resp.NumberOfRecordSets)
d.Set("max_number_of_record_sets", resp.MaxNumberOfRecordSets)
d.Set("zone_type", resp.ZoneType)

nameServers := make([]string, 0, len(*resp.NameServers))
for _, ns := range *resp.NameServers {
Expand Down

0 comments on commit 68305e1

Please sign in to comment.