From 8280210fc512c764a0f0cfcdcdf7cfda9dae563f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20H=C3=A9zser?= Date: Fri, 1 Nov 2024 22:58:20 +0100 Subject: [PATCH] fix --- .../deployment-script/import-image-to-acr/main.bicep | 2 +- .../deployment-script/import-image-to-acr/main.json | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/avm/ptn/deployment-script/import-image-to-acr/main.bicep b/avm/ptn/deployment-script/import-image-to-acr/main.bicep index 0a181bd957..45acd50399 100644 --- a/avm/ptn/deployment-script/import-image-to-acr/main.bicep +++ b/avm/ptn/deployment-script/import-image-to-acr/main.bicep @@ -169,7 +169,7 @@ module imageImport 'br/public:avm/res/resources/deployment-script:0.4.0' = { tags: tags managedIdentities: useExistingManagedIdentity // ? managedIdentities // once the referenced module is using the common type - ? { userAssignedResourcesIds: managedIdentities.userAssignedResourceIds! } + ? { userAssignedResourcesIds: managedIdentities.?userAssignedResourceIds! } : { userAssignedResourcesIds: [newManagedIdentity.id] } kind: 'AzureCLI' runOnce: runOnce diff --git a/avm/ptn/deployment-script/import-image-to-acr/main.json b/avm/ptn/deployment-script/import-image-to-acr/main.json index d6cea585cb..77b2aaf451 100644 --- a/avm/ptn/deployment-script/import-image-to-acr/main.json +++ b/avm/ptn/deployment-script/import-image-to-acr/main.json @@ -6,7 +6,7 @@ "_generator": { "name": "bicep", "version": "0.30.23.60470", - "templateHash": "17604113955002769079" + "templateHash": "13499969833198262162" }, "name": "import-image-to-acr", "description": "This modules deployes an image to an Azure Container Registry.", @@ -195,7 +195,7 @@ "type": "object", "nullable": true, "metadata": { - "example": " {\r\n \"key1\": \"value1\"\r\n \"key2\": \"value2\"\r\n }\r\n ", + "example": " {\n \"key1\": \"value1\"\n \"key2\": \"value2\"\n }\n ", "description": "Optional. Tags of the resource." } } @@ -307,7 +307,7 @@ "tags": { "value": "[parameters('tags')]" }, - "managedIdentities": "[if(variables('useExistingManagedIdentity'), createObject('value', createObject('userAssignedResourcesIds', parameters('managedIdentities').userAssignedResourceIds)), createObject('value', createObject('userAssignedResourcesIds', createArray(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', coalesce(parameters('managedIdentityName'), 'id-ContainerRegistryImport'))))))]", + "managedIdentities": "[if(variables('useExistingManagedIdentity'), createObject('value', createObject('userAssignedResourcesIds', tryGet(parameters('managedIdentities'), 'userAssignedResourceIds'))), createObject('value', createObject('userAssignedResourcesIds', createArray(resourceId('Microsoft.ManagedIdentity/userAssignedIdentities', coalesce(parameters('managedIdentityName'), 'id-ContainerRegistryImport'))))))]", "kind": { "value": "AzureCLI" }, @@ -376,7 +376,7 @@ "value": "[parameters('subnetResourceIds')]" }, "scriptContent": { - "value": "#!/bin/bash\r\n echo \"Waiting on RBAC replication ($initialDelay)\\n\"\r\n sleep $initialDelay\r\n\r\n # retry loop to catch errors (usually RBAC delays, but 'Error copying blobs' is also not unheard of)\r\n retryLoopCount=0\r\n until [ $retryLoopCount -ge $retryMax ]\r\n do\r\n echo \"Importing Image ($retryLoopCount): $imageName into ACR: $acrName\\n\"\r\n if [ $overwriteExistingImage = 'true' ]; then\r\n if [ -n \"$sourceRegistryUsername\" ] && [ -n \"$sourceRegistryPassword\" ]; then\r\n az acr import -n $acrName --source $imageName --image $newImageName --force --username $sourceRegistryUsername --password $sourceRegistryPassword\r\n else\r\n az acr import -n $acrName --source $imageName --image $newImageName --force\r\n fi\r\n else\r\n if [ -n \"$sourceRegistryUsername\" ] && [ -n \"$sourceRegistryPassword\" ]; then\r\n az acr import -n $acrName --source $imageName --image $newImageName --username $sourceRegistryUsername --password $sourceRegistryPassword\r\n else\r\n az acr import -n $acrName --source $imageName --image $newImageName\r\n fi\r\n fi\r\n\r\n sleep $retrySleep\r\n retryLoopCount=$((retryLoopCount+1))\r\n done\r\n\r\n echo \"done\\n\"" + "value": "#!/bin/bash\n echo \"Waiting on RBAC replication ($initialDelay)\\n\"\n sleep $initialDelay\n\n # retry loop to catch errors (usually RBAC delays, but 'Error copying blobs' is also not unheard of)\n retryLoopCount=0\n until [ $retryLoopCount -ge $retryMax ]\n do\n echo \"Importing Image ($retryLoopCount): $imageName into ACR: $acrName\\n\"\n if [ $overwriteExistingImage = 'true' ]; then\n if [ -n \"$sourceRegistryUsername\" ] && [ -n \"$sourceRegistryPassword\" ]; then\n az acr import -n $acrName --source $imageName --image $newImageName --force --username $sourceRegistryUsername --password $sourceRegistryPassword\n else\n az acr import -n $acrName --source $imageName --image $newImageName --force\n fi\n else\n if [ -n \"$sourceRegistryUsername\" ] && [ -n \"$sourceRegistryPassword\" ]; then\n az acr import -n $acrName --source $imageName --image $newImageName --username $sourceRegistryUsername --password $sourceRegistryPassword\n else\n az acr import -n $acrName --source $imageName --image $newImageName\n fi\n fi\n\n sleep $retrySleep\n retryLoopCount=$((retryLoopCount+1))\n done\n\n echo \"done\\n\"" } }, "template": { @@ -922,4 +922,4 @@ } } } -} +} \ No newline at end of file