-
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
azurerm_network_interface
- Support auxiliary_mode
, auxiliary_sku
#22979
Changes from 3 commits
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 | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -126,6 +126,28 @@ func resourceNetworkInterface() *pluginsdk.Resource { | |||||||||||||||
}, | ||||||||||||||||
|
||||||||||||||||
// Optional | ||||||||||||||||
"auxiliary_mode": { | ||||||||||||||||
Type: pluginsdk.TypeString, | ||||||||||||||||
Optional: true, | ||||||||||||||||
ValidateFunc: validation.StringInSlice([]string{ | ||||||||||||||||
string(networkinterfaces.NetworkInterfaceAuxiliaryModeAcceleratedConnections), | ||||||||||||||||
string(networkinterfaces.NetworkInterfaceAuxiliaryModeFloating), | ||||||||||||||||
}, false), | ||||||||||||||||
RequiredWith: []string{"auxiliary_sku"}, | ||||||||||||||||
}, | ||||||||||||||||
|
||||||||||||||||
"auxiliary_sku": { | ||||||||||||||||
Type: pluginsdk.TypeString, | ||||||||||||||||
Optional: true, | ||||||||||||||||
ValidateFunc: validation.StringInSlice([]string{ | ||||||||||||||||
string(networkinterfaces.NetworkInterfaceAuxiliarySkuAEight), | ||||||||||||||||
string(networkinterfaces.NetworkInterfaceAuxiliarySkuAFour), | ||||||||||||||||
string(networkinterfaces.NetworkInterfaceAuxiliarySkuAOne), | ||||||||||||||||
string(networkinterfaces.NetworkInterfaceAuxiliarySkuATwo), | ||||||||||||||||
}, false), | ||||||||||||||||
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. we can use:
Suggested change
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. code updated. Thanks. |
||||||||||||||||
RequiredWith: []string{"auxiliary_mode"}, | ||||||||||||||||
}, | ||||||||||||||||
|
||||||||||||||||
"dns_servers": { | ||||||||||||||||
Type: pluginsdk.TypeList, | ||||||||||||||||
Optional: true, | ||||||||||||||||
|
@@ -232,6 +254,14 @@ func resourceNetworkInterfaceCreate(d *pluginsdk.ResourceData, meta interface{}) | |||||||||||||||
locks.ByName(id.NetworkInterfaceName, networkInterfaceResourceName) | ||||||||||||||||
defer locks.UnlockByName(id.NetworkInterfaceName, networkInterfaceResourceName) | ||||||||||||||||
|
||||||||||||||||
if auxiliaryMode, hasAuxiliaryMode := d.GetOk("auxiliary_mode"); hasAuxiliaryMode { | ||||||||||||||||
properties.AuxiliaryMode = pointer.To(networkinterfaces.NetworkInterfaceAuxiliaryMode(auxiliaryMode.(string))) | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
if auxiliarySku, hasAuxiliarySku := d.GetOk("auxiliary_sku"); hasAuxiliarySku { | ||||||||||||||||
properties.AuxiliarySku = pointer.To(networkinterfaces.NetworkInterfaceAuxiliarySku(auxiliarySku.(string))) | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
dns, hasDns := d.GetOk("dns_servers") | ||||||||||||||||
nameLabel, hasNameLabel := d.GetOk("internal_dns_name_label") | ||||||||||||||||
if hasDns || hasNameLabel { | ||||||||||||||||
|
@@ -325,6 +355,22 @@ func resourceNetworkInterfaceUpdate(d *pluginsdk.ResourceData, meta interface{}) | |||||||||||||||
}, | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
if d.HasChange("auxiliary_mode") { | ||||||||||||||||
if auxiliaryMode, hasAuxiliaryMode := d.GetOk("auxiliary_mode"); hasAuxiliaryMode { | ||||||||||||||||
update.Properties.AuxiliaryMode = pointer.To(networkinterfaces.NetworkInterfaceAuxiliaryMode(auxiliaryMode.(string))) | ||||||||||||||||
} | ||||||||||||||||
} else { | ||||||||||||||||
update.Properties.AuxiliaryMode = existing.Model.Properties.AuxiliaryMode | ||||||||||||||||
} | ||||||||||||||||
Comment on lines
+350
to
+356
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. how do users unset this property? 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. If users remove this property from the .tf, the code will enter |
||||||||||||||||
|
||||||||||||||||
if d.HasChange("auxiliary_sku") { | ||||||||||||||||
if auxiliarySku, hasAuxiliarySku := d.GetOk("auxiliary_sku"); hasAuxiliarySku { | ||||||||||||||||
update.Properties.AuxiliarySku = pointer.To(networkinterfaces.NetworkInterfaceAuxiliarySku(auxiliarySku.(string))) | ||||||||||||||||
} | ||||||||||||||||
} else { | ||||||||||||||||
update.Properties.AuxiliarySku = existing.Model.Properties.AuxiliarySku | ||||||||||||||||
} | ||||||||||||||||
tombuildsstuff marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||
|
||||||||||||||||
if d.HasChange("dns_servers") { | ||||||||||||||||
dnsServersRaw := d.Get("dns_servers").([]interface{}) | ||||||||||||||||
dnsServers := expandNetworkInterfaceDnsServers(dnsServersRaw) | ||||||||||||||||
|
@@ -462,6 +508,19 @@ func resourceNetworkInterfaceRead(d *pluginsdk.ResourceData, meta interface{}) e | |||||||||||||||
return fmt.Errorf("setting `applied_dns_servers`: %+v", err) | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
auxiliaryMode := "" | ||||||||||||||||
if props.AuxiliaryMode != nil && *props.AuxiliaryMode != networkinterfaces.NetworkInterfaceAuxiliaryModeNone { | ||||||||||||||||
auxiliaryMode = string(*props.AuxiliaryMode) | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
d.Set("auxiliary_mode", auxiliaryMode) | ||||||||||||||||
|
||||||||||||||||
auxiliarySku := "" | ||||||||||||||||
if props.AuxiliarySku != nil && *props.AuxiliarySku != networkinterfaces.NetworkInterfaceAuxiliarySkuNone { | ||||||||||||||||
auxiliarySku = string(*props.AuxiliarySku) | ||||||||||||||||
} | ||||||||||||||||
|
||||||||||||||||
d.Set("auxiliary_sku", auxiliarySku) | ||||||||||||||||
d.Set("enable_ip_forwarding", props.EnableIPForwarding) | ||||||||||||||||
d.Set("enable_accelerated_networking", props.EnableAcceleratedNetworking) | ||||||||||||||||
d.Set("internal_dns_name_label", internalDnsNameLabel) | ||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -60,6 +60,12 @@ The following arguments are supported: | |||||
|
||||||
--- | ||||||
|
||||||
* `auxiliary_mode` - (Optional) Specifies auxiliary mode for enabling [Accelerated Connections](https://learn.microsoft.com/en-us/azure/networking/nva-accelerated-connections) to improve networking performance. Possible values are `AcceleratedConnections` and `Floating`. | ||||||
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 make this description clearer to call out what this actually does / update the tone and style to match other fields too? We shouldn't need to link to a product page to explain what a value does. 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. Doc updated. Thanks. |
||||||
|
||||||
* `auxiliary_sku` - (Optional) Specifies auxiliary SKU for tuning the performance of network connections. Possible values are `A1`, `A2`, `A4` and `A8`. | ||||||
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. (as above) 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. Doc updated. Thanks. |
||||||
|
||||||
-> **Note:** `auxiliary_mode` and `auxiliary_sku` require the preview feature is enabled. See the [Prerequisites](https://learn.microsoft.com/en-us/azure/networking/nva-accelerated-connections#prerequisites) for more details. | ||||||
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. The Preview note should be listed under every preview field, and something along the lines of:
Suggested change
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. Doc updated. Thanks. |
||||||
|
||||||
* `dns_servers` - (Optional) A list of IP Addresses defining the DNS Servers which should be used for this Network Interface. | ||||||
|
||||||
-> **Note:** Configuring DNS Servers on the Network Interface will override the DNS Servers defined on the Virtual Network. | ||||||
|
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.
we can use
possiblevaluesfor
here fwiwThere 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.
code updated. Thanks.