Skip to content

Commit

Permalink
fixing missing logworkspace (#310)
Browse files Browse the repository at this point in the history
Signed-off-by: Gordonby <[email protected]>
  • Loading branch information
Gordon Byers authored Jun 23, 2022
1 parent ae75efb commit 170329d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions bicep/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ module network './network.bicep' = if (custom_vnet) {
bastion: bastion
bastionSubnetAddressPrefix: bastionSubnetAddressPrefix
availabilityZones: availabilityZones
workspaceName: aks_law.name
workspaceResourceGroupName: resourceGroup().name
workspaceName: createLaw ? aks_law.name : ''
workspaceResourceGroupName: createLaw ? resourceGroup().name : ''
networkSecurityGroups: CreateNetworkSecurityGroups
CreateNsgFlowLogs: CreateNetworkSecurityGroups && CreateNetworkSecurityGroupFlowLogs
ingressApplicationGatewayPublic: empty(privateIpApplicationGateway)
Expand Down Expand Up @@ -1278,7 +1278,7 @@ param retentionInDays int = 30

var aks_law_name = 'log-${resourceName}'

var createLaw = (omsagent || deployAppGw || azureFirewalls)
var createLaw = (omsagent || deployAppGw || azureFirewalls || CreateNetworkSecurityGroups)

resource aks_law 'Microsoft.OperationalInsights/workspaces@2021-06-01' = if (createLaw) {
name: aks_law_name
Expand Down
32 changes: 16 additions & 16 deletions bicep/network.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ resource bastionHost 'Microsoft.Network/bastionHosts@2021-05-01' = if(bastion) {
}
}

resource log 'Microsoft.OperationalInsights/workspaces@2021-06-01' existing = {
resource log 'Microsoft.OperationalInsights/workspaces@2021-06-01' existing = if(networkSecurityGroups && !empty(workspaceName)) {
name: workspaceName
scope: resourceGroup(workspaceResourceGroupName)
}
Expand All @@ -362,9 +362,9 @@ module nsgAks 'nsg.bicep' = if(networkSecurityGroups) {
params: {
location: location
resourceName: '${aks_subnet_name}-${resourceName}'
workspaceId: log.properties.customerId
workspaceRegion: log.location
workspaceResourceId: log.id
workspaceId: !empty(workspaceName) ? log.properties.customerId : ''
workspaceRegion: !empty(workspaceName) ? log.location : ''
workspaceResourceId: !empty(workspaceName) ? log.id : ''
ruleInAllowInternetHttp: true
ruleInAllowInternetHttps: true
ruleInDenySsh: true
Expand All @@ -377,9 +377,9 @@ module nsgAcrPool 'nsg.bicep' = if(acrPrivatePool && networkSecurityGroups) {
params: {
location: location
resourceName: '${acrpool_subnet_name}-${resourceName}'
workspaceId: log.properties.customerId
workspaceRegion: log.location
workspaceResourceId: log.id
workspaceId: !empty(workspaceName) ? log.properties.customerId : ''
workspaceRegion: !empty(workspaceName) ? log.location : ''
workspaceResourceId: !empty(workspaceName) ? log.id : ''
FlowLogStorageAccountId: CreateNsgFlowLogs ? flowLogStor.id : ''
}
dependsOn: [
Expand All @@ -392,9 +392,9 @@ module nsgAppGw 'nsg.bicep' = if(ingressApplicationGateway && networkSecurityGro
params: {
location: location
resourceName: '${appgw_subnet_name}-${resourceName}'
workspaceId: log.properties.customerId
workspaceRegion: log.location
workspaceResourceId: log.id
workspaceId: !empty(workspaceName) ? log.properties.customerId : ''
workspaceRegion: !empty(workspaceName) ? log.location : ''
workspaceResourceId: !empty(workspaceName) ? log.id : ''
ruleInAllowInternetHttp: ingressApplicationGatewayPublic
ruleInAllowInternetHttps: ingressApplicationGatewayPublic
ruleInAllowGwManagement: true
Expand All @@ -413,9 +413,9 @@ module nsgBastion 'nsg.bicep' = if(bastion && networkSecurityGroups) {
params: {
location: location
resourceName: '${bastion_subnet_name}-${resourceName}'
workspaceId: log.properties.customerId
workspaceRegion: log.location
workspaceResourceId: log.id
workspaceId: !empty(workspaceName) ? log.properties.customerId : ''
workspaceRegion: !empty(workspaceName) ? log.location : ''
workspaceResourceId: !empty(workspaceName) ? log.id : ''
ruleInAllowBastionHostComms: true
ruleInAllowInternetHttps: true
ruleInAllowGwManagement: true
Expand All @@ -434,9 +434,9 @@ module nsgPrivateLinks 'nsg.bicep' = if(privateLinks && networkSecurityGroups) {
params: {
location: location
resourceName: '${private_link_subnet_name}-${resourceName}'
workspaceId: log.properties.customerId
workspaceRegion: log.location
workspaceResourceId: log.id
workspaceId: !empty(workspaceName) ? log.properties.customerId : ''
workspaceRegion: !empty(workspaceName) ? log.location : ''
workspaceResourceId: !empty(workspaceName) ? log.id : ''
FlowLogStorageAccountId: CreateNsgFlowLogs ? flowLogStor.id : ''
}
dependsOn: [
Expand Down

0 comments on commit 170329d

Please sign in to comment.