Azure / aztfexport

A tool to bring existing Azure resources under Terraform's management
https://azure.github.io/aztfexport/
Mozilla Public License 2.0
1.63k stars 190 forks source link

Return error for non-existent resources when using terraformless export #560

Closed magodo closed 2 months ago

magodo commented 2 months ago

Previously, when using terraformless export (i.e. -tfclient-plugin-path), if the resource/resource group to be exported doesn't exit, an empty HCL block will still be generated.

This PR adds additional check after the ReadResource RPC call, to raise error if the state read is nil. This logic exists in terraform (@internal/terraform/node_resource_import.go), that's why terraform export will correctly raise the error for non-existent resources.