Skip to content

Commit

Permalink
Fixed so that MacAddressSpoofing now is properly set instead of alway…
Browse files Browse the repository at this point in the history
…s becoming true
  • Loading branch information
MarkusRannare committed Nov 28, 2022
1 parent c2a5092 commit 9b708ec
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
11 changes: 5 additions & 6 deletions api/hyperv-winrm/vm_network_adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ $iovInterruptModeration = [Microsoft.HyperV.PowerShell.IovInterruptModerationVal
$allowTeaming = [Microsoft.HyperV.PowerShell.OnOffState]$vmNetworkAdapter.AllowTeaming
$deviceNaming = [Microsoft.HyperV.PowerShell.OnOffState]$vmNetworkAdapter.DeviceNaming
$fixSpeed10G = [Microsoft.HyperV.PowerShell.OnOffState]$vmNetworkAdapter.FixSpeed10G
$macAddressSpoofing = [Microsoft.HyperV.PowerShell.OnOffState]$vmNetworkAdapter.MacAddressSpoofing
$NewVmNetworkAdapterArgs = @{
VmName=$vmNetworkAdapter.VmName
Expand Down Expand Up @@ -52,9 +53,7 @@ if ($vmNetworkAdapter.DynamicMacAddress) {
} elseif ($vmNetworkAdapter.StaticMacAddress) {
$SetVmNetworkAdapterArgs.StaticMacAddress=$vmNetworkAdapter.StaticMacAddress
}
if ($vmNetworkAdapter.MacAddressSpoofing) {
$SetVmNetworkAdapterArgs.MacAddressSpoofing=$vmNetworkAdapter.MacAddressSpoofing
}
$SetVmNetworkAdapterArgs.MacAddressSpoofing=$macAddressSpoofing
$SetVmNetworkAdapterArgs.DhcpGuard=$dhcpGuard
$SetVmNetworkAdapterArgs.RouterGuard=$routerGuard
$SetVmNetworkAdapterArgs.PortMirroring=$portMirroring
Expand Down Expand Up @@ -434,6 +433,7 @@ $iovInterruptModeration = [Microsoft.HyperV.PowerShell.IovInterruptModerationVal
$allowTeaming = [Microsoft.HyperV.PowerShell.OnOffState]$vmNetworkAdapter.AllowTeaming
$deviceNaming = [Microsoft.HyperV.PowerShell.OnOffState]$vmNetworkAdapter.DeviceNaming
$fixSpeed10G = [Microsoft.HyperV.PowerShell.OnOffState]$vmNetworkAdapter.FixSpeed10G
$macAddressSpoofing = [Microsoft.HyperV.PowerShell.OnOffState]$vmNetworkAdapter.MacAddressSpoofing
$vmNetworkAdaptersObject = @(Get-VMNetworkAdapter -VmName '{{.VmName}}')[{{.Index}}]
Expand All @@ -457,9 +457,8 @@ if ($vmNetworkAdapter.DynamicMacAddress) {
} elseif ($vmNetworkAdapter.StaticMacAddress) {
$SetVmNetworkAdapterArgs.StaticMacAddress=$vmNetworkAdapter.StaticMacAddress
}
if ($vmNetworkAdapter.MacAddressSpoofing) {
$SetVmNetworkAdapterArgs.MacAddressSpoofing=$vmNetworkAdapter.MacAddressSpoofing
}
$SetVmNetworkAdapterArgs.MacAddressSpoofing=$macAddressSpoofing
$SetVmNetworkAdapterArgs.DhcpGuard=$dhcpGuard
$SetVmNetworkAdapterArgs.RouterGuard=$routerGuard
$SetVmNetworkAdapterArgs.PortMirroring=$portMirroring
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"flag"
"log"

"github.com/hashicorp/terraform-plugin-sdk/v2/plugin"
"github.com/taliesins/terraform-provider-hyperv/internal/provider"
Expand Down

0 comments on commit 9b708ec

Please sign in to comment.