package
is not a valid top-level key, but packages
is. See the docs here.
It really should warn for this error but does not currently.
Try this:
#cloud-config
packages:
- build-essential
- zsh
Upstream cloud-init is working on better warnings/errors for this using jsonschema validation for configs (many changes on this front in upcoming releases). Currently, however, top level keys are not validated currently.
Also, it looks like multipass automatically inserts the #cloud-config
header for you so I don't think you need it on multipass specifically, but for portability to other datasources I would consider adding it anyways. Based on the userdata values in a multipass instance I tested I see the header both ways, so for portability I recommend adding it even though it's a no-op on multipass.