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

use Bicep loop syntax to create spoke resources the same way #497

Merged
merged 12 commits into from
Nov 3, 2021

Conversation

glennmusa
Copy link
Contributor

Description

This change creates spokes and their dependencies in the same way to reduce the likelihood of introducing changes that causes spokes to differ.

First, it creates a mlz.bicep array called spokes that is composed of user-defined and defaulted parameters:

var spokes = [
{
name: 'operations'
subscriptionId: operationsSubscriptionId
resourceGroupName: operationsResourceGroupName

Then, it uses Bicep's loop syntax to create modules for those items in the spokes array:

module spokeResourceGroups './modules/resourceGroup.bicep' = [for spoke in spokes: {
name: 'deploy-rg-${spoke.name}-${nowUtc}'
scope: subscription(spoke.subscriptionId)
params: {
name: spoke.resourceGroupName
location: spoke.location
tags: tags
}
}]

This change also adds documentation on how to retrieve deployed resources programmatically:

https://github.com/Azure/missionlz/blob/d95dc7a43a32260fe6532fab1b313c2f7cff764e/src/bicep/README.md#reference-deployment-output

Issue reference

The issue this PR will close: #493

Checklist

Please make sure you've completed the relevant tasks for this PR out of the following list:

  • All acceptance criteria in the backlog item are met
  • The documentation is updated to cover any new or changed features
  • Manual tests have passed
  • Relevant issues are linked to this PR

@glennmusa glennmusa requested a review from a team October 29, 2021 19:33
@jjansen23
Copy link
Contributor

jjansen23 commented Nov 2, 2021

Using code space, I deployed this branch but it had a failed deployment ""The resource operation completed with terminal provisioning state 'Failed'" - Not sure if it was as a result of the loop changes or not. It may have been a different issue. The reference is at https://portal.azure.com/#@azureglobal2.onmicrosoft.com/resource/subscriptions/2b01c398-5868-496e-a84f-503ea9eac23a/subdeployments

Upon further review, it's a the privateEndpoints that had a conflict.
plmlz-gukfcpjuyo Microsoft.Network/privateEndpoints Conflict

@glennmusa
Copy link
Contributor Author

Upon further review, it's a the privateEndpoints that had a conflict. plmlz-gukfcpjuyo Microsoft.Network/privateEndpoints Conflict

Judging by the error message on the Microsoft.Network/privateEndpoints "plmlz-gukfcpjuyo" deployment, it smells like a transient error with the service:

{
    "status": "Failed",
    "error": {
        "code": "InternalServerError",
        "message": "An error occurred.",
        "details": []
    }
}

Does this occur every time you try to deploy? I have yet to encounter this error, but would love to nail down a root cause if it happens to you repeatedly.

@jjansen23
Copy link
Contributor

When I did a redeploy, from the portal, I received a different error : ""A virtual network cannot be linked to multiple zones with overlapping namespaces. You tried to link virtual network with 'privatelink.monitor.azure.com' and 'privatelink.monitor.azure.com' zones."" ... I will start a fresh deploy and advise of the deployment status.

@jjansen23
Copy link
Contributor

Deployed successfully.

@glennmusa glennmusa merged commit b39c930 into main Nov 3, 2021
@glennmusa glennmusa deleted the glenn/consolidateSpokes branch November 3, 2021 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consolidate spoke network module creation
2 participants