Skip to content

Commit

Permalink
fix: Added unique filter to PSRule results & updated action group use…
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexanderSehr and eriqua authored Oct 24, 2023
1 parent 6924d09 commit edbd874
Show file tree
Hide file tree
Showing 7 changed files with 177 additions and 137 deletions.
163 changes: 100 additions & 63 deletions avm/res/insights/action-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ module actionGroup 'br/public:avm-res-insights-actiongroup:1.0.0' = {
// Required parameters
groupShortName: 'agiagmin001'
name: 'iagmin001'
// Non-required parameters
armRoleReceivers: '<armRoleReceivers>'
automationRunbookReceivers: '<automationRunbookReceivers>'
azureAppPushReceivers: '<azureAppPushReceivers>'
azureFunctionReceivers: '<azureFunctionReceivers>'
emailReceivers: '<emailReceivers>'
itsmReceivers: '<itsmReceivers>'
location: 'global'
logicAppReceivers: '<logicAppReceivers>'
roleAssignments: '<roleAssignments>'
smsReceivers: '<smsReceivers>'
tags: '<tags>'
voiceReceivers: '<voiceReceivers>'
webhookReceivers: '<webhookReceivers>'
}
}
```
Expand All @@ -64,6 +78,46 @@ module actionGroup 'br/public:avm-res-insights-actiongroup:1.0.0' = {
},
"name": {
"value": "iagmin001"
},
// Non-required parameters
"armRoleReceivers": {
"value": "<armRoleReceivers>"
},
"automationRunbookReceivers": {
"value": "<automationRunbookReceivers>"
},
"azureAppPushReceivers": {
"value": "<azureAppPushReceivers>"
},
"azureFunctionReceivers": {
"value": "<azureFunctionReceivers>"
},
"emailReceivers": {
"value": "<emailReceivers>"
},
"itsmReceivers": {
"value": "<itsmReceivers>"
},
"location": {
"value": "global"
},
"logicAppReceivers": {
"value": "<logicAppReceivers>"
},
"roleAssignments": {
"value": "<roleAssignments>"
},
"smsReceivers": {
"value": "<smsReceivers>"
},
"tags": {
"value": "<tags>"
},
"voiceReceivers": {
"value": "<voiceReceivers>"
},
"webhookReceivers": {
"value": "<webhookReceivers>"
}
}
}
Expand Down Expand Up @@ -98,6 +152,7 @@ module actionGroup 'br/public:avm-res-insights-actiongroup:1.0.0' = {
useCommonAlertSchema: true
}
]
location: 'global'
roleAssignments: [
{
principalId: '<principalId>'
Expand Down Expand Up @@ -155,6 +210,9 @@ module actionGroup 'br/public:avm-res-insights-actiongroup:1.0.0' = {
}
]
},
"location": {
"value": "global"
},
"roleAssignments": {
"value": [
{
Expand Down Expand Up @@ -201,37 +259,23 @@ module actionGroup 'br/public:avm-res-insights-actiongroup:1.0.0' = {
groupShortName: 'agiagwaf001'
name: 'iagwaf001'
// Non-required parameters
emailReceivers: [
{
emailAddress: '[email protected]'
name: 'TestUser_-EmailAction-'
useCommonAlertSchema: true
}
{
emailAddress: '[email protected]'
name: 'TestUser2'
useCommonAlertSchema: true
}
]
roleAssignments: [
{
principalId: '<principalId>'
principalType: 'ServicePrincipal'
roleDefinitionIdOrName: 'Reader'
}
]
smsReceivers: [
{
countryCode: '1'
name: 'TestUser_-SMSAction-'
phoneNumber: '2345678901'
}
]
armRoleReceivers: '<armRoleReceivers>'
automationRunbookReceivers: '<automationRunbookReceivers>'
azureAppPushReceivers: '<azureAppPushReceivers>'
azureFunctionReceivers: '<azureFunctionReceivers>'
emailReceivers: '<emailReceivers>'
itsmReceivers: '<itsmReceivers>'
location: 'global'
logicAppReceivers: '<logicAppReceivers>'
roleAssignments: '<roleAssignments>'
smsReceivers: '<smsReceivers>'
tags: {
Environment: 'Non-Prod'
'hidden-title': 'This is visible in the resource name'
Role: 'DeploymentValidation'
}
voiceReceivers: '<voiceReceivers>'
webhookReceivers: '<webhookReceivers>'
}
}
```
Expand All @@ -256,44 +300,48 @@ module actionGroup 'br/public:avm-res-insights-actiongroup:1.0.0' = {
"value": "iagwaf001"
},
// Non-required parameters
"armRoleReceivers": {
"value": "<armRoleReceivers>"
},
"automationRunbookReceivers": {
"value": "<automationRunbookReceivers>"
},
"azureAppPushReceivers": {
"value": "<azureAppPushReceivers>"
},
"azureFunctionReceivers": {
"value": "<azureFunctionReceivers>"
},
"emailReceivers": {
"value": [
{
"emailAddress": "[email protected]",
"name": "TestUser_-EmailAction-",
"useCommonAlertSchema": true
},
{
"emailAddress": "[email protected]",
"name": "TestUser2",
"useCommonAlertSchema": true
}
]
"value": "<emailReceivers>"
},
"itsmReceivers": {
"value": "<itsmReceivers>"
},
"location": {
"value": "global"
},
"logicAppReceivers": {
"value": "<logicAppReceivers>"
},
"roleAssignments": {
"value": [
{
"principalId": "<principalId>",
"principalType": "ServicePrincipal",
"roleDefinitionIdOrName": "Reader"
}
]
"value": "<roleAssignments>"
},
"smsReceivers": {
"value": [
{
"countryCode": "1",
"name": "TestUser_-SMSAction-",
"phoneNumber": "2345678901"
}
]
"value": "<smsReceivers>"
},
"tags": {
"value": {
"Environment": "Non-Prod",
"hidden-title": "This is visible in the resource name",
"Role": "DeploymentValidation"
}
},
"voiceReceivers": {
"value": "<voiceReceivers>"
},
"webhookReceivers": {
"value": "<webhookReceivers>"
}
}
}
Expand Down Expand Up @@ -337,35 +385,30 @@ module actionGroup 'br/public:avm-res-insights-actiongroup:1.0.0' = {
The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported.
- Required: No
- Type: array
- Default: `[]`

### Parameter: `automationRunbookReceivers`

The list of AutomationRunbook receivers that are part of this action group.
- Required: No
- Type: array
- Default: `[]`

### Parameter: `azureAppPushReceivers`

The list of AzureAppPush receivers that are part of this action group.
- Required: No
- Type: array
- Default: `[]`

### Parameter: `azureFunctionReceivers`

The list of function receivers that are part of this action group.
- Required: No
- Type: array
- Default: `[]`

### Parameter: `emailReceivers`

The list of email receivers that are part of this action group.
- Required: No
- Type: array
- Default: `[]`

### Parameter: `enabled`

Expand All @@ -392,7 +435,6 @@ The short name of the action group.
The list of ITSM receivers that are part of this action group.
- Required: No
- Type: array
- Default: `[]`

### Parameter: `location`

Expand All @@ -406,7 +448,6 @@ Location for all resources.
The list of logic app receivers that are part of this action group.
- Required: No
- Type: array
- Default: `[]`

### Parameter: `name`

Expand Down Expand Up @@ -487,28 +528,24 @@ Required. The name of the role to assign. If it cannot be found you can specify
The list of SMS receivers that are part of this action group.
- Required: No
- Type: array
- Default: `[]`

### Parameter: `tags`

Tags of the resource.
- Required: No
- Type: object
- Default: `{object}`

### Parameter: `voiceReceivers`

The list of voice receivers that are part of this action group.
- Required: No
- Type: array
- Default: `[]`

### Parameter: `webhookReceivers`

The list of webhook receivers that are part of this action group.
- Required: No
- Type: array
- Default: `[]`


## Outputs
Expand Down
43 changes: 21 additions & 22 deletions avm/res/insights/action-group/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -15,37 +15,37 @@ param enabled bool = true
param roleAssignments roleAssignmentType

@description('Optional. The list of email receivers that are part of this action group.')
param emailReceivers array = []
param emailReceivers array?

@description('Optional. The list of SMS receivers that are part of this action group.')
param smsReceivers array = []
param smsReceivers array?

@description('Optional. The list of webhook receivers that are part of this action group.')
param webhookReceivers array = []
param webhookReceivers array?

@description('Optional. The list of ITSM receivers that are part of this action group.')
param itsmReceivers array = []
param itsmReceivers array?

@description('Optional. The list of AzureAppPush receivers that are part of this action group.')
param azureAppPushReceivers array = []
param azureAppPushReceivers array?

@description('Optional. The list of AutomationRunbook receivers that are part of this action group.')
param automationRunbookReceivers array = []
param automationRunbookReceivers array?

@description('Optional. The list of voice receivers that are part of this action group.')
param voiceReceivers array = []
param voiceReceivers array?

@description('Optional. The list of logic app receivers that are part of this action group.')
param logicAppReceivers array = []
param logicAppReceivers array?

@description('Optional. The list of function receivers that are part of this action group.')
param azureFunctionReceivers array = []
param azureFunctionReceivers array?

@description('Optional. The list of ARM role receivers that are part of this action group. Roles are Azure RBAC roles and only built-in roles are supported.')
param armRoleReceivers array = []
param armRoleReceivers array?

@description('Optional. Tags of the resource.')
param tags object = {}
param tags object?

@description('Optional. Enable/Disable usage telemetry for module.')
param enableTelemetry bool = true
Expand All @@ -54,7 +54,6 @@ param enableTelemetry bool = true
param location string = 'global'

var builtInRoleNames = {
'API Management Service Contributor': subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '312a565d-c81f-4fd8-895a-4e21e48d571c')
Contributor: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'b24988ac-6180-42a0-ab88-20f7382dd24c')
Owner: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', '8e3af657-a8ff-443c-a75c-2fe8c4bcb635')
Reader: subscriptionResourceId('Microsoft.Authorization/roleDefinitions', 'acdd72a7-3385-48ef-bd42-f606fba81ae7')
Expand Down Expand Up @@ -87,16 +86,16 @@ resource actionGroup 'Microsoft.Insights/actionGroups@2023-01-01' = {
properties: {
groupShortName: groupShortName
enabled: enabled
emailReceivers: (empty(emailReceivers) ? null : emailReceivers)
smsReceivers: (empty(smsReceivers) ? null : smsReceivers)
webhookReceivers: (empty(webhookReceivers) ? null : webhookReceivers)
itsmReceivers: (empty(itsmReceivers) ? null : itsmReceivers)
azureAppPushReceivers: (empty(azureAppPushReceivers) ? null : azureAppPushReceivers)
automationRunbookReceivers: (empty(automationRunbookReceivers) ? null : automationRunbookReceivers)
voiceReceivers: (empty(voiceReceivers) ? null : voiceReceivers)
logicAppReceivers: (empty(logicAppReceivers) ? null : logicAppReceivers)
azureFunctionReceivers: (empty(azureFunctionReceivers) ? null : azureFunctionReceivers)
armRoleReceivers: (empty(armRoleReceivers) ? null : armRoleReceivers)
emailReceivers: emailReceivers
smsReceivers: smsReceivers
webhookReceivers: webhookReceivers
itsmReceivers: itsmReceivers
azureAppPushReceivers: azureAppPushReceivers
automationRunbookReceivers: automationRunbookReceivers
voiceReceivers: voiceReceivers
logicAppReceivers: logicAppReceivers
azureFunctionReceivers: azureFunctionReceivers
armRoleReceivers: armRoleReceivers
}
}

Expand Down
Loading

0 comments on commit edbd874

Please sign in to comment.