Using an environment variable in dynamic inventory

Hi -

I have a basic dynamic inventory using the azure plugin:


plugin: azure_rm

include_vm_resource_groups:
- my_resource_group

However, this script runs in CI and teh resource group is created by a previous step, so it is not static. What I really want to do is this:


plugin: azure_rm

include_vm_resource_groups:
- "{{ lookup('env', 'MY_RESOURCE_GROUP') }}"

However the lookup syntax doesn’t work here, and the variable is not expanded. I have a temporary solution using sed to replace the variable on the fly, but is there a more elegant solution?

Thanks,
Andrew.

IT is something I've been trying to add
https://github.com/ansible/ansible/pull/58288