From b7fae4028cbb02f5380c8a3d092a4fec108be2ef Mon Sep 17 00:00:00 2001 From: AMeng Date: Tue, 4 Oct 2016 15:24:30 -0600 Subject: [PATCH] provider/aws: Import aws_db_event_subscription --- .../import_aws_db_event_subscription_test.go | 28 +++++++++++++++++++ .../aws/resource_aws_db_event_subscription.go | 3 ++ .../source/docs/import/importability.html.md | 1 + .../aws/r/db_event_subscription.html.markdown | 9 ++++++ 4 files changed, 41 insertions(+) create mode 100644 builtin/providers/aws/import_aws_db_event_subscription_test.go diff --git a/builtin/providers/aws/import_aws_db_event_subscription_test.go b/builtin/providers/aws/import_aws_db_event_subscription_test.go new file mode 100644 index 000000000..7f6025839 --- /dev/null +++ b/builtin/providers/aws/import_aws_db_event_subscription_test.go @@ -0,0 +1,28 @@ +package aws + +import ( + "testing" + + "github.com/hashicorp/terraform/helper/resource" +) + +func TestAccAWSDBEventSubscription_importBasic(t *testing.T) { + resourceName := "aws_db_event_subscription.bar" + + resource.Test(t, resource.TestCase{ + PreCheck: func() { testAccPreCheck(t) }, + Providers: testAccProviders, + CheckDestroy: testAccCheckAWSDBEventSubscriptionDestroy, + Steps: []resource.TestStep{ + resource.TestStep{ + Config: testAccAWSDBEventSubscriptionConfig, + }, + + resource.TestStep{ + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, + }, + }) +} diff --git a/builtin/providers/aws/resource_aws_db_event_subscription.go b/builtin/providers/aws/resource_aws_db_event_subscription.go index 2c2fce1ac..388ae8cfa 100644 --- a/builtin/providers/aws/resource_aws_db_event_subscription.go +++ b/builtin/providers/aws/resource_aws_db_event_subscription.go @@ -18,6 +18,9 @@ func resourceAwsDbEventSubscription() *schema.Resource { Read: resourceAwsDbEventSubscriptionRead, Update: resourceAwsDbEventSubscriptionUpdate, Delete: resourceAwsDbEventSubscriptionDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "name": &schema.Schema{ Type: schema.TypeString, diff --git a/website/source/docs/import/importability.html.md b/website/source/docs/import/importability.html.md index 9032250ad..795c7757b 100644 --- a/website/source/docs/import/importability.html.md +++ b/website/source/docs/import/importability.html.md @@ -35,6 +35,7 @@ To make a resource importable, please see the * aws_cloudwatch_log_group * aws_cloudwatch_metric_alarm * aws_customer_gateway +* aws_db_event_subscription * aws_db_instance * aws_db_option_group * aws_db_parameter_group diff --git a/website/source/docs/providers/aws/r/db_event_subscription.html.markdown b/website/source/docs/providers/aws/r/db_event_subscription.html.markdown index 646469e43..a902c7883 100644 --- a/website/source/docs/providers/aws/r/db_event_subscription.html.markdown +++ b/website/source/docs/providers/aws/r/db_event_subscription.html.markdown @@ -32,3 +32,12 @@ The following arguments are supported: * `event_categories` - (Optional) A list of event categories for a SourceType that you want to subscribe to. * `enabled` - (Optional) A boolean flag to enable/disable the subscription. Defaults to true. * `tags` - (Optional) A mapping of tags to assign to the resource. + + +## Import + +DB Event Subscriptions can be imported using the `name`, e.g. + +``` +$ terraform import aws_db_event_subscription.default rds-event-sub +```