Azure data source output

I need to install monitoring agents into my existing VM’s of a single resource group through tags.

I am using data source block to refer my exisitng VM. I have used “azurerm_resources” data source since i was not able to filter tags in Data Source: azurerm_virtual_machine
data “azurerm_resources” “vmid” {
type = “Microsoft.Compute/VirtualMachines”
resource_group_name = “lab”
required_tags = {
monitor = “true”
output “resource_id”
value = data.azurerm_resources.vmid_resources[0].id

Using this i can able to fetch one VM id. When i use splat expression [*] am not able fetch all other resource (VM) ID’s. Can any one help on this topic?