-
-
Save KyMidd/a78fd1178ce939e72bf04ab25b1b4c2a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Filter list for RasGw RG name | |
locals { | |
rg = [for rg in jsondecode(data.azapi_resource_list.subscription_rgs.output).value[*] : rg.name if can(regex("Terraform", rg.name))] | |
} | |
# Find all VMs in GW Subnet using AZAPI | |
data "azapi_resource_list" "server" { | |
count = length(local.rg) == 0 ? 0 : 1 | |
type = "Microsoft.Compute/virtualMachines@2024-03-01" | |
parent_id = "/subscriptions/${data.azurerm_subscription.current.subscription_id}/resourceGroups/${local.rg}" | |
response_export_values = ["*"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment