How to output resources created in a loop

I'm creating 1 or more public IP addresses in Azure using an arm template. The number of addresses depends on a parameter provided by a user.

I'm using the following code snippet to do so

"resources": [
    "type": "Microsoft.Network/publicIPAddresses",
    "name": "[concat(parameters('publicIPAddressesName'), '-', copyIndex())]",
    "apiVersion": "2017-10-01",
    "location": "[parameters('location')]",
    "copy": {
      "name": "publicIPAddressesCopy",
      "count": "[parameters('publicIPAddressesCount')]"
    "properties": {
      "publicIPAddressVersion": "IPv4",
      "publicIPAllocationMethod": "Static",
      "idleTimeoutInMinutes": 4

I'm able to output a couple of IP addresses using the following code snippet

"outputs": {
  "publicIPs": {
    "type": "object",
    "value": {
      "VM-1": {
        "publicIP": "[reference(resourceId('Microsoft.Network/publicIPAddresses', concat(parameters('publicIPAddressesName'), '-1')), '2017-10-01').ipAddress]"
      "VM-2": {
        "publicIP": "[reference(resourceId('Microsoft.Network/publicIPAddresses', concat(parameters('publicIPAddressesName'), '-2')), '2017-10-01').ipAddress]"

This is not very useful since there can be less or more than 2 new public IP addresses. The issue is that I'm not able to use a loop in the outputs section of the template.

How can I output all the created public IP addresses, knowing their number will change between each template run?