Open Ghostw4lk opened 4 months ago
Hey @Ghostw4lk are you able to export other resources, or is it not working for any resource? There's ways to configure what credentials you use in aztfexport, does the same error occur if you run with the flag --use-azure-cli-cred
?
@Ghostw4lk The issue may cause by tmp
is noexec
on your OS. aztfexport
under the hood will import the resources in parallel in the tmp dir. You can export TMPDIR
to somewhere else to work around the issue. E.g. run export TMPDIR=~/tmp
before running aztfexport
to specify ~/tmp
as the tmp dir.
Hi all,
I want to export a specific Azure resource (PostgreSQL Flexible Server) to Terraform.
The environment details are the following:
To export the resource, I executed the following command: [xxxxx@terraform-vm terraform-export]$ aztfexport query -n "resourceGroup =~ 'MY_RESOURCE_GROUP' and type contains 'Microsoft.DB'"
Error: Failed to import /subscriptions/xxxxxxxxxxxxxxxxxxxxxxxxx/resourceGroups/MY_RESOURCE_GROUP/providers/Microsoft.DBforPostgreSQL/flexibleServers/test-db as azurerm_postgresql_flexible_server.res-0: exit status 1
Error: failed to read schema for azurerm_postgresql_flexible_server.res-0 in registry.terraform.io/hashicorp/azurerm: failed to instantiate provider "registry.terraform.io/hashicorp/azurerm" to obtain schema: fork/exec .terraform/providers/registry.terraform.io/hashicorp/azurerm/3.77.0/linux_amd64/terraform-provider-azurerm_v3.77.0_x5: permission denied
My user has the permission to read the resource group. I am able to get the whole list of 2637 items in that resource group through the following command: aztfexport resource-group MY_RESOURCE_GROUP
If I import a Azure resource through the command "terraform import", it works for me.
What could be the issue, that I can not export any Azure resource to Terraform?