Skip to content

Commit

Permalink
Fixing port group resource to enable LACP only in virtual switch reso…
Browse files Browse the repository at this point in the history
…urce and not in port level. (#1214)
  • Loading branch information
sumitAgrawal007 authored Sep 17, 2020
1 parent 26e31ba commit 068810c
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion vsphere/distributed_port_group_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ func expandDVPortgroupConfigSpec(d *schema.ResourceData) types.DVPortgroupConfig
Name: d.Get("name").(string),
NumPorts: int32(d.Get("number_of_ports").(int)),
PortNameFormat: d.Get("port_name_format").(string),
DefaultPortConfig: expandVMwareDVSPortSetting(d),
DefaultPortConfig: expandVMwareDVSPortSetting(d, "distributed_port_group"),
Description: d.Get("description").(string),
Type: d.Get("type").(string),
Policy: expandVMwareDVSPortgroupPolicy(d),
Expand Down
8 changes: 6 additions & 2 deletions vsphere/distributed_virtual_port_setting_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,11 @@ func flattenDVSTrafficShapingPolicyEgress(d *schema.ResourceData, obj *types.DVS

// expandVMwareDVSPortSetting reads certain ResourceData keys and
// returns a VMwareDVSPortSetting.
func expandVMwareDVSPortSetting(d *schema.ResourceData) *types.VMwareDVSPortSetting {
func expandVMwareDVSPortSetting(d *schema.ResourceData, resourceType string) *types.VMwareDVSPortSetting {
var lacpPolicy *types.VMwareUplinkLacpPolicy = nil
if resourceType == "distributed_virtual_switch" {
lacpPolicy = expandVMwareUplinkLacpPolicy(d)
}
obj := &types.VMwareDVSPortSetting{
DVPortSetting: types.DVPortSetting{
Blocked: structure.GetBoolPolicy(d, "block_all_ports"),
Expand All @@ -569,7 +573,7 @@ func expandVMwareDVSPortSetting(d *schema.ResourceData) *types.VMwareDVSPortSett
SecurityPolicy: expandDVSSecurityPolicy(d),
IpfixEnabled: structure.GetBoolPolicy(d, "netflow_enabled"),
TxUplink: structure.GetBoolPolicy(d, "tx_uplink"),
LacpPolicy: expandVMwareUplinkLacpPolicy(d),
LacpPolicy: lacpPolicy,
}

if structure.AllFieldsEmpty(obj) {
Expand Down
2 changes: 1 addition & 1 deletion vsphere/distributed_virtual_switch_structure.go
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ func expandVMwareDVSConfigSpec(d *schema.ResourceData) *types.VMwareDVSConfigSpe
DVSConfigSpec: types.DVSConfigSpec{
Name: d.Get("name").(string),
ConfigVersion: d.Get("config_version").(string),
DefaultPortConfig: expandVMwareDVSPortSetting(d),
DefaultPortConfig: expandVMwareDVSPortSetting(d, "distributed_virtual_switch"),
Host: expandSliceOfDistributedVirtualSwitchHostMemberConfigSpec(d),
Description: d.Get("description").(string),
Contact: expandDVSContactInfo(d),
Expand Down

0 comments on commit 068810c

Please sign in to comment.