For anyone interested in the workaround, it looks like this:
first_hostname_in_group: yaql: expression: coalesce($.data, []).first(null) data: {get_attr: [TheResourceGroup, hostname]}
hostname returns a list, which may be empty for zero count ResourceGroups, hence the first(null). The coalesce is needed because get_attr returns None during validation, which breaks the query unless we handle it by defaulting to an empty list.
For anyone interested in the workaround, it looks like this:
yaql:
data: {get_attr: [TheResourceGroup, hostname]}
hostname returns a list, which may be empty for zero count ResourceGroups, hence the first(null). The coalesce is needed because get_attr returns None during validation, which breaks the query unless we handle it by defaulting to an empty list.