'Importing existing terraform resources using a tag or pattern

Due to some accident my .tfstate got deleted and current situation is I have all the resources up and live and also have all the terraform code for those resources. However, whats not there is the state.

I am aware of terraform import but reading documentation what I understood that you have to individually specify resource names to import it. This will be too tedious or impractical since the number of resources are high.The backend being used it azurerm.

My questions is, is there a way I can import existing resource using a filter such as tags or name pattern?

I am aware of third party tools such as terraformer but I am looking for a more standard and fool proof way to do it, since the infrastructure is of critical nature.



Solution 1:[1]

Terraformer is a tool that supports large scale import jobs by pattern. It explicitly supports most major and minor cloud providers, including azure.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1