From d0afe4354693a1b6356a3e0e5a63ee9df31a0554 Mon Sep 17 00:00:00 2001 From: Ken Kaizu Date: Fri, 18 Oct 2024 16:31:48 +0900 Subject: [PATCH] support zoom_phone_auto_receptionist_ivr import (#55) Signed-off-by: krrrr38 --- .../zoom_phone_auto_receptionist_ivr/import.sh | 2 ++ .../auto_receptionist_ivr_resource.go | 14 ++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 examples/resources/zoom_phone_auto_receptionist_ivr/import.sh diff --git a/examples/resources/zoom_phone_auto_receptionist_ivr/import.sh b/examples/resources/zoom_phone_auto_receptionist_ivr/import.sh new file mode 100644 index 0000000..86cbe16 --- /dev/null +++ b/examples/resources/zoom_phone_auto_receptionist_ivr/import.sh @@ -0,0 +1,2 @@ +# ${auto_reception_id} +terraform import zoom_phone_auto_receptionist_ivr.example t6wyhAZRQXXX_Rv3jj3XXX diff --git a/internal/services/phone/autoreceptionistivr/auto_receptionist_ivr_resource.go b/internal/services/phone/autoreceptionistivr/auto_receptionist_ivr_resource.go index e9c657a..465ede4 100644 --- a/internal/services/phone/autoreceptionistivr/auto_receptionist_ivr_resource.go +++ b/internal/services/phone/autoreceptionistivr/auto_receptionist_ivr_resource.go @@ -9,6 +9,7 @@ import ( "github.com/hashicorp/terraform-plugin-framework-validators/mapvalidator" "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator" "github.com/hashicorp/terraform-plugin-framework/attr" + "github.com/hashicorp/terraform-plugin-framework/path" "github.com/hashicorp/terraform-plugin-framework/resource" "github.com/hashicorp/terraform-plugin-framework/resource/schema" "github.com/hashicorp/terraform-plugin-framework/resource/schema/objectdefault" @@ -21,10 +22,11 @@ import ( ) var ( - _ resource.Resource = &tfResource{} - _ resource.ResourceWithConfigure = &tfResource{} - allKeys = []string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "#"} - keyActionDisabled = int32(-1) + _ resource.Resource = &tfResource{} + _ resource.ResourceWithConfigure = &tfResource{} + _ resource.ResourceWithImportState = &tfResource{} + allKeys = []string{"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "*", "#"} + keyActionDisabled = int32(-1) ) func NewPhoneAutoReceptionistIvrResource() resource.Resource { @@ -562,3 +564,7 @@ func (r *tfResource) Delete(ctx context.Context, req resource.DeleteRequest, res "holiday_id": state.HolidayID.ValueString(), }) } + +func (r *tfResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) { + resource.ImportStatePassthroughID(ctx, path.Root("auto_receptionist_id"), req, resp) +}