Skip to content

Commit

Permalink
azurerm_network_watcher_flow_log - add nil check for traffic_analytics (
Browse files Browse the repository at this point in the history
  • Loading branch information
neil-yechenwei authored Feb 6, 2025
1 parent e9ebf4e commit 8cc4df4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,10 @@ func flattenNetworkWatcherFlowLogTrafficAnalytics(input *flowlogs.TrafficAnalyti
func expandNetworkWatcherFlowLogTrafficAnalytics(d *pluginsdk.ResourceData) *flowlogs.TrafficAnalyticsProperties {
vs := d.Get("traffic_analytics").([]interface{})

if len(vs) == 0 {
return nil
}

v := vs[0].(map[string]interface{})
enabled := v["enabled"].(bool)
workspaceID := v["workspace_id"].(string)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,13 @@ func testAccNetworkWatcherFlowLog_trafficAnalytics(t *testing.T) {
check.That(data.ResourceName).ExistsInAzure(r),
),
},
{
Config: r.basicConfig(data),
Check: acceptance.ComposeTestCheckFunc(
check.That(data.ResourceName).ExistsInAzure(r),
),
},
data.ImportStep(),
})
}

Expand Down

0 comments on commit 8cc4df4

Please sign in to comment.