Skip to content

Commit b7fae40

Browse files
committed
provider/aws: Import aws_db_event_subscription
1 parent 828aa7c commit b7fae40

4 files changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
package aws
2+
3+
import (
4+
"testing"
5+
6+
"github.com/hashicorp/terraform/helper/resource"
7+
)
8+
9+
func TestAccAWSDBEventSubscription_importBasic(t *testing.T) {
10+
resourceName := "aws_db_event_subscription.bar"
11+
12+
resource.Test(t, resource.TestCase{
13+
PreCheck: func() { testAccPreCheck(t) },
14+
Providers: testAccProviders,
15+
CheckDestroy: testAccCheckAWSDBEventSubscriptionDestroy,
16+
Steps: []resource.TestStep{
17+
resource.TestStep{
18+
Config: testAccAWSDBEventSubscriptionConfig,
19+
},
20+
21+
resource.TestStep{
22+
ResourceName: resourceName,
23+
ImportState: true,
24+
ImportStateVerify: true,
25+
},
26+
},
27+
})
28+
}

builtin/providers/aws/resource_aws_db_event_subscription.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ func resourceAwsDbEventSubscription() *schema.Resource {
1818
Read: resourceAwsDbEventSubscriptionRead,
1919
Update: resourceAwsDbEventSubscriptionUpdate,
2020
Delete: resourceAwsDbEventSubscriptionDelete,
21+
Importer: &schema.ResourceImporter{
22+
State: schema.ImportStatePassthrough,
23+
},
2124
Schema: map[string]*schema.Schema{
2225
"name": &schema.Schema{
2326
Type: schema.TypeString,

website/source/docs/import/importability.html.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ To make a resource importable, please see the
3535
* aws_cloudwatch_log_group
3636
* aws_cloudwatch_metric_alarm
3737
* aws_customer_gateway
38+
* aws_db_event_subscription
3839
* aws_db_instance
3940
* aws_db_option_group
4041
* aws_db_parameter_group

website/source/docs/providers/aws/r/db_event_subscription.html.markdown

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,12 @@ The following arguments are supported:
3232
* `event_categories` - (Optional) A list of event categories for a SourceType that you want to subscribe to.
3333
* `enabled` - (Optional) A boolean flag to enable/disable the subscription. Defaults to true.
3434
* `tags` - (Optional) A mapping of tags to assign to the resource.
35+
36+
37+
## Import
38+
39+
DB Event Subscriptions can be imported using the `name`, e.g.
40+
41+
```
42+
$ terraform import aws_db_event_subscription.default rds-event-sub
43+
```

0 commit comments

Comments
 (0)