aztfexport icon indicating copy to clipboard operation
aztfexport copied to clipboard

Filter by either ARM or HCL resource provider type

Open MohnJadden opened this issue 2 years ago • 1 comments

Aztfy works wonderfully for importing resources and I hugely appreciate the interactive mode. However, it would be wonderful if there's a way to only include results by specific HCL or ARM resource providers - that way if we have to import a resource group and only care about specific resources, we can target those.

My real-world example: I need to use aztfy to import six resource groups and their Azure Virtual Desktop resources (azurerm_virtual_desktop_host_pool, azurerm_virtual_desktop_workspace, azurerm_virtual_desktop_application_group, etc.) I'd like to be able to do something like aztfy rg VDI-ResourceGroup-1 -filter azurerm_virtual_desktop_host_pool azurerm_virtual_desktop_workspace azurerm_virtual_desktop_application_group to enumerate that I only want resources under those specific HCL providers, or aztfy rg VDI-ResourceGroup-1 -filter azurerm_virtual_desktop* to enumerate that I want to see any resource provider resources that start with the term "azurerm_virtual_desktop".

MohnJadden avatar Jul 21 '22 13:07 MohnJadden

@MohnJadden In this case you can repeatedly use aztfy resource --append <ressource id> to terrafy those resources. The only thing you need to figure out is the resource id of them, for which you can use either azure cli, Portal, ARG, etc.

magodo avatar Jul 22 '22 02:07 magodo