We are trying to develop a custom terraform provider which can support terraform import. While learning to do that we are trying to add import order functionality to terraform-provider-hashicups for orders api. I am unable to find any tutorial for import functionality with terraform-plugin-sdk/v2. We are following https://learn.hashicorp.com/tutorials/terraform/provider-setup?slug=terraform&slug=provider-setup&in=terraform%2Fproviders document to develop terraform provider and currently using https://github.com/hashicorp/terraform-provider-hashicups/ as the example terraform provider.
We are following the doc https://www.terraform.io/docs/extend/resources/import.html for adding import functionality for hashicups provider. But it looks like the doc is for V1 and not V2 version of the terraform provider sdk.
We are adding following code to the datasourcereorder :
Importer: &schema.ResourceImporter{ State: schema.ImportStatePassthrough, },
And have added following block to the coffee/main.tf file:
resource "hashicups_order" "test" { id = 1 }
By trying following command:
terraform import module.psl.hashicups_orders.test 1
we get error saying “Error: Invalid resource type”
Please help us fixing the import functionality.