Skip to content

Commit

Permalink
Remove diagnostic settings
Browse files Browse the repository at this point in the history
  • Loading branch information
oZakari committed Jan 23, 2024
1 parent 0fa64f0 commit 6113d9a
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 181 deletions.
65 changes: 10 additions & 55 deletions avm/res/app/container-app/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,20 @@ The following section provides usage examples for the module, which were used to

>**Note**: Each example lists all the required parameters first, followed by the rest - each in alphabetical order.
>**Note**: To reference the module, please use the following syntax `br/public:avm/res/app/container-app:<version>`.
>**Note**: To reference the module, please use the following syntax `br/public:AVM/bicep-registry-modules:<version>`.
- [Using only defaults](#example-1-using-only-defaults)
- [Using large parameter set](#example-2-using-large-parameter-set)
- [WAF-aligned](#example-3-waf-aligned)

### Example 1: _Using only defaults_

This instance deploys the module with the minimum set of required parameters.
- [Defaults](#example-1-defaults)
- [Max](#example-2-max)
- [Waf-Aligned](#example-3-waf-aligned)

### Example 1: _Defaults_

<details>

<summary>via Bicep module</summary>

```bicep
module containerApp 'br/public:avm/res/app/container-app:<version>' = {
module containerApp 'br/public:AVM/bicep-registry-modules:<version>' = {
name: '${uniqueString(deployment().name, location)}-test-acamin'
params: {
// Required parameters
Expand Down Expand Up @@ -106,17 +103,14 @@ module containerApp 'br/public:avm/res/app/container-app:<version>' = {
</details>
<p>

### Example 2: _Using large parameter set_

This instance deploys the module with most of its features enabled.

### Example 2: _Max_

<details>

<summary>via Bicep module</summary>

```bicep
module containerApp 'br/public:avm/res/app/container-app:<version>' = {
module containerApp 'br/public:AVM/bicep-registry-modules:<version>' = {
name: '${uniqueString(deployment().name, location)}-test-acamax'
params: {
// Required parameters
Expand Down Expand Up @@ -150,14 +144,6 @@ module containerApp 'br/public:avm/res/app/container-app:<version>' = {
environmentId: '<environmentId>'
name: 'acamax001'
// Non-required parameters
diagnosticSettings: [
{
eventHubAuthorizationRuleResourceId: '<eventHubAuthorizationRuleResourceId>'
eventHubName: '<eventHubName>'
storageAccountResourceId: '<storageAccountResourceId>'
workspaceResourceId: '<workspaceResourceId>'
}
]
location: '<location>'
lock: {
kind: 'CanNotDelete'
Expand Down Expand Up @@ -250,16 +236,6 @@ module containerApp 'br/public:avm/res/app/container-app:<version>' = {
"value": "acamax001"
},
// Non-required parameters
"diagnosticSettings": {
"value": [
{
"eventHubAuthorizationRuleResourceId": "<eventHubAuthorizationRuleResourceId>",
"eventHubName": "<eventHubName>",
"storageAccountResourceId": "<storageAccountResourceId>",
"workspaceResourceId": "<workspaceResourceId>"
}
]
},
"location": {
"value": "<location>"
},
Expand Down Expand Up @@ -318,17 +294,14 @@ module containerApp 'br/public:avm/res/app/container-app:<version>' = {
</details>
<p>

### Example 3: _WAF-aligned_

This instance deploys the module in alignment with the best-practices of the Azure Well-Architected Framework.

### Example 3: _Waf-Aligned_

<details>

<summary>via Bicep module</summary>

```bicep
module containerApp 'br/public:avm/res/app/container-app:<version>' = {
module containerApp 'br/public:AVM/bicep-registry-modules:<version>' = {
name: '${uniqueString(deployment().name, location)}-test-acawaf'
params: {
// Required parameters
Expand Down Expand Up @@ -362,14 +335,6 @@ module containerApp 'br/public:avm/res/app/container-app:<version>' = {
environmentId: '<environmentId>'
name: 'acawaf001'
// Non-required parameters
diagnosticSettings: [
{
eventHubAuthorizationRuleResourceId: '<eventHubAuthorizationRuleResourceId>'
eventHubName: '<eventHubName>'
storageAccountResourceId: '<storageAccountResourceId>'
workspaceResourceId: '<workspaceResourceId>'
}
]
ingressAllowInsecure: false
ingressExternal: false
location: '<location>'
Expand Down Expand Up @@ -439,16 +404,6 @@ module containerApp 'br/public:avm/res/app/container-app:<version>' = {
"value": "acawaf001"
},
// Non-required parameters
"diagnosticSettings": {
"value": [
{
"eventHubAuthorizationRuleResourceId": "<eventHubAuthorizationRuleResourceId>",
"eventHubName": "<eventHubName>",
"storageAccountResourceId": "<storageAccountResourceId>",
"workspaceResourceId": "<workspaceResourceId>"
}
]
},
"ingressAllowInsecure": {
"value": false
},
Expand Down
67 changes: 0 additions & 67 deletions avm/res/app/container-app/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,6 @@ param tags object?
@description('Optional. Collection of private container registry credentials for containers used by the Container app.')
param registries array = []

@description('Optional. The diagnostic settings of the service.')
param diagnosticSettings diagnosticSettingType

@description('Optional. The managed identity definition for this resource.')
param managedIdentities managedIdentitiesType

Expand Down Expand Up @@ -194,32 +191,6 @@ resource containerApp 'Microsoft.App/containerApps@2023-05-01' = {
}
}

resource containerApp_diagnosticSettings 'Microsoft.Insights/diagnosticSettings@2021-05-01-preview' = [for (diagnosticSetting, index) in (diagnosticSettings ?? []): {
name: diagnosticSetting.?name ?? '${name}-diagnosticSettings'
properties: {
storageAccountId: diagnosticSetting.?storageAccountResourceId
workspaceId: diagnosticSetting.?workspaceResourceId
eventHubAuthorizationRuleId: diagnosticSetting.?eventHubAuthorizationRuleResourceId
eventHubName: diagnosticSetting.?eventHubName
metrics: diagnosticSetting.?metricCategories ?? [
{
category: 'AllMetrics'
timeGrain: null
enabled: true
}
]
logs: diagnosticSetting.?logCategoriesAndGroups ?? [
{
categoryGroup: 'allLogs'
enabled: true
}
]
marketplacePartnerId: diagnosticSetting.?marketplacePartnerResourceId
logAnalyticsDestinationType: diagnosticSetting.?logAnalyticsDestinationType
}
scope: containerApp
}]

resource containerApp_lock 'Microsoft.Authorization/locks@2020-05-01' = if (!empty(lock ?? {}) && lock.?kind != 'None') {
name: lock.?name ?? 'lock-${name}'
properties: {
Expand Down Expand Up @@ -262,44 +233,6 @@ output location string = containerApp.location
// Definitions //
// =============== //

type diagnosticSettingType = {
@description('Optional. The name of diagnostic setting.')
name: string?

@description('Optional. The name of logs that will be streamed. "allLogs" includes all possible logs for the resource. Set to \'\' to disable log collection.')
logCategoriesAndGroups: {
@description('Optional. Name of a Diagnostic Log category for a resource type this setting is applied to. Set the specific logs to collect here.')
category: string?

@description('Optional. Name of a Diagnostic Log category group for a resource type this setting is applied to. Set to \'allLogs\' to collect all logs.')
categoryGroup: string?
}[]?

@description('Optional. The name of metrics that will be streamed. "allMetrics" includes all possible metrics for the resource. Set to \'\' to disable metric collection.')
metricCategories: {
@description('Required. Name of a Diagnostic Metric category for a resource type this setting is applied to. Set to \'AllMetrics\' to collect all metrics.')
category: string
}[]?

@description('Optional. A string indicating whether the export to Log Analytics should use the default destination type, i.e. AzureDiagnostics, or use a destination type.')
logAnalyticsDestinationType: ('Dedicated' | 'AzureDiagnostics')?

@description('Optional. Resource ID of the diagnostic log analytics workspace. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.')
workspaceResourceId: string?

@description('Optional. Resource ID of the diagnostic storage account. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.')
storageAccountResourceId: string?

@description('Optional. Resource ID of the diagnostic event hub authorization rule for the Event Hubs namespace in which the event hub should be created or streamed to.')
eventHubAuthorizationRuleResourceId: string?

@description('Optional. Name of the diagnostic event hub within the namespace to which logs are streamed. Without this, an event hub is created for each log category. For security reasons, it is recommended to set diagnostic settings to send data to either storage account, log analytics workspace or event hub.')
eventHubName: string?

@description('Optional. The full ARM resource ID of the Marketplace resource to which you would like to send Diagnostic Logs.')
marketplacePartnerResourceId: string?
}[]?

type managedIdentitiesType = {
@description('Optional. Enables system assigned managed identity on the resource.')
systemAssigned: bool?
Expand Down
14 changes: 0 additions & 14 deletions avm/res/app/container-app/tests/e2e/defaults/main.test.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -40,20 +40,6 @@ module nestedDependencies 'dependencies.bicep' = {
}
}

// Diagnostics
// ===========
module diagnosticDependencies '../../../../../../utilities/e2e-template-assets/templates/diagnostic.dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-diagnosticDependencies'
params: {
storageAccountName: 'dep${namePrefix}diasa${serviceShort}01'
logAnalyticsWorkspaceName: 'dep-${namePrefix}-law-${serviceShort}'
eventHubNamespaceEventHubName: 'dep-${namePrefix}-evh-${serviceShort}'
eventHubNamespaceName: 'dep-${namePrefix}-evhns-${serviceShort}'
location: location
}
}

// ============== //
// Test Execution //
// ============== //
Expand Down
6 changes: 5 additions & 1 deletion avm/res/app/container-app/tests/e2e/max/dependencies.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ param managedIdentityName string
resource managedEnvironment 'Microsoft.App/managedEnvironments@2023-05-01' = {
name: managedEnvironmentName
location: location
properties: {}
properties: {
appLogsConfiguration: {
destination: 'azure-monitor'
}
}
}

resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2023-01-31' = {
Expand Down
22 changes: 0 additions & 22 deletions avm/res/app/container-app/tests/e2e/max/main.test.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,6 @@ module nestedDependencies 'dependencies.bicep' = {
}
}

// Diagnostics
// ===========
module diagnosticDependencies '../../../../../../utilities/e2e-template-assets/templates/diagnostic.dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-diagnosticDependencies'
params: {
storageAccountName: 'dep${namePrefix}diasa${serviceShort}01'
logAnalyticsWorkspaceName: 'dep-${namePrefix}-law-${serviceShort}'
eventHubNamespaceEventHubName: 'dep-${namePrefix}-evh-${serviceShort}'
eventHubNamespaceName: 'dep-${namePrefix}-evhns-${serviceShort}'
location: location
}
}

// ============== //
// Test Execution //
// ============== //
Expand All @@ -65,14 +51,6 @@ module testDeployment '../../../main.bicep' = [for iteration in [ 'init', 'idem'
name: '${uniqueString(deployment().name, location)}-test-${serviceShort}-${iteration}'
params: {
name: '${namePrefix}${serviceShort}001'
diagnosticSettings: [
{
eventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName
eventHubAuthorizationRuleResourceId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId
storageAccountResourceId: diagnosticDependencies.outputs.storageAccountResourceId
workspaceResourceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId
}
]
tags: {
'hidden-title': 'This is visible in the resource name'
Env: 'test'
Expand Down
22 changes: 0 additions & 22 deletions avm/res/app/container-app/tests/e2e/waf-aligned/main.test.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -41,20 +41,6 @@ module nestedDependencies 'dependencies.bicep' = {
}
}

// Diagnostics
// ===========
module diagnosticDependencies '../../../../../../utilities/e2e-template-assets/templates/diagnostic.dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, location)}-diagnosticDependencies'
params: {
storageAccountName: 'dep${namePrefix}diasa${serviceShort}01'
logAnalyticsWorkspaceName: 'dep-${namePrefix}-law-${serviceShort}'
eventHubNamespaceEventHubName: 'dep-${namePrefix}-evh-${serviceShort}'
eventHubNamespaceName: 'dep-${namePrefix}-evhns-${serviceShort}'
location: location
}
}

// ============== //
// Test Execution //
// ============== //
Expand All @@ -67,14 +53,6 @@ module testDeployment '../../../main.bicep' = [for iteration in [ 'init', 'idem'
name: '${namePrefix}${serviceShort}001'
ingressExternal: false
ingressAllowInsecure: false
diagnosticSettings: [
{
eventHubName: diagnosticDependencies.outputs.eventHubNamespaceEventHubName
eventHubAuthorizationRuleResourceId: diagnosticDependencies.outputs.eventHubAuthorizationRuleId
storageAccountResourceId: diagnosticDependencies.outputs.storageAccountResourceId
workspaceResourceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId
}
]
tags: {
'hidden-title': 'This is visible in the resource name'
Env: 'test'
Expand Down

0 comments on commit 6113d9a

Please sign in to comment.