Skip to content

Commit

Permalink
Refactor main.bicep and vnets.bicep for accurate workload subnet refe…
Browse files Browse the repository at this point in the history
…rencing and streamline firewall module integration. Corrected subnet indexing and ensured proper parameter passing between modules
  • Loading branch information
kennethcarnes committed Feb 5, 2024
1 parent d3fb057 commit f2fa1aa
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bicep/main.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,17 @@ module vnets './vnets.bicep' = {
}
}

// Outputs (if any)
module firewall './firewall.bicep' = {
name: 'firewallDeployment'
params: {
location: location
hubVnetName: hubVnetName
workloadSubnetId: vnets.outputs.workloadSubnetId
firewallPrivateIp: 'your_firewall_private_ip_here' // Replace with actual IP
}
dependsOn: [
vnets
]
}

output hubVnetId string = vnets.outputs.hubVnetId
1 change: 1 addition & 0 deletions bicep/vnets.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,4 @@ resource vnetPeerings 'Microsoft.Network/virtualNetworks/virtualNetworkPeerings@

// Outputs
output hubVnetId string = hubVnet.id
output workloadSubnetId string = spokeVnets[0].properties.subnets[0].id
26 changes: 26 additions & 0 deletions scripts/validateDeployment.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# PowerShell script for validating Azure Bicep templates

# Ensuring Azure CLI and Bicep are installed
if (-not (Get-Command "az" -ErrorAction SilentlyContinue)) {
Write-Error "Azure CLI is not installed. Please install it from https://aka.ms/installazurecliwindows"
exit
}

if (-not (Get-Command "bicep" -ErrorAction SilentlyContinue)) {
Write-Error "Bicep CLI is not installed. Please install it from https://aka.ms/installbicep"
exit
}

# Validate main.bicep
Write-Host "Validating main.bicep..."
az bicep build --file ./bicep/main.bicep

# Validate firewall.bicep
Write-Host "Validating firewall.bicep..."
az bicep build --file ./bicep/firewall.bicep

# Validate vnets.bicep
Write-Host "Validating firewall.bicep..."
az bicep build --file ./bicep/vnets.bicep

Write-Host "Validation completed."

0 comments on commit f2fa1aa

Please sign in to comment.