I tried with terraform import command…it imports the resources but does not create terraform configuration
It will not create the TF config files.
From the docs:
The current implementation of Terraform import can only import resources into the state. It does not generate configuration. A future version of Terraform will also generate configuration.
Because of this, prior to running
terraform import
it is necessary to write manually aresource
configuration block for the resource, to which the imported object will be mapped.While this may seem tedious, it still gives Terraform users an avenue for importing existing resources. A future version of Terraform will fully generate configuration, significantly simplifying this process.