We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Update child & cross-module references in each module after the folder paths are updated.
You can use the following script to automate this step (note: It does NOT update the READMEs but focuses on the templates)
$repoRootPath = 'C:\dev\ip\Azure-ResourceModules\ResourceModules' $mappings = ConvertFrom-Json (Get-Content -Path (Join-Path $repoRootPath 'rtMapping.jsonc') -Raw) -AsHashtable $templateFilePaths = (Get-ChildItem -Path (Join-Path $repoRootPath 'modules') -File -Recurse -Include 'main.bicep').FullName | Sort-Object $foreachIndex = 0 foreach ($templateFilePath in $templateFilePaths) { $percentageComplete = [Math]::Round(($foreachIndex / $templateFilePaths.count) * 100) $templateFileContent = Get-Content -Path $templateFilePath $updateApplied = $false for ($index = 0; $index -lt $templateFileContent.Count; $index++) { $line = $templateFileContent[$index] if ($line -match "(.+')(.+\/main.bicep)('.+)") { $referencePrefix = $Matches[1] $reference = $Matches[2] $referenceSuffix = $Matches[3] $updatedReference = (( $reference -split '\/') | ForEach-Object { $mappings.ContainsKey($_) ? $mappings[$_] : $_ }) -join '/' $templateFileContent[$index] = '{0}{1}{2}' -f $referencePrefix, $updatedReference, $referenceSuffix $updateApplied = $true } } $shortPath = $templateFilePath -replace [Regex]::Escape("$repoRootPath\modules\") if ($updateApplied) { $null = Set-Content -Path $templateFilePath -Value $templateFileContent Write-Verbose "Updated file [$shortPath]" -Verbose } else { Write-Verbose "Skipped file [$shortPath]" -Verbose } Write-Progress -Activity ('Handled file [{0}/{1}]' -f ($foreachIndex + 1 ), $templateFilePaths.Count) -Status "$percentageComplete% Complete:" -PercentComplete $percentageComplete $foreachIndex++ }
The text was updated successfully, but these errors were encountered:
eriqua
Successfully merging a pull request may close this issue.
Update child & cross-module references in each module after the folder paths are updated.
You can use the following script to automate this step (note: It does NOT update the READMEs but focuses on the templates)
The text was updated successfully, but these errors were encountered: