Skip to content

Commit

Permalink
fix: automation account deployment test failure due to linked Log Ana…
Browse files Browse the repository at this point in the history
…lytics region (#4348)

## Description
Automation account testing pipeline is failing since days, for "Error -
chosen Azure Automation does not have a Log Analytics workspace linked
for operation to succeed."

This affects deployments in default eastUs
https://learn.microsoft.com/en-us/azure/automation/how-to/region-mappings

This PR solves the issue by enforcing test location.

closes #4090 

## Pipeline Reference

| Pipeline |
| -------- |
|
[![avm.res.automation.automation-account](https://github.com/elanzel/bicep-registry-modules/actions/workflows/avm.res.automation.automation-account.yml/badge.svg?branch=autaccount_issue4090)](https://github.com/elanzel/bicep-registry-modules/actions/workflows/avm.res.automation.automation-account.yml)
|

## Type of Change

- [ ] Update to CI Environment or utilities (Non-module affecting
changes)
- [ ] Azure Verified Module updates:
- [x] Bugfix containing backwards-compatible bug fixes, and I have NOT
bumped the MAJOR or MINOR version in `version.json`:
- [ ] Someone has opened a bug report issue, and I have included "Closes
#{bug_report_issue_number}" in the PR description.
- [x] The bug was found by the module author, and no one has opened an
issue to report it yet.
- [ ] Feature update backwards compatible feature updates, and I have
bumped the MINOR version in `version.json`.
- [ ] Breaking changes and I have bumped the MAJOR version in
`version.json`.
  - [ ] Update to documentation

## Checklist

- [x] I'm sure there are no other open Pull Requests for the same
update/change
- [x] I have run `Set-AVMModule` locally to generate the supporting
module files.
- [x] My corresponding pipelines / checks run clean and green without
any errors or warnings
  • Loading branch information
elanzel authored Jan 30, 2025
1 parent 3fb7c6e commit 28a4a2d
Showing 1 changed file with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ metadata description = 'This instance deploys the module with most of its featur
@maxLength(90)
param resourceGroupName string = 'dep-${namePrefix}-automation.account-${serviceShort}-rg'

@description('Optional. The location to deploy resources to.')
param resourceLocation string = deployment().location
// Enforce uksouth to avoid restrictions around zone redundancy in certain regions
#disable-next-line no-hardcoded-location
var enforcedLocation = 'westeurope'

@description('Optional. A short identifier for the kind of deployment. Should be kept short to not run into resource-name length-constraints.')
param serviceShort string = 'aamax'
Expand All @@ -28,30 +29,30 @@ param password string = newGuid()
// =================
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: resourceGroupName
location: resourceLocation
location: enforcedLocation
}

module nestedDependencies 'dependencies.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, resourceLocation)}-nestedDependencies'
name: '${uniqueString(deployment().name, enforcedLocation)}-nestedDependencies'
params: {
virtualNetworkName: 'dep-${namePrefix}-vnet-${serviceShort}'
managedIdentityName: 'dep-${namePrefix}-msi-${serviceShort}'
location: resourceLocation
location: enforcedLocation
}
}

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

Expand All @@ -63,7 +64,7 @@ module diagnosticDependencies '../../../../../../../utilities/e2e-template-asset
module testDeployment '../../../main.bicep' = [
for iteration in ['init', 'idem']: {
scope: resourceGroup
name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}-${iteration}'
name: '${uniqueString(deployment().name, enforcedLocation)}-test-${serviceShort}-${iteration}'
params: {
name: '${namePrefix}${serviceShort}001'
diagnosticSettings: [
Expand Down Expand Up @@ -104,7 +105,7 @@ module testDeployment '../../../main.bicep' = [
]
disableLocalAuth: true
linkedWorkspaceResourceId: diagnosticDependencies.outputs.logAnalyticsWorkspaceResourceId
location: resourceLocation
location: enforcedLocation
lock: {
kind: 'CanNotDelete'
name: 'myCustomLockName'
Expand Down

0 comments on commit 28a4a2d

Please sign in to comment.