Terraform import of Azure resources

Hi Experts,

Recently I came across a situation wherein I was supposed to reuse the already created azure resources in terraform script. I came across the terraform import documentation and I did not get a concrete answer to my requirement. My requirement is, I should reuse the already created resources in terraform script and when I delete the terraform managed resources, the manually created resources which are imported using terraform script should not get deleted.

Please guide me how to achieve the above requirement.


If you import a resource into the Terraform state you are saying that Terraform now manages that resource, as if it had created it originally. If you then modify or remove the Terraform code about that resource once you run terraform apply it will then modify or remove the resource.

If you don’t want Terraform to manage a resource you should not import it. You can still reference non-managed resources using data sources.

1 Like