provider/aws: Import aws_db_event_subscription

This commit is contained in:
AMeng 2016-10-04 15:24:30 -06:00
parent 828aa7cfb4
commit b7fae4028c
4 changed files with 41 additions and 0 deletions

View File

@ -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,
},
},
})
}

View File

@ -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,

View File

@ -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

View File

@ -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
```