Skip to content

Commit

Permalink
feat: Added telemetry value test & minor improvements (Azure#613)
Browse files Browse the repository at this point in the history
## Description

Added telemetry value test & minor improvements

| Pipeline |
| - |

|[![avm.res.network.public-ip-address](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.public-ip-address.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.public-ip-address.yml)
|

|[![avm.res.network.private-endpoint](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.private-endpoint.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.private-endpoint.yml)
|

|[![avm.res.network.private-dns-zone](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.private-dns-zone.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.private-dns-zone.yml)
|
|
[![avm.res.network.network-interface](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.network-interface.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.network-interface.yml)
|

|[![avm.res.network.dns-zone](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.dns-zone.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.dns-zone.yml)
|
|
[![avm.res.network.dns-resolver](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.dns-resolver.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.dns-resolver.yml)
|
|
[![avm.res.network.dns-forwarding-ruleset](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.dns-forwarding-ruleset.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.network.dns-forwarding-ruleset.yml)
|

|[![avm.res.kubernetes-configuration.flux-configuration](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.kubernetes-configuration.flux-configuration.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.kubernetes-configuration.flux-configuration.yml)
|
|
[![avm.res.kubernetes-configuration.extension](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.kubernetes-configuration.extension.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.kubernetes-configuration.extension.yml)
|

|[![avm.res.key-vault.vault](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.key-vault.vault.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.key-vault.vault.yml)
|
|
[![avm.res.insights.action-group](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.action-group.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.insights.action-group.yml)
|

|[![avm.res.compute.ssh-public-key](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.ssh-public-key.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.compute.ssh-public-key.yml)
|
|
[![avm.res.cognitive-services.account](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.cognitive-services.account.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.cognitive-services.account.yml)
|
|
[![avm.res.batch.batch-account](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.batch.batch-account.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.batch.batch-account.yml)
|
|
[![avm.res.operations-management.solution](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.operations-management.solution.yml/badge.svg?branch=users%2Falsehr%2FtelemetryTest)](https://github.com/AlexanderSehr/bicep-registry-modules/actions/workflows/avm.res.operations-management.solution.yml)
|

---------

Co-authored-by: Erika Gressi <[email protected]>
  • Loading branch information
2 people authored and segraef committed Nov 17, 2023
1 parent 125c483 commit e6c9932
Show file tree
Hide file tree
Showing 18 changed files with 114 additions and 30 deletions.
4 changes: 4 additions & 0 deletions avm/res/compute/ssh-public-key/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ module sshPublicKey 'br/public:avm/res/compute/ssh-public-key:<version>' = {
// Required parameters
name: 'cspkmin001'
// Non-required parameters
location: '<location>'
lock: '<lock>'
publicKey: '<publicKey>'
roleAssignments: '<roleAssignments>'
Expand All @@ -75,6 +76,9 @@ module sshPublicKey 'br/public:avm/res/compute/ssh-public-key:<version>' = {
"value": "cspkmin001"
},
// Non-required parameters
"location": {
"value": "<location>"
},
"lock": {
"value": "<lock>"
},
Expand Down
2 changes: 1 addition & 1 deletion avm/res/compute/ssh-public-key/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var builtInRoleNames = {
}

resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' = if (enableTelemetry) {
name: '46d3xbcp.res.network-sshPublicKey.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
name: '46d3xbcp.res.compute-sshpublickey.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
properties: {
mode: 'Incremental'
template: {
Expand Down
4 changes: 2 additions & 2 deletions avm/res/compute/ssh-public-key/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.23.1.45101",
"templateHash": "710464253439949406"
"templateHash": "14304853627075339483"
},
"name": "Public SSH Keys",
"description": "This module deploys a Public SSH Key.\n\n> Note: The resource does not auto-generate the key for you.",
Expand Down Expand Up @@ -167,7 +167,7 @@
"condition": "[parameters('enableTelemetry')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2023-07-01",
"name": "[format('46d3xbcp.res.network-sshPublicKey.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"name": "[format('46d3xbcp.res.compute-sshpublickey.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"properties": {
"mode": "Incremental",
"template": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ module testDeployment '../../../main.bicep' = {
name: '${uniqueString(deployment().name, location)}-test-${serviceShort}'
params: {
name: '${namePrefix}-${serviceShort}001'
location: location
// Workaround for PSRule
lock: null
tags: null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ module nestedDependencies 'dependencies.bicep' = {
generateSshPubKeyScriptName: 'dep-${namePrefix}-ds-${serviceShort}-generateSshPubKey'
sshKeyName: 'dep-${namePrefix}-ssh-${serviceShort}'
managedIdentityName: 'dep-${namePrefix}-msi-${serviceShort}'
location: location
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ param location string = deployment().location
@maxLength(7)
param serviceShort string = 'cspkwaf'


@description('Optional. A token to inject into the name of each resource.')
param namePrefix string = '#_namePrefix_#'

Expand All @@ -40,6 +39,7 @@ module nestedDependencies 'dependencies.bicep' = {
generateSshPubKeyScriptName: 'dep-${namePrefix}-ds-${serviceShort}-generateSshPubKey'
sshKeyName: 'dep-${namePrefix}-ssh-${serviceShort}'
managedIdentityName: 'dep-${namePrefix}-msi-${serviceShort}'
location: location
}
}

Expand Down
2 changes: 1 addition & 1 deletion avm/res/insights/action-group/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ var builtInRoleNames = {
}

resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' = if (enableTelemetry) {
name: '46d3xbcp.res.insights-action-group.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
name: '46d3xbcp.res.insights-actiongroup.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
properties: {
mode: 'Incremental'
template: {
Expand Down
4 changes: 2 additions & 2 deletions avm/res/insights/action-group/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.23.1.45101",
"templateHash": "9343054180603300914"
"templateHash": "6349536763330820602"
},
"name": "Action Groups",
"description": "This module deploys an Action Group.",
Expand Down Expand Up @@ -212,7 +212,7 @@
"condition": "[parameters('enableTelemetry')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2023-07-01",
"name": "[format('46d3xbcp.res.insights-action-group.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"name": "[format('46d3xbcp.res.insights-actiongroup.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"properties": {
"mode": "Incremental",
"template": {
Expand Down
24 changes: 22 additions & 2 deletions avm/res/kubernetes-configuration/extension/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This module deploys a Kubernetes Configuration Extension.
| Resource Type | API Version |
| :-- | :-- |
| `Microsoft.KubernetesConfiguration/extensions` | [2022-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.KubernetesConfiguration/2022-03-01/extensions) |
| `Microsoft.KubernetesConfiguration/fluxConfigurations` | [2022-03-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.KubernetesConfiguration/2022-03-01/fluxConfigurations) |
| `Microsoft.KubernetesConfiguration/fluxConfigurations` | [2023-05-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.KubernetesConfiguration/fluxConfigurations) |

## Usage examples

Expand Down Expand Up @@ -153,6 +153,11 @@ module extension 'br/public:avm/res/kubernetes-configuration/extension:<version>
timeoutInSeconds: 180
url: 'https://github.com/mspnp/aks-baseline'
}
kustomizations: {
unified: {
path: './cluster-manifests'
}
}
namespace: 'flux-system'
suspend: false
}
Expand Down Expand Up @@ -213,6 +218,11 @@ module extension 'br/public:avm/res/kubernetes-configuration/extension:<version>
"timeoutInSeconds": 180,
"url": "https://github.com/mspnp/aks-baseline"
},
"kustomizations": {
"unified": {
"path": "./cluster-manifests"
}
},
"namespace": "flux-system",
"suspend": false
}
Expand Down Expand Up @@ -277,6 +287,11 @@ module extension 'br/public:avm/res/kubernetes-configuration/extension:<version>
timeoutInSeconds: 180
url: 'https://github.com/mspnp/aks-baseline'
}
kustomizations: {
unified: {
path: './cluster-manifests'
}
}
namespace: 'flux-system'
suspend: false
}
Expand Down Expand Up @@ -337,6 +352,11 @@ module extension 'br/public:avm/res/kubernetes-configuration/extension:<version>
"timeoutInSeconds": 180,
"url": "https://github.com/mspnp/aks-baseline"
},
"kustomizations": {
"unified": {
"path": "./cluster-manifests"
}
},
"namespace": "flux-system",
"suspend": false
}
Expand Down Expand Up @@ -478,7 +498,7 @@ This section gives you an overview of all local-referenced module files (i.e., o

| Reference | Type |
| :-- | :-- |
| `br/public:avm/res/kubernetes-configuration/flux-configuration:0.2.0` | Remote reference |
| `br/public:avm/res/kubernetes-configuration/flux-configuration:0.3.1` | Remote reference |

## Notes

Expand Down
6 changes: 3 additions & 3 deletions avm/res/kubernetes-configuration/extension/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ param version string?
param fluxConfigurations array?

resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' = if (enableTelemetry) {
name: '46d3xbcp.res.kubernetesconfiguration-fluxconfig.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
name: '46d3xbcp.res.kubernetesconfiguration-extension.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
properties: {
mode: 'Incremental'
template: {
Expand Down Expand Up @@ -82,7 +82,7 @@ resource extension 'Microsoft.KubernetesConfiguration/extensions@2022-03-01' = {
}
}

module fluxConfiguration 'br/public:avm/res/kubernetes-configuration/flux-configuration:0.2.0' = [for (fluxConfiguration, index) in (fluxConfigurations ?? []): {
module fluxConfiguration 'br/public:avm/res/kubernetes-configuration/flux-configuration:0.3.1' = [for (fluxConfiguration, index) in (fluxConfigurations ?? []): {
name: '${uniqueString(deployment().name, location)}-ManagedCluster-FluxConfiguration${index}'
params: {
enableTelemetry: enableTelemetry
Expand All @@ -94,7 +94,7 @@ module fluxConfiguration 'br/public:avm/res/kubernetes-configuration/flux-config
bucket: fluxConfiguration.?bucket
configurationProtectedSettings: fluxConfiguration.?configurationProtectedSettings
gitRepository: fluxConfiguration.?gitRepository
kustomizations: fluxConfiguration.?kustomizations
kustomizations: fluxConfiguration.kustomizations
suspend: fluxConfiguration.?suspend
}
dependsOn: [
Expand Down
15 changes: 7 additions & 8 deletions avm/res/kubernetes-configuration/extension/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.23.1.45101",
"templateHash": "12293754418506359991"
"templateHash": "629585137254239873"
},
"name": "Kubernetes Configuration Extensions",
"description": "This module deploys a Kubernetes Configuration Extension.",
Expand Down Expand Up @@ -100,7 +100,7 @@
"condition": "[parameters('enableTelemetry')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2023-07-01",
"name": "[format('46d3xbcp.res.kubernetesconfiguration-fluxconfig.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"name": "[format('46d3xbcp.res.kubernetesconfiguration-extension.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"properties": {
"mode": "Incremental",
"template": {
Expand Down Expand Up @@ -183,7 +183,7 @@
"value": "[tryGet(coalesce(parameters('fluxConfigurations'), createArray())[copyIndex()], 'gitRepository')]"
},
"kustomizations": {
"value": "[tryGet(coalesce(parameters('fluxConfigurations'), createArray())[copyIndex()], 'kustomizations')]"
"value": "[coalesce(parameters('fluxConfigurations'), createArray())[copyIndex()].kustomizations]"
},
"suspend": {
"value": "[tryGet(coalesce(parameters('fluxConfigurations'), createArray())[copyIndex()], 'suspend')]"
Expand All @@ -197,7 +197,7 @@
"_generator": {
"name": "bicep",
"version": "0.23.1.45101",
"templateHash": "13420454476526931427"
"templateHash": "885928168160399718"
},
"name": "Kubernetes Configuration Flux Configurations",
"description": "This module deploys a Kubernetes Configuration Flux Configuration.",
Expand Down Expand Up @@ -253,9 +253,8 @@
},
"kustomizations": {
"type": "object",
"nullable": true,
"metadata": {
"description": "Optional. Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster."
"description": "Required. Array of kustomizations used to reconcile the artifact pulled by the source type on the cluster."
}
},
"namespace": {
Expand Down Expand Up @@ -297,7 +296,7 @@
"condition": "[parameters('enableTelemetry')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2023-07-01",
"name": "[format('46d3xbcp.res.kubernetesconfiguration-extension.{0}.{1}', replace('0.2.0', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"name": "[format('46d3xbcp.res.kubernetesconfiguration-fluxconfig.{0}.{1}', replace('0.3.1', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"properties": {
"mode": "Incremental",
"template": {
Expand All @@ -321,7 +320,7 @@
},
"fluxConfiguration": {
"type": "Microsoft.KubernetesConfiguration/fluxConfigurations",
"apiVersion": "2022-03-01",
"apiVersion": "2023-05-01",
"scope": "[format('Microsoft.ContainerService/managedClusters/{0}', parameters('clusterName'))]",
"name": "[parameters('name')]",
"properties": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ module testDeployment '../../../main.bicep' = [for iteration in [ 'init', 'idem'
timeoutInSeconds: 180
url: 'https://github.com/mspnp/aks-baseline'
}
kustomizations: {
unified: {
path: './cluster-manifests'
}
}
suspend: false
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ module testDeployment '../../../main.bicep' = [for iteration in [ 'init', 'idem'
timeoutInSeconds: 180
url: 'https://github.com/mspnp/aks-baseline'
}
kustomizations: {
unified: {
path: './cluster-manifests'
}
}
suspend: false
}
]
Expand Down
2 changes: 1 addition & 1 deletion avm/res/kubernetes-configuration/extension/version.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://aka.ms/bicep-registry-module-version-file-schema#",
"version": "0.2",
"version": "0.3",
"pathFilters": [
"./main.json"
]
Expand Down
2 changes: 1 addition & 1 deletion avm/res/network/network-interface/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ var builtInRoleNames = {
}

resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' = if (enableTelemetry) {
name: '46d3xbcp.res.network-network-interface.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
name: '46d3xbcp.res.network-networkinterface.${replace('-..--..-', '.', '-')}.${substring(uniqueString(deployment().name, location), 0, 4)}'
properties: {
mode: 'Incremental'
template: {
Expand Down
4 changes: 2 additions & 2 deletions avm/res/network/network-interface/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"_generator": {
"name": "bicep",
"version": "0.23.1.45101",
"templateHash": "4856546754568302519"
"templateHash": "13839054472745469471"
},
"name": "Network Interface",
"description": "This module deploys a Network Interface.",
Expand Down Expand Up @@ -342,7 +342,7 @@
"condition": "[parameters('enableTelemetry')]",
"type": "Microsoft.Resources/deployments",
"apiVersion": "2023-07-01",
"name": "[format('46d3xbcp.res.network-network-interface.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"name": "[format('46d3xbcp.res.network-networkinterface.{0}.{1}', replace('-..--..-', '.', '-'), substring(uniqueString(deployment().name, parameters('location')), 0, 4))]",
"properties": {
"mode": "Incremental",
"template": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ $repoRootPath = (Get-Item $PSScriptRoot).Parent.Parent.Parent.Parent.Parent.Pare
. (Join-Path $repoRootPath 'avm' 'utilities' 'pipelines' 'sharedScripts' 'helper' 'Get-IsParameterRequired.ps1')
. (Join-Path $repoRootPath 'avm' 'utilities' 'pipelines' 'sharedScripts' 'helper' 'ConvertTo-OrderedHashtable.ps1')
. (Join-Path $repoRootPath 'avm' 'utilities' 'pipelines' 'sharedScripts' 'helper' 'Get-CrossReferencedModuleList.ps1')
. (Join-Path $repoRootPath 'avm' 'utilities' 'pipelines' 'publish' 'helper' 'Get-BRMRepositoryName.ps1')

####################################
# Load test-specific functions #
Expand Down Expand Up @@ -166,8 +167,7 @@ function Remove-JSONMetadata {
$TemplateObject.resources[$resourceIdentifiers[$index]] = Remove-JSONMetadata -TemplateObject $TemplateObject.resources[$resourceIdentifiers[$index]].properties.template
}
}
}
else {
} else {
# Case: Array
for ($index = 0; $index -lt $TemplateObject.resources.Count; $index++) {
if ($TemplateObject.resources[$index].type -eq 'Microsoft.Resources/deployments') {
Expand Down
Loading

0 comments on commit e6c9932

Please sign in to comment.