Skip to content

Commit

Permalink
Standardize on parLocation for specifying Azure regions. (#174)
Browse files Browse the repository at this point in the history
* Standardize on parLocation for specifying Azure region.

* Standardize on parLocation for specifying Azure region.

* Standardize on parLocation for specifying Azure region.

* Updated logging module to standardize on 'Location' for parameters names.

* Added Bicep Common Parameters Naming Standards to Contributing wiki page.

Co-authored-by: Ryan Graham <rygraham@microsoft.com>
Co-authored-by: Jack Tracey <41163455+jtracey93@users.noreply.github.com>
  • Loading branch information
3 people authored Mar 21, 2022
1 parent 6ab46fd commit 57cb458
Show file tree
Hide file tree
Showing 14 changed files with 38 additions and 31 deletions.
8 changes: 8 additions & 0 deletions docs/wiki/Contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,14 @@ etc...
| Modules | `mod` | `modManagementGroups`, `modLogAnalytics` |
| Outputs | `out` | `outIntermediateRootManagementGroupID`, `outLogAnalyticsWorkspaceID` |

### Bicep Common Parameters Naming Standards

The below guidelines should be adhered to whilst contributing to this projects Bicep code.

- `parLocation`
- Shall be used for all module parameters specifying the Azure region to which a resource or module will be deployed.
- The only exception to this is when two inter-related services do not have region parity and need to be deployed to different regions. (i.e. Log Analytics and Automation Accounts in China. See logging module for an example)

### Bicep File Structure

For all Bicep files created as part of this project they will follow the structure pattern of being grouped by element type, this is shown in the image below:
Expand Down
2 changes: 1 addition & 1 deletion docs/wiki/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Some FAQ questions that relate more to the architecture are based over in the CA

## Why are some linter rules disabled via the `#disable-next-line` Bicep function?

In some of the ALZ-Bicep modules some of linter rules are disabled using the `#disable-next-line` Bicep feature. Today, this is primarily for disabling the [no-loc-expr-outside-params linter rule](https://docs.microsoft.com/azure/azure-resource-manager/bicep/linter-rule-no-loc-expr-outside-params) for the, optional, telemetry module as we want to ensure this telemetry deployment is stored in the same location as specified by the `location` input when deploying the Bicep module, instead of in the same location as specified by `parRegion` or `parLocation` as this may be different from the region targeted by the deployment to ARM.
In some of the ALZ-Bicep modules some of linter rules are disabled using the `#disable-next-line` Bicep feature. Today, this is primarily for disabling the [no-loc-expr-outside-params linter rule](https://docs.microsoft.com/azure/azure-resource-manager/bicep/linter-rule-no-loc-expr-outside-params) for the, optional, telemetry module as we want to ensure this telemetry deployment is stored in the same location as specified by the `location` input when deploying the Bicep module, instead of in the same location as specified by `parLocation` as this may be different from the region targeted by the deployment to ARM.

You may also see it in some location for resources that do not require a region for deployment, like Azure Policies, so instead of making users input an additional parameter for the region, we just use the one that was targeted by the deployment to ARM when the module was deployed.

Expand Down
6 changes: 3 additions & 3 deletions docs/wiki/PipelinesADO.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
az account set --subscription $(LoggingSubId)
az deployment sub create \
--template-file infra-as-code/bicep/modules/resourceGroup/resourceGroup.bicep \
--parameters parResourceGroupName=$(LoggingResourceGroupName) parResourceGroupLocation=$(Location) \
--parameters parResourceGroupName=$(LoggingResourceGroupName) parLocation=$(Location) \
--location $(Location) \
--name create_logging_rg-$(RunNumber)
Expand Down Expand Up @@ -119,7 +119,7 @@ jobs:
az account set --subscription $(HubNetworkSubId)
az deployment sub create \
--template-file infra-as-code/bicep/modules/resourceGroup/resourceGroup.bicep \
--parameters parResourceGroupName=$(HubNetworkResourceGroupName) parResourceGroupLocation=$(Location) \
--parameters parResourceGroupName=$(HubNetworkResourceGroupName) parLocation=$(Location) \
--location $(Location) \
--name create_hub_network_rg-$(RunNumber)
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
az account set --subscription $(SpokeNetworkSubId)
az deployment sub create \
--template-file infra-as-code/bicep/modules/resourceGroup/resourceGroup.bicep \
--parameters parResourceGroupName=$(SpokeNetworkResourceGroupName) parResourceGroupLocation=$(Location) \
--parameters parResourceGroupName=$(SpokeNetworkResourceGroupName) parLocation=$(Location) \
--location $(Location) \
--name create_spoke_network_rg-$(RunNumber)
Expand Down
6 changes: 3 additions & 3 deletions docs/wiki/PipelinesGitHub.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ jobs:
subscriptionId: ${{ env.LoggingSubId }}
region: ${{ env.Location }}
template: infra-as-code/bicep/modules/resourceGroup/resourceGroup.bicep
parameters: parResourceGroupName=${{ env.LoggingResourceGroupName }} parResourceGroupLocation=${{ env.Location }}
parameters: parResourceGroupName=${{ env.LoggingResourceGroupName }} parLocation=${{ env.Location }}
deploymentName: create_logging_rg-${{ env.runNumber }}
failOnStdErr: false

Expand All @@ -103,7 +103,7 @@ jobs:
subscriptionId: ${{ env.HubNetworkSubId }}
region: ${{ env.Location }}
template: infra-as-code/bicep/modules/resourceGroup/resourceGroup.bicep
parameters: parResourceGroupName=${{ env.HubNetworkResourceGroupName }} parResourceGroupLocation=${{ env.Location }}
parameters: parResourceGroupName=${{ env.HubNetworkResourceGroupName }} parLocation=${{ env.Location }}
deploymentName: create_hub_network_rg-${{ env.runNumber }}
failOnStdErr: false

Expand Down Expand Up @@ -162,7 +162,7 @@ jobs:
subscriptionId: ${{ env.SpokeNetworkSubId }}
region: ${{ env.Location }}
template: infra-as-code/bicep/modules/resourceGroup/resourceGroup.bicep
parameters: parResourceGroupName=${{ env.SpokeNetworkResourceGroupName }} parResourceGroupLocation=${{ env.Location }}
parameters: parResourceGroupName=${{ env.SpokeNetworkResourceGroupName }} parLocation=${{ env.Location }}
deploymentName: create_spoke_network_rg-${{ env.runNumber }}
failOnStdErr: false

Expand Down
4 changes: 2 additions & 2 deletions infra-as-code/bicep/modules/hubNetworking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ The module requires the following inputs:

| Parameter | Type | Default | Description | Requirement | Example |
| ----------------------------- | ------ | ---------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------- | ---------------------------- |
| parRegion | string | `resourceGroup().location` | The Azure Region to deploy the resources into | None | `eastus` |
| parLocation | string | `resourceGroup().location` | The Azure Region to deploy the resources into | None | `eastus` |
| parBastionEnabled | bool | true | Switch to enable deployment of Bastion Service | None | true |
| parDdosEnabled | bool | true | Switch to enable deployment of distributed denial of service attacks service | None | true |
| parAzureFirewallEnabled | bool | true | Switch to enable deployment of Azure Firewall | None | true |
Expand All @@ -31,7 +31,7 @@ The module requires the following inputs:
| parPublicIPSku | string | Standard | SKU or Tier of Public IP to deploy | Standard or Basic | Standard |
| parTags | object | Empty Array [] | List of tags (Key Value Pairs) to be applied to resources | None | environment: 'development' |
| parHubNetworkAddressPrefix | string | 10.10.0.0/16 | CIDR range for Hub Network | CIDR Notation | 10.10.0.0/16 |
| parHubNetworkName | string | `${parCompanyPrefix}-hub-${parRegion}` | Name prefix for Virtual Network. Prefix will be appended with the region. | 2-50 char | alz-hub-eastus |
| parHubNetworkName | string | `${parCompanyPrefix}-hub-${parLocation}` | Name prefix for Virtual Network. Prefix will be appended with the region. | 2-50 char | alz-hub-eastus |
| parAzureFirewallName | string | `${parCompanyPrefix}-azure-firewall` | Name associated with Azure Firewall | 1-80 char | alz-azure-firewall |
| parAzureFirewallTier | string | Standard | Tier associated with the Firewall to be deployed. | Standard or Premium | Premium |
| parHubRouteTableName | string | `${parCompanyPrefix}-hub-routetable` | Name of route table to be associated with Hub Network | 1-80 char | alz-hub-routetable |
Expand Down
Loading

0 comments on commit 57cb458

Please sign in to comment.