I followed this tutorial but the command
$ echo azurerm_app_service_plan.example.id | terraform console /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/serverfarms/instance1 $ echo azurerm_app_service.example.id | terraform console /subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/mygroup1/providers/Microsoft.Web/sites/instance1
does not work if you have modules.
The command terraform console allows you to access to the output of the resources but for the modules, you need to explicitly export the id as an output
Is there a way to get the id of a resource by its address without having the need to modify the output of modules if you did not exported the ids?
Right now, to get the id, I am fetching the state as json with
terraform show -json then I parse the json to filter by address and I retrieve the id from the values property.
Is there a better way?
May be a new command in the terraform cli would be great!