-
Notifications
You must be signed in to change notification settings - Fork 4.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DNS: support for private dns zones #1404
Changes from 2 commits
a540fc0
db23bf4
d4e68de
1616693
f5a8e19
6b89d9e
e0458f4
c766dfc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ import ( | |
"context" | ||
"fmt" | ||
|
||
"github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-10-01/dns" | ||
"github.com/Azure/azure-sdk-for-go/services/preview/dns/mgmt/2018-03-01-preview/dns" | ||
"github.com/Azure/azure-sdk-for-go/services/resources/mgmt/2017-05-10/resources" | ||
"github.com/hashicorp/terraform/helper/schema" | ||
"github.com/terraform-providers/terraform-provider-azurerm/azurerm/utils" | ||
|
@@ -43,6 +43,23 @@ func dataSourceArmDnsZone() *schema.Resource { | |
Set: schema.HashString, | ||
}, | ||
|
||
"zone_type": { | ||
Type: schema.TypeString, | ||
Computed: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since this is a Data Source this only needs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
}, | ||
|
||
"registration_virtual_network_ids": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. since this is a Data Source and these values are returned (and not specified as inputs) - can we remove Default/Optional here? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
Elem: &schema.Schema{Type: schema.TypeString}, | ||
}, | ||
|
||
"resolution_virtual_network_ids": { | ||
Type: schema.TypeList, | ||
Computed: true, | ||
Elem: &schema.Schema{Type: schema.TypeString}, | ||
}, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can we document these three fields in the Data Source too? |
||
|
||
"tags": tagsForDataSourceSchema(), | ||
}, | ||
} | ||
|
@@ -87,15 +104,36 @@ 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) | ||
|
||
registrationVNets := make([]string, 0) | ||
if rvns := props.RegistrationVirtualNetworks; rvns != nil { | ||
for _, rvn := range *rvns { | ||
registrationVNets = append(registrationVNets, *rvn.ID) | ||
} | ||
} | ||
if err := d.Set("registration_virtual_network_ids", registrationVNets); err != nil { | ||
return err | ||
} | ||
|
||
resolutionVNets := make([]string, 0) | ||
if rvns := props.ResolutionVirtualNetworks; rvns != nil { | ||
for _, rvn := range *rvns { | ||
resolutionVNets = append(resolutionVNets, *rvn.ID) | ||
} | ||
} | ||
if err := d.Set("resolution_virtual_network_ids", resolutionVNets); err != nil { | ||
return err | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. (same here) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done. |
||
|
||
nameServers := make([]string, 0) | ||
if ns := props.NameServers; ns != nil { | ||
nameServers := make([]string, 0, len(*ns)) | ||
for _, ns := range *ns { | ||
nameServers = append(nameServers, ns) | ||
} | ||
if err := d.Set("name_servers", nameServers); err != nil { | ||
return err | ||
} | ||
} | ||
if err := d.Set("name_servers", nameServers); err != nil { | ||
return err | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we update the documentation to include these new fields? This is kept in
./website/docs/d/dns_zone.html.markdown
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.