When as S3 bucket is provided for AWS install_modules the $moduleInstallPath should be set for them to be installed to the correct location within the CodeBuild container.
The $moduleInstallPath is not set.
if ($PSVersionTable.Platform -eq 'Win32NT') {
$moduleInstallPath = [System.IO.Path]::Combine($env:ProgramFiles, 'WindowsPowerShell', 'Modules')
if ($PSEdition -eq 'Core') {
$moduleInstallPath = [System.IO.Path]::Combine($env:ProgramFiles, 'PowerShell', 'Modules')
}
else {
$moduleInstallPath = [System.IO.Path]::Combine($env:ProgramFiles, 'WindowsPowerShell', 'Modules')
}
}
elseif ($PSVersionTable.Platform -eq 'Unix') {
$moduleInstallPath = [System.IO.Path]::Combine('/', 'usr', 'local', 'share', 'powershell', 'Modules')
}
elseif ($PSEdition -eq 'Desktop') {
$moduleInstallPath = [System.IO.Path]::Combine($env:ProgramFiles, 'WindowsPowerShell', 'Modules')
}
else {
throw 'Unrecognized OS platform'
}