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

Bicep working state #97

Merged
merged 2 commits into from
Mar 15, 2024
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ param vnetName string
param vnetRG string

param location string
param resourceSuffix string

//
// Variables
//
var owner = 'APIM Const Set'
var owner = 'APIM LZ'

//
// Azure Storage
Expand All @@ -50,16 +51,16 @@ var functionContentShareName = 'func-contents'
//
// - min TLS version
var storageAccounts_minTLSVersion = 'TLS1_2'
var privateEndpoint_storageaccount_queue_Name = 'pep-sa-queue-${workloadName}-${environment}-${location}'
var privateEndpoint_storageaccount_blob_Name = 'pep-sa-blob-${workloadName}-${environment}-${location}'
var privateEndpoint_storageaccount_file_Name = 'pep-sa-file-${workloadName}-${environment}-${location}'
var privateEndpoint_storageaccount_table_Name = 'pep-sa-table-${workloadName}-${environment}-${location}'
var privateEndpoint_storageaccount_queue_Name = 'pep-sa-queue-${resourceSuffix}'
var privateEndpoint_storageaccount_blob_Name = 'pep-sa-blob-${resourceSuffix}'
var privateEndpoint_storageaccount_file_Name = 'pep-sa-file-${resourceSuffix}'
var privateEndpoint_storageaccount_table_Name = 'pep-sa-table-${resourceSuffix}'

//
// Azure Application Service Plan
//
// - name
var serverfarms_appsvcplanAPIMCSBackend_name = 'plan-be-${workloadName}-${environment}-${location}'
var serverfarms_appsvcplanAPIMCSBackend_name = 'plan-be-${resourceSuffix}'
// - location
var serverfarms_appsvcplanAPIMCSBackend_location = location
// Azure Application Service Plan sizing
Expand Down
17 changes: 10 additions & 7 deletions reference-implementations/AppGW-IAPIM-Func/bicep/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ targetScope = 'subscription'

// Parameters
@description('A short name for the workload being deployed alphanumberic only')
@maxLength(8)
param workloadName string
@maxLength(6)
param workloadName string = 'apimlz'

@description('The environment for which the deployment is being executed')
@allowed([
Expand Down Expand Up @@ -53,19 +53,21 @@ param location string = deployment().location

param resourceGroupTags object = {}

param instanceNumber string = '01'

// Variables
var resourceSuffix = '${workloadName}-${environment}-${location}-${uniqueString(subscription().id)}'
var resourceSuffix = '${workloadName}-${environment}-${location}-${instanceNumber}'

var networkingResourceGroupName = 'rg-networking-${resourceSuffix}'
var sharedResourceGroupName = 'rg-shared-${resourceSuffix}'

var backendResourceGroupName = 'rg-backend-${resourceSuffix}'

var apimResourceGroupName = 'rg-apim-${resourceSuffix}'

// Resource Names
var apimName = 'apim-${resourceSuffix}'
var appGatewayName = 'appgw-${resourceSuffix}'

// Resource Group Deployments

resource networkingRG 'Microsoft.Resources/resourceGroups@2021-04-01' = {
name: networkingResourceGroupName
location: location
Expand All @@ -90,14 +92,14 @@ resource apimRG 'Microsoft.Resources/resourceGroups@2021-04-01' = {
tags: resourceGroupTags
}

// Module Deployments
module networking './networking/networking.bicep' = {
name: 'networkingresources'
scope: resourceGroup(networkingRG.name)
params: {
workloadName: workloadName
deploymentEnvironment: environment
location: location
apimName: apimName
}
}

Expand All @@ -112,6 +114,7 @@ module backend './backend/backend.bicep' = {
vnetRG: networkingRG.name
backendSubnetId: networking.outputs.backEndSubnetid
privateEndpointSubnetid: networking.outputs.privateEndpointSubnetid
resourceSuffix: resourceSuffix
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ param privateEndpointAddressPrefix string = '10.2.5.0/24'
param backEndAddressPrefix string = '10.2.6.0/24'
param apimAddressPrefix string = '10.2.7.0/24'
param location string
param apimName string
param instanceNumber string = '01'

/*
@description('A short name for the PL that will be created between Funcs')
Expand All @@ -52,30 +52,33 @@ param functionId string = '123131'
*/

// Variables
var owner = 'APIM Const Set'
var owner = 'APIM LZ'

var apimCSVNetName = 'vnet-apim-cs-${workloadName}-${deploymentEnvironment}-${location}'
var resourceSuffix = '${workloadName}-${deploymentEnvironment}-${location}-${instanceNumber}'

var apimCSVNetName = 'vnet-apim-cs-${workloadName}-${deploymentEnvironment}-${location}-${instanceNumber}'
var bastionName = 'bastion-${resourceSuffix}'
var publicIPAddressName = 'pip-apimcs-${resourceSuffix}' // 'publicIp'
var publicIPAddressNameBastion = 'pip-bastion-${resourceSuffix}' // 'publicIpBastion
var bastionIPConfigName = 'bastionipcfg-${resourceSuffix}'

var bastionSubnetName = 'AzureBastionSubnet' // Azure Bastion subnet must have AzureBastionSubnet name, not 'snet-bast-${workloadName}-${deploymentEnvironment}-${location}'
var devOpsSubnetName = 'snet-devops-${workloadName}-${deploymentEnvironment}-${location}'
var jumpBoxSubnetName = 'snet-jbox-${workloadName}-${deploymentEnvironment}-${location}-001'
var appGatewaySubnetName = 'snet-apgw-${workloadName}-${deploymentEnvironment}-${location}-001'
var privateEndpointSubnetName = 'snet-prep-${workloadName}-${deploymentEnvironment}-${location}-001'
var backEndSubnetName = 'snet-bcke-${workloadName}-${deploymentEnvironment}-${location}-001'
var apimSubnetName = 'snet-apim-${workloadName}-${deploymentEnvironment}-${location}-001'
var bastionName = 'bastion-${workloadName}-${deploymentEnvironment}-${location}'
var bastionIPConfigName = 'bastionipcfg-${workloadName}-${deploymentEnvironment}-${location}'
var jumpBoxSubnetName = 'snet-jbox-${workloadName}-${deploymentEnvironment}-${location}'
var appGatewaySubnetName = 'snet-apgw-${workloadName}-${deploymentEnvironment}-${location}'
var privateEndpointSubnetName = 'snet-prep-${workloadName}-${deploymentEnvironment}-${location}'
var backEndSubnetName = 'snet-bcke-${workloadName}-${deploymentEnvironment}-${location}'
var apimSubnetName = 'snet-apim-${workloadName}-${deploymentEnvironment}-${location}'

var bastionSNNSG = 'nsg-bast-${workloadName}-${deploymentEnvironment}-${location}'
var devOpsSNNSG = 'nsg-devops-${workloadName}-${deploymentEnvironment}-${location}'
var jumpBoxSNNSG = 'nsg-jbox-${workloadName}-${deploymentEnvironment}-${location}'
var appGatewaySNNSG = 'nsg-apgw-${workloadName}-${deploymentEnvironment}-${location}'
var privateEndpointSNNSG = 'nsg-prep-${workloadName}-${deploymentEnvironment}-${location}'
var backEndSNNSG = 'nsg-bcke-${workloadName}-${deploymentEnvironment}-${location}'
var apimSNNSG = 'nsg-apim-${workloadName}-${deploymentEnvironment}-${location}'
var bastionSNNSG = 'nsg-bast-${resourceSuffix}'
var devOpsSNNSG = 'nsg-devops-${resourceSuffix}'
var jumpBoxSNNSG = 'nsg-jbox-${resourceSuffix}'
var appGatewaySNNSG = 'nsg-apgw-${resourceSuffix}'
var privateEndpointSNNSG = 'nsg-prep-${resourceSuffix}'
var backEndSNNSG = 'nsg-bcke-${resourceSuffix}'
var apimSNNSG = 'nsg-apim-${resourceSuffix}'

var publicIPAddressName = 'pip-apimcs-${workloadName}-${deploymentEnvironment}-${location}' // 'publicIp'
var publicIPAddressNameBastion = 'pip-bastion-${workloadName}-${deploymentEnvironment}-${location}'
var publicIPAddressDNSLabel = 'doesnotmatter${uniqueString(subscription().id)}0' // Label is required but name does not matter

// Resources - VNet - SubNets
resource vnetApimCs 'Microsoft.Network/virtualNetworks@2021-02-01' = {
Expand Down Expand Up @@ -470,7 +473,7 @@ resource pip 'Microsoft.Network/publicIPAddresses@2020-07-01' = {
properties: {
publicIPAllocationMethod: 'Static'
dnsSettings: {
domainNameLabel: '${publicIPAddressName}dns'
domainNameLabel: publicIPAddressDNSLabel
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"value": "ENTERPAT"
},
"workloadName" :{
"value": "demoWL"
"value": "apimlz"
},
"CICDAgentType": {
"value": "azuredevops OR github OR none"
Expand All @@ -28,6 +28,9 @@
},
"appGatewayCertType" :{
"value": "selfsigned or custom"
},
"instanceNumber" :{
"value": "instance number E.G 01"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ module vm_jumpboxwinvm './createvmwindows.bicep' = {
username: vmUsername
password: vmPassword
CICDAgentType: CICDAgentType
vmName: 'jumpbox-${environment}'
vmName: 'jumpbox-${resourceSuffix}'
vmSize: vmSize
}
}
Expand Down
Loading