Skip to content

Commit 98fb9a1

Browse files
committed
refactor: skip network interface parsing for arm
Signed-off-by: nikpivkin <[email protected]>
1 parent 9cb856a commit 98fb9a1

File tree

2 files changed

+2
-27
lines changed

2 files changed

+2
-27
lines changed

pkg/iac/adapters/arm/compute/adapt.go

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -94,22 +94,6 @@ func adaptLinuxVirtualMachine(resource azure.Resource) compute.LinuxVirtualMachi
9494

9595
}
9696

97-
func extractNetworkInterfaces(networkProfile azure.Value, metadata iacTypes.Metadata) []network.NetworkInterface {
98-
var networkInterfaces []network.NetworkInterface
99-
100-
nicsArray := networkProfile.GetMapValue("networkInterfaces").AsList()
101-
for _, nic := range nicsArray {
102-
nicID := nic.GetMapValue("id").AsStringValue("", metadata)
103-
if nicID.Value() != "" {
104-
// Create a minimal NetworkInterface object with the ID information
105-
// In ARM templates, we don't have direct access to subnet details like in Terraform
106-
// EnableIPForwarding is not available from the VM's networkProfile, so it defaults to false
107-
// Since we only have a reference to the network interface (not the full resource),
108-
// we mark it as unmanaged so that Rego policies can skip it using isManaged() checks
109-
networkInterfaces = append(networkInterfaces, network.NetworkInterface{
110-
Metadata: iacTypes.NewUnmanagedMetadata(),
111-
})
112-
}
113-
}
114-
return networkInterfaces
97+
func extractNetworkInterfaces(_ azure.Value, _ iacTypes.Metadata) []network.NetworkInterface {
98+
return nil
11599
}

pkg/iac/adapters/arm/compute/adapt_test.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55

66
"github.com/aquasecurity/trivy/pkg/iac/adapters/arm/adaptertest"
77
"github.com/aquasecurity/trivy/pkg/iac/providers/azure/compute"
8-
"github.com/aquasecurity/trivy/pkg/iac/providers/azure/network"
98
"github.com/aquasecurity/trivy/pkg/iac/types"
109
)
1110

@@ -117,10 +116,6 @@ func TestAdapt(t *testing.T) {
117116
LinuxVirtualMachines: []compute.LinuxVirtualMachine{{
118117
VirtualMachine: compute.VirtualMachine{
119118
CustomData: types.StringTest("test"),
120-
NetworkInterfaces: []network.NetworkInterface{
121-
{},
122-
{},
123-
},
124119
},
125120
OSProfileLinuxConfig: compute.OSProfileLinuxConfig{
126121
DisablePasswordAuthentication: types.BoolTest(false),
@@ -129,10 +124,6 @@ func TestAdapt(t *testing.T) {
129124
WindowsVirtualMachines: []compute.WindowsVirtualMachine{{
130125
VirtualMachine: compute.VirtualMachine{
131126
CustomData: types.StringTest("test"),
132-
NetworkInterfaces: []network.NetworkInterface{
133-
{},
134-
{},
135-
},
136127
},
137128
}},
138129
},

0 commit comments

Comments
 (0)