Counted Resources

Approved by the Rabbit of Caerbannog

In situations where you want a number of resources all configured identically (except for the name and unique identity, of course), you can add a count property to the resource. The count will influence the blueprint name, making distinct resources:

storage:
  disk:
    records:
      count: 2
      size: 2 TiB
      type: hdd

This will create two disks with identical size and type, with the names:

  • records

  • records-2

The first resource is not named records-1 because it would be impossible to add the count property later on without incurring a rename.

If at some point later you want to add a third disk, change the count to 3 and then apply. A new disk will be created, and you will have:

  • records

  • records-2

  • records-3

If you want leading zeroes on your count, see the pad function.

Last updated

Was this helpful?