diff --git a/avm/utilities/tools/helper/Set-ModuleFileAndFolderSetup.ps1 b/avm/utilities/tools/helper/Set-ModuleFileAndFolderSetup.ps1 index ff345c8e04..f9ead6bfb2 100644 --- a/avm/utilities/tools/helper/Set-ModuleFileAndFolderSetup.ps1 +++ b/avm/utilities/tools/helper/Set-ModuleFileAndFolderSetup.ps1 @@ -46,17 +46,14 @@ function Set-ModuleFileAndFolderSetup { ) if ([String]::IsNullOrEmpty($CurrentLevelFolderPath)) { - # Extract resource type identifier - $resourceTypeIdentifier = ($FullModuleFolderPath -split '[\/|\\]{1}avm[\/|\\]{1}(res|ptn)[\/|\\]{1}')[2] # \ + # Extract path elements + $repoRoot, $moduleType, $resourceTypeIdentifier = $FullModuleFolderPath -split '[\/|\\]{1}avm[\/|\\]{1}(res|ptn)[\/|\\]{1}' # .*/bicep-registry-modules, res|ptn, / # Split resource type identifier into components - $providerNamespace, $resourceType, $childResourceType = $resourceTypeIdentifier -split '[\/|\\]', 3 - - # Construct the root module path up to the providerNamespace (excluding resourceType and childResourceType) - $avmModuleRoot = ($FullModuleFolderPath -split [regex]::Escape("\$providerNamespace\$resourceType"))[0] + "\$providerNamespace" + $providerNamespace, $resourceType, $childResourceType = $resourceTypeIdentifier -split '[\/|\\]', 3 # , , # Join the required path to get up to the resource type folder - $CurrentLevelFolderPath = Join-Path -Path $avmModuleRoot -ChildPath $resourceType + $CurrentLevelFolderPath = Join-Path $repoRoot 'avm' $moduleType $providerNamespace $resourceType } # Collect data