From 073cef4c59e7403171487346e334b57cce9f557b Mon Sep 17 00:00:00 2001 From: solarchad <50369843+solarchad@users.noreply.github.com> Date: Thu, 10 Oct 2019 15:31:00 -0400 Subject: [PATCH] GS-498: Support imports on alerts and services (#21) * Support imports on alerts and services * Update docs for importation on alerts/services --- appoptics/resource_appoptics_alert.go | 3 +++ appoptics/resource_appoptics_service.go | 3 +++ website/docs/r/alert.html.markdown | 8 ++++++++ website/docs/r/service.html.markdown | 8 ++++++++ 4 files changed, 22 insertions(+) diff --git a/appoptics/resource_appoptics_alert.go b/appoptics/resource_appoptics_alert.go index 1bfd290..c7447bb 100644 --- a/appoptics/resource_appoptics_alert.go +++ b/appoptics/resource_appoptics_alert.go @@ -20,6 +20,9 @@ func resourceAppOpticsAlert() *schema.Resource { Read: resourceAppOpticsAlertRead, Update: resourceAppOpticsAlertUpdate, Delete: resourceAppOpticsAlertDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": { diff --git a/appoptics/resource_appoptics_service.go b/appoptics/resource_appoptics_service.go index 0ef02cc..97d724a 100644 --- a/appoptics/resource_appoptics_service.go +++ b/appoptics/resource_appoptics_service.go @@ -19,6 +19,9 @@ func resourceAppOpticsService() *schema.Resource { Read: resourceAppOpticsServiceRead, Update: resourceAppOpticsServiceUpdate, Delete: resourceAppOpticsServiceDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "type": { diff --git a/website/docs/r/alert.html.markdown b/website/docs/r/alert.html.markdown index 0ecb328..ad12b9c 100644 --- a/website/docs/r/alert.html.markdown +++ b/website/docs/r/alert.html.markdown @@ -65,3 +65,11 @@ Conditions (`condition`) support the following: Attributes (`attributes`) support the following: * `runbook_url` - a URL for the runbook to be followed when this alert is firing. Used in the AppOptics UI if set. + +## Import + +Alerts can be imported using the `id`, e.g. + +``` +$ terraform import appoptics_alert.foobar 13581321 +``` diff --git a/website/docs/r/service.html.markdown b/website/docs/r/service.html.markdown index 654a662..18e8de1 100644 --- a/website/docs/r/service.html.markdown +++ b/website/docs/r/service.html.markdown @@ -43,3 +43,11 @@ The following attributes are exported: * `type` - The type of notificaion. * `title` - The alert title. * `settings` - a JSON hash of settings specific to the alert type. + +## Import + +Services can be imported using the `id`, e.g. + +``` +$ terraform import appoptics_service.foobar 13581321 +```