-
Notifications
You must be signed in to change notification settings - Fork 454
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Modules] Updated Web/StaticSites to new dependencies approach (#1898)
* Updated Web\sites to new dependencies approach * Updated readme * Updated folder default to common. * Update to latest * Update to latest * Update to latest * Update modules/Microsoft.Web/staticSites/.test/common/deploy.test.bicep * Update modules/Microsoft.Web/staticSites/.test/min/deploy.test.bicep
- Loading branch information
1 parent
b8e9fb4
commit 9c750f8
Showing
7 changed files
with
222 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
61 changes: 61 additions & 0 deletions
61
modules/Microsoft.Web/staticSites/.test/common/dependencies.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
@description('Optional. The location to deploy to.') | ||
param location string = resourceGroup().location | ||
|
||
@description('Required. The name of the Virtual Network to create.') | ||
param virtualNetworkName string | ||
|
||
@description('Required. The name of the Managed Identity to create.') | ||
param managedIdentityName string | ||
|
||
resource virtualNetwork 'Microsoft.Network/virtualNetworks@2022-01-01' = { | ||
name: virtualNetworkName | ||
location: location | ||
properties: { | ||
addressSpace: { | ||
addressPrefixes: [ | ||
'10.0.0.0/24' | ||
] | ||
} | ||
subnets: [ | ||
{ | ||
name: 'defaultSubnet' | ||
properties: { | ||
addressPrefix: '10.0.0.0/24' | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
resource privateDNSZone 'Microsoft.Network/privateDnsZones@2020-06-01' = { | ||
name: 'privatelink.azurestaticapps.net' | ||
location: 'global' | ||
|
||
resource virtualNetworkLinks 'virtualNetworkLinks@2020-06-01' = { | ||
name: '${virtualNetwork.name}-vnetlink' | ||
location: 'global' | ||
properties: { | ||
virtualNetwork: { | ||
id: virtualNetwork.id | ||
} | ||
registrationEnabled: false | ||
} | ||
} | ||
} | ||
|
||
resource managedIdentity 'Microsoft.ManagedIdentity/userAssignedIdentities@2018-11-30' = { | ||
name: managedIdentityName | ||
location: location | ||
} | ||
|
||
@description('The resource ID of the created Virtual Network Subnet.') | ||
output subnetResourceId string = virtualNetwork.properties.subnets[0].id | ||
|
||
@description('The principal ID of the created Managed Identity.') | ||
output managedIdentityPrincipalId string = managedIdentity.properties.principalId | ||
|
||
@description('The resource ID of the created Managed Identity.') | ||
output managedIdentityResourceId string = managedIdentity.id | ||
|
||
@description('The resource ID of the created private DNS zone.') | ||
output privateDNSZoneResourceId string = privateDNSZone.id |
74 changes: 74 additions & 0 deletions
74
modules/Microsoft.Web/staticSites/.test/common/deploy.test.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
targetScope = 'subscription' | ||
|
||
// ========== // | ||
// Parameters // | ||
// ========== // | ||
@description('Optional. The name of the resource group to deploy for testing purposes.') | ||
@maxLength(90) | ||
param resourceGroupName string = 'ms.web.staticsites-${serviceShort}-rg' | ||
|
||
@description('Optional. The location to deploy resources to.') | ||
param location string = deployment().location | ||
|
||
@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 = 'wsscom' | ||
|
||
// =========== // | ||
// Deployments // | ||
// =========== // | ||
|
||
// General resources | ||
// ================= | ||
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { | ||
name: resourceGroupName | ||
location: location | ||
} | ||
|
||
module resourceGroupResources 'dependencies.bicep' = { | ||
scope: resourceGroup | ||
name: '${uniqueString(deployment().name, location)}-paramNested' | ||
params: { | ||
virtualNetworkName: 'dep-<<namePrefix>>-vnet-${serviceShort}' | ||
managedIdentityName: 'dep-<<namePrefix>>-msi-${serviceShort}' | ||
} | ||
} | ||
|
||
// ============== // | ||
// Test Execution // | ||
// ============== // | ||
|
||
module testDeployment '../../deploy.bicep' = { | ||
scope: resourceGroup | ||
name: '${uniqueString(deployment().name)}-test-${serviceShort}' | ||
params: { | ||
name: '<<namePrefix>>${serviceShort}001' | ||
allowConfigFileUpdates: true | ||
enterpriseGradeCdnStatus: 'Disabled' | ||
lock: 'CanNotDelete' | ||
privateEndpoints: [ | ||
{ | ||
service: 'staticSites' | ||
subnetResourceId: resourceGroupResources.outputs.subnetResourceId | ||
privateDnsZoneGroup: { | ||
privateDNSResourceIds: [ | ||
resourceGroupResources.outputs.privateDNSZoneResourceId | ||
] | ||
} | ||
} | ||
] | ||
roleAssignments: [ | ||
{ | ||
principalIds: [ | ||
resourceGroupResources.outputs.managedIdentityPrincipalId | ||
] | ||
roleDefinitionIdOrName: 'Reader' | ||
} | ||
] | ||
sku: 'Standard' | ||
stagingEnvironmentPolicy: 'Enabled' | ||
systemAssignedIdentity: true | ||
userAssignedIdentities: { | ||
'${resourceGroupResources.outputs.managedIdentityResourceId}': {} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
modules/Microsoft.Web/staticSites/.test/min/deploy.test.bicep
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
targetScope = 'subscription' | ||
|
||
// ========== // | ||
// Parameters // | ||
// ========== // | ||
@description('Optional. The name of the resource group to deploy for testing purposes.') | ||
@maxLength(90) | ||
param resourceGroupName string = 'ms.web.staticsites-${serviceShort}-rg' | ||
|
||
@description('Optional. The location to deploy resources to.') | ||
param location string = deployment().location | ||
|
||
@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 = 'wssmin' | ||
|
||
// =========== // | ||
// Deployments // | ||
// =========== // | ||
|
||
// General resources | ||
// ================= | ||
resource resourceGroup 'Microsoft.Resources/resourceGroups@2021-04-01' = { | ||
name: resourceGroupName | ||
location: location | ||
} | ||
|
||
// ============== // | ||
// Test Execution // | ||
// ============== // | ||
|
||
module testDeployment '../../deploy.bicep' = { | ||
scope: resourceGroup | ||
name: '${uniqueString(deployment().name)}-test-${serviceShort}' | ||
params: { | ||
name: '<<namePrefix>>${serviceShort}001' | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.