Merge pull request #9220 from AMeng/import-db-event-sub

provider/aws: Import aws_db_event_subscription
This commit is contained in:
Paul Stack 2016-10-05 01:03:53 +01:00 committed by GitHub
commit aa97ebd0e7
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
```