Skip to content

Commit 628df55

Browse files
author
Emanuel Rietveld
committed
azurerm_network_interface: expose internal_domain_name_suffix
After a network interface has been created in a subnet, Azure assigns it an internal domain name and exposes this as a property. The suffix looks something like this: tcjzv0sul21rwyt5qe31ylgpgo.ax.internal.cloudapp.net Servers can reach each other internally at, for example: server0.tcjzv0sul21rwyt5qe31ylgpgo.ax.internal.cloudapp.net This change exposes the azure provided internal_domain_name_suffix in terraform
1 parent 158edd9 commit 628df55

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

azurerm/internal/services/network/resource_arm_network_interface.go

+11
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,11 @@ func resourceArmNetworkInterface() *schema.Resource {
140140
ValidateFunc: validation.StringIsNotEmpty,
141141
},
142142

143+
"internal_domain_name_suffix": {
144+
Type: schema.TypeString,
145+
Computed: true,
146+
},
147+
143148
"tags": tags.Schema(),
144149

145150
// Computed
@@ -425,13 +430,18 @@ func resourceArmNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e
425430
appliedDNSServers := make([]string, 0)
426431
dnsServers := make([]string, 0)
427432
internalDnsNameLabel := ""
433+
internalDomainNameSuffix := ""
428434
if dnsSettings := props.DNSSettings; dnsSettings != nil {
429435
appliedDNSServers = flattenNetworkInterfaceDnsServers(dnsSettings.AppliedDNSServers)
430436
dnsServers = flattenNetworkInterfaceDnsServers(dnsSettings.DNSServers)
431437

432438
if dnsSettings.InternalDNSNameLabel != nil {
433439
internalDnsNameLabel = *dnsSettings.InternalDNSNameLabel
434440
}
441+
442+
if dnsSettings.InternalDomainNameSuffix != nil {
443+
internalDomainNameSuffix = *dnsSettings.InternalDomainNameSuffix
444+
}
435445
}
436446

437447
virtualMachineId := ""
@@ -450,6 +460,7 @@ func resourceArmNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e
450460
d.Set("enable_ip_forwarding", resp.EnableIPForwarding)
451461
d.Set("enable_accelerated_networking", resp.EnableAcceleratedNetworking)
452462
d.Set("internal_dns_name_label", internalDnsNameLabel)
463+
d.Set("internal_domain_name_suffix", internalDomainNameSuffix)
453464
d.Set("mac_address", props.MacAddress)
454465
d.Set("private_ip_address", primaryPrivateIPAddress)
455466
d.Set("virtual_machine_id", virtualMachineId)

website/docs/r/network_interface.html.markdown

+2
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,8 @@ The following attributes are exported:
112112

113113
* `id` - The ID of the Network Interface.
114114

115+
* `internal_domain_name_suffix` - Even if `internal_dns_name_label` is not specified, a DNS entry is created for the primary NIC of the VM. This DNS name can be constructed by concatenating the VM name with the value of `internal_domain_name_suffix`.
116+
115117
* `mac_address` - The Media Access Control (MAC) Address of the Network Interface.
116118

117119
* `private_ip_address` - The first private IP address of the network interface.

0 commit comments

Comments
 (0)