Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: api version update + fixing failing workflow runs - avm/res/event-hub/namespace #2004

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion avm/res/event-hub/namespace/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ This module deploys an Event Hub Namespace.
| :-- | :-- |
| `Microsoft.Authorization/locks` | [2020-05-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2020-05-01/locks) |
| `Microsoft.Authorization/roleAssignments` | [2022-04-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.Authorization/2022-04-01/roleAssignments) |
| `Microsoft.EventHub/namespaces` | [2022-10-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.EventHub/2022-10-01-preview/namespaces) |
| `Microsoft.EventHub/namespaces` | [2024-01-01](https://learn.microsoft.com/en-us/azure/templates/Microsoft.EventHub/2024-01-01/namespaces) |
| `Microsoft.EventHub/namespaces/authorizationRules` | [2022-10-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.EventHub/2022-10-01-preview/namespaces/authorizationRules) |
| `Microsoft.EventHub/namespaces/disasterRecoveryConfigs` | [2022-10-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.EventHub/2022-10-01-preview/namespaces/disasterRecoveryConfigs) |
| `Microsoft.EventHub/namespaces/eventhubs` | [2022-10-01-preview](https://learn.microsoft.com/en-us/azure/templates/Microsoft.EventHub/2022-10-01-preview/namespaces/eventhubs) |
Expand Down
2 changes: 1 addition & 1 deletion avm/res/event-hub/namespace/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ resource avmTelemetry 'Microsoft.Resources/deployments@2023-07-01' =
}
}

resource eventHubNamespace 'Microsoft.EventHub/namespaces@2022-10-01-preview' = {
resource eventHubNamespace 'Microsoft.EventHub/namespaces@2024-01-01' = {
name: name
location: location
tags: tags
Expand Down
34 changes: 17 additions & 17 deletions avm/res/event-hub/namespace/main.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.54.24096",
"templateHash": "5884251970985873966"
"version": "0.27.1.19265",
"templateHash": "17155929804559949638"
},
"name": "Event Hub Namespaces",
"description": "This module deploys an Event Hub Namespace.",
Expand Down Expand Up @@ -724,7 +724,7 @@
},
"eventHubNamespace": {
"type": "Microsoft.EventHub/namespaces",
"apiVersion": "2022-10-01-preview",
"apiVersion": "2024-01-01",
"name": "[parameters('name')]",
"location": "[parameters('location')]",
"tags": "[parameters('tags')]",
Expand Down Expand Up @@ -854,8 +854,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.54.24096",
"templateHash": "15327912662565121564"
"version": "0.27.1.19265",
"templateHash": "8813943813948617548"
},
"name": "Event Hub Namespace Authorization Rule",
"description": "This module deploys an Event Hub Namespace Authorization Rule.",
Expand Down Expand Up @@ -951,8 +951,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.54.24096",
"templateHash": "11732013494690054024"
"version": "0.27.1.19265",
"templateHash": "14979139814432874856"
},
"name": "Event Hub Namespace Disaster Recovery Configs",
"description": "This module deploys an Event Hub Namespace Disaster Recovery Config.",
Expand Down Expand Up @@ -1067,8 +1067,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.54.24096",
"templateHash": "14538170733088329405"
"version": "0.27.1.19265",
"templateHash": "4976741061595991628"
},
"name": "Event Hub Namespace Event Hubs",
"description": "This module deploys an Event Hub Namespace Event Hub.",
Expand Down Expand Up @@ -1478,8 +1478,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.54.24096",
"templateHash": "7757490711276971084"
"version": "0.27.1.19265",
"templateHash": "5847658940513938806"
},
"name": "Event Hub Namespace Event Hub Consumer Groups",
"description": "This module deploys an Event Hub Namespace Event Hub Consumer Group.",
Expand Down Expand Up @@ -1582,8 +1582,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.54.24096",
"templateHash": "15301134976738274567"
"version": "0.27.1.19265",
"templateHash": "11948548202226583623"
},
"name": "Event Hub Namespace Event Hub Authorization Rules",
"description": "This module deploys an Event Hub Namespace Event Hub Authorization Rule.",
Expand Down Expand Up @@ -1718,8 +1718,8 @@
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.26.54.24096",
"templateHash": "3984181780336367181"
"version": "0.27.1.19265",
"templateHash": "10618868316670404260"
},
"name": "Event Hub Namespace Network Rule Sets",
"description": "This module deploys an Event Hub Namespace Network Rule Set.",
Expand Down Expand Up @@ -2527,14 +2527,14 @@
"metadata": {
"description": "The principal ID of the system assigned identity."
},
"value": "[coalesce(tryGet(tryGet(reference('eventHubNamespace', '2022-10-01-preview', 'full'), 'identity'), 'principalId'), '')]"
"value": "[coalesce(tryGet(tryGet(reference('eventHubNamespace', '2024-01-01', 'full'), 'identity'), 'principalId'), '')]"
},
"location": {
"type": "string",
"metadata": {
"description": "The location the resource was deployed into."
},
"value": "[reference('eventHubNamespace', '2022-10-01-preview', 'full').location]"
"value": "[reference('eventHubNamespace', '2024-01-01', 'full').location]"
},
"eventHubResourceIds": {
"type": "array",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ module testDeployment '../../../main.bicep' = {
scope: resourceGroup
name: '${uniqueString(deployment().name, resourceLocation)}-test-${serviceShort}'
params: {
name: '${namePrefix}${serviceShort}001'
name: '${namePrefix}${serviceShort}${substring(uniqueString(baseTime), 0, 3)}'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @segraef could you elaborate why this was changed? Just curious, as it take away the possiblity to test this deployment in an idempontent way.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @AlexanderSehr the unique name should solve a conflict when deploying the encrypted eventhub:
VERBOSE: 11:05:03 - The deployment 'a-r-eh-n-encr-t1-20240612T1106073886Z' failed with error(s). Showing 1 out of 1 error(s).
Status Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details. (Code: DeploymentFailed)

  • The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'. (Code:ResourceDeploymentFailure)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, but when I take a look at the last failed pipelines I see 3 erros through 3 attempts

1.

The deployment 'a-r-eh-n-encr-t1-20240612T1106073886Z' failed with error(s). Showing 1 out of 1 error(s).
  Status Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details. (Code: DeploymentFailed)
   - The resource write operation failed to complete successfully, because it reached terminal provisioning state 'Failed'. (Code:ResourceDeploymentFailure)

2.

The deployment 'a-r-eh-n-encr-t2-20240612T1106082182Z' failed with error(s). Showing 2 out of 2 error(s).
  Status Message: Namespace name '***ehnenc001' is not available. Reason: NameInUse. Message: Name already in use (Code:NamespaceUnavailable)
  
  Status Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details. (Code: DeploymentFailed)
   - Namespace name '***ehnenc001' is not available. Reason: NameInUse. Message: Name already in use (Code:NamespaceUnavailable)

3.

The deployment 'a-r-eh-n-encr-t3-20240612T1106487953Z' failed with error(s). Showing 2 out of 2 error(s). Status Message: Namespace name '***ehnenc001' is not available. Reason: NameInUse. Message: Name already in use (Code:NamespaceUnavailable)
  Status Message: At least one resource deployment operation failed. Please list deployment operations for details. Please see https://aka.ms/arm-deployment-operations for usage details. (Code: DeploymentFailed)  
   - Namespace name '***ehnenc001' is not available. Reason: NameInUse. Message: Name already in use (Code:NamespaceUnavailable)

Of which only the first is really relevant as all others could be / are follow-up errors as the Namespace from Attempt 1 is still around (and later the one from Attempt 2.
I don't think we're actually fixing the error, but just masking it by deploying 3 different Namespaces.

I would suggest to run the deployment of the encr test once without the removal (which will likely fail) and then look into the deployment and find the actual cause of the error. The resource write operation failed to complete successfully isn't exactly saying much.
My guess is that we have similar issues like we have with other modules where the permissions for the key vault key take longer to propagate than the deployment is willing to wait (which is super nasty by the way). If that turns out to be the case here too, then we should fix that instead. Likely by adding some wait logic via an inline deployment script, as annoying as it may be.

Am I making sense 😄 ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found that the issue on deployment failure was related to the publicNetworkAccess parameter set to "SecuredByPerimeter". Solved in PR #2361
Setting this PR to draft, we'll use this for the API update

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, look at this who could've guess this. Great work thanks @elanzel !

location: resourceLocation
publicNetworkAccess: 'SecuredByPerimeter'
skuName: 'Premium'
Expand Down