Adding private ip address reference to azurerm network interface (#6538)
* Adding private ip address reference * adding private ip address reference * Updating the docs. * Removing optional attrib from private_ip_address Removing optional attribute from private_ip_address, this element is only being used in the read. * Selecting the first element instead of using a loop for now. Change this to a loop when https://github.com/Azure/azure-sdk-for-go/issues/259 is fixed
This commit is contained in:
parent
35c4daf494
commit
156d2916d8
|
@ -53,6 +53,11 @@ func resourceArmNetworkInterface() *schema.Resource {
|
||||||
Computed: true,
|
Computed: true,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"private_ip_address": &schema.Schema{
|
||||||
|
Type: schema.TypeString,
|
||||||
|
Computed: true,
|
||||||
|
},
|
||||||
|
|
||||||
"virtual_machine_id": &schema.Schema{
|
"virtual_machine_id": &schema.Schema{
|
||||||
Type: schema.TypeString,
|
Type: schema.TypeString,
|
||||||
Optional: true,
|
Optional: true,
|
||||||
|
@ -241,7 +246,7 @@ func resourceArmNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("Error making Read request on Azure Netowkr Interface %s: %s", name, err)
|
return fmt.Errorf("Error making Read request on Azure Network Interface %s: %s", name, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
iface := *resp.Properties
|
iface := *resp.Properties
|
||||||
|
@ -252,6 +257,18 @@ func resourceArmNetworkInterfaceRead(d *schema.ResourceData, meta interface{}) e
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if iface.IPConfigurations != nil && len(*iface.IPConfigurations) > 0 {
|
||||||
|
var privateIPAddress *string
|
||||||
|
///TODO: Change this to a loop when https://github.com/Azure/azure-sdk-for-go/issues/259 is fixed
|
||||||
|
if (*iface.IPConfigurations)[0].Properties != nil {
|
||||||
|
privateIPAddress = (*iface.IPConfigurations)[0].Properties.PrivateIPAddress
|
||||||
|
}
|
||||||
|
|
||||||
|
if *privateIPAddress != "" {
|
||||||
|
d.Set("private_ip_address", *privateIPAddress)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if iface.VirtualMachine != nil {
|
if iface.VirtualMachine != nil {
|
||||||
if *iface.VirtualMachine.ID != "" {
|
if *iface.VirtualMachine.ID != "" {
|
||||||
d.Set("virtual_machine_id", *iface.VirtualMachine.ID)
|
d.Set("virtual_machine_id", *iface.VirtualMachine.ID)
|
||||||
|
|
|
@ -95,6 +95,7 @@ The following attributes are exported:
|
||||||
|
|
||||||
* `id` - The virtual NetworkConfiguration ID.
|
* `id` - The virtual NetworkConfiguration ID.
|
||||||
* `mac_address` - The media access control (MAC) address of the network interface.
|
* `mac_address` - The media access control (MAC) address of the network interface.
|
||||||
|
* `private_ip_address` - The private ip address of the network interface.
|
||||||
* `virtual_machine_id` - Reference to a VM with which this NIC has been associated.
|
* `virtual_machine_id` - Reference to a VM with which this NIC has been associated.
|
||||||
* `applied_dns_servers` - If the VM that uses this NIC is part of an Availability Set, then this list will have the union of all DNS servers from all NICs that are part of the Availability Set
|
* `applied_dns_servers` - If the VM that uses this NIC is part of an Availability Set, then this list will have the union of all DNS servers from all NICs that are part of the Availability Set
|
||||||
* `internal_fqdn` - Fully qualified DNS name supporting internal communications between VMs in the same VNet
|
* `internal_fqdn` - Fully qualified DNS name supporting internal communications between VMs in the same VNet
|
||||||
|
|
Loading…
Reference in New Issue