- Add Terraform block - import
- Plan and generate configuration
terraform plan -generate-config-out="generated_resources.tf"
- Review the generated configuration and update the abstract resources in the main scripts needed.
- run
terraform apply
to import your infrastructure - delete the import block
https://developer.hashicorp.com/terraform/language/import/generating-configuration