aztfexport icon indicating copy to clipboard operation
aztfexport copied to clipboard

[issue] import never works - context deadline exceeded

Open jonfen93 opened this issue 9 months ago • 4 comments

Whenever i try to run aztfexport i always get the same error:

exit status 1

Error: reading resource group: resources.GroupsClient#Get: Failure sending request: StatusCode=0 -- Original Error: context deadline exceeded

no matter if it's 2 resources or 100. When i launch the import, the status bar stays on 0% and then it fails after a couple of minutes.

i have contributor role on the subscription level.

My steps are (using a cmd prompt on W11): az login (i also have to az login to msgraph) az account set (on the subscription i want to export resources from) aztfexport rg resource-group-name

For reference, these are the versions of things i'm using: aztfexport 0.17.1 az cli 2.70.0 terraform 1.11.2

jonfen93 avatar Mar 26 '25 10:03 jonfen93

@jonfen93 Have you tried to run terraform import azurerm_resource_group.<name> <id> with the same setup?

magodo avatar Mar 26 '25 21:03 magodo

So it's weird. For some resource groups the aztfexport worked flawlessly (i.e. some storage accounts, a cognitive service). I have now tried to export a data factory, a logic app and an api connection and it failed with the same error.

When i tried to run the terraform import it worked fine.

jonfen93 avatar Mar 27 '25 11:03 jonfen93

It seems to me that when I try to export several resources (more than 50) I get the 'context deadline exceeded'.

jonfen93 avatar Mar 27 '25 11:03 jonfen93

One potential reason is that your subscription is under threshold, which causes the provider to retry (up to 3 times, iirc). While the read timeout of most AzureRM resources are set to 5min, hence you get the timeout error. You can verify that by enable debug log: --log-path and --log-level.

magodo avatar Mar 27 '25 22:03 magodo