From 13f265658e5eb2c8333cd362e42295fcfbf8b028 Mon Sep 17 00:00:00 2001 From: obs-gh-abhinavpappu <141665106+obs-gh-abhinavpappu@users.noreply.github.com> Date: Wed, 21 Aug 2024 20:42:25 -0700 Subject: [PATCH] Fix: support importing monitor_v2 and monitor_v2_action resources (#146) --- docs/resources/monitor_v2.md | 6 +++++- docs/resources/monitor_v2_action.md | 6 +++++- examples/resources/observe_monitor_v2/import.sh | 1 + examples/resources/observe_monitor_v2_action/import.sh | 1 + observe/resource_monitor_v2.go | 3 +++ observe/resource_monitor_v2_action.go | 3 +++ 6 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 examples/resources/observe_monitor_v2/import.sh create mode 100644 examples/resources/observe_monitor_v2_action/import.sh diff --git a/docs/resources/monitor_v2.md b/docs/resources/monitor_v2.md index 64c76286..a5ab69bc 100644 --- a/docs/resources/monitor_v2.md +++ b/docs/resources/monitor_v2.md @@ -480,4 +480,8 @@ Required: Optional: - `path` (String) The path of the path, if the name refers to a column with a JSON object. - +## Import +Import is supported using the following syntax: +```shell +terraform import observe_monitor_v2.example 1414010 +``` diff --git a/docs/resources/monitor_v2_action.md b/docs/resources/monitor_v2_action.md index 68d3f1c6..fad1b5fe 100644 --- a/docs/resources/monitor_v2_action.md +++ b/docs/resources/monitor_v2_action.md @@ -65,4 +65,8 @@ Required: - `header` (String) - `value` (String) - +## Import +Import is supported using the following syntax: +```shell +terraform import observe_monitor_v2_action.example 1414010 +``` diff --git a/examples/resources/observe_monitor_v2/import.sh b/examples/resources/observe_monitor_v2/import.sh new file mode 100644 index 00000000..e02710ad --- /dev/null +++ b/examples/resources/observe_monitor_v2/import.sh @@ -0,0 +1 @@ +terraform import observe_monitor_v2.example 1414010 \ No newline at end of file diff --git a/examples/resources/observe_monitor_v2_action/import.sh b/examples/resources/observe_monitor_v2_action/import.sh new file mode 100644 index 00000000..f92474d1 --- /dev/null +++ b/examples/resources/observe_monitor_v2_action/import.sh @@ -0,0 +1 @@ +terraform import observe_monitor_v2_action.example 1414010 \ No newline at end of file diff --git a/observe/resource_monitor_v2.go b/observe/resource_monitor_v2.go index 70925316..eea5f096 100644 --- a/observe/resource_monitor_v2.go +++ b/observe/resource_monitor_v2.go @@ -23,6 +23,9 @@ func resourceMonitorV2() *schema.Resource { ReadContext: resourceMonitorV2Read, UpdateContext: resourceMonitorV2Update, DeleteContext: resourceMonitorV2Delete, + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, Schema: map[string]*schema.Schema{ // needed as input to MonitorV2Create, also part of MonitorV2 struct "workspace": { // ObjectId! diff --git a/observe/resource_monitor_v2_action.go b/observe/resource_monitor_v2_action.go index fe9dbe54..c0219527 100644 --- a/observe/resource_monitor_v2_action.go +++ b/observe/resource_monitor_v2_action.go @@ -19,6 +19,9 @@ func resourceMonitorV2Action() *schema.Resource { ReadContext: resourceMonitorV2ActionRead, UpdateContext: resourceMonitorV2ActionUpdate, DeleteContext: resourceMonitorV2ActionDelete, + Importer: &schema.ResourceImporter{ + StateContext: schema.ImportStatePassthroughContext, + }, Schema: map[string]*schema.Schema{ // needed as input to CreateMonitorV2Action "workspace": { // ObjectId!