diff --git a/aws/resource_aws_ses_identity_notification_topic.go b/aws/resource_aws_ses_identity_notification_topic.go index 00adb0644e0..7557aad8a81 100644 --- a/aws/resource_aws_ses_identity_notification_topic.go +++ b/aws/resource_aws_ses_identity_notification_topic.go @@ -17,6 +17,9 @@ func resourceAwsSesNotificationTopic() *schema.Resource { Read: resourceAwsSesNotificationTopicRead, Update: resourceAwsSesNotificationTopicSet, Delete: resourceAwsSesNotificationTopicDelete, + Importer: &schema.ResourceImporter{ + State: schema.ImportStatePassthrough, + }, Schema: map[string]*schema.Schema{ "topic_arn": { @@ -79,6 +82,9 @@ func resourceAwsSesNotificationTopicRead(d *schema.ResourceData, meta interface{ return err } + d.Set("identity", identity) + d.Set("notification_type", notificationType) + getOpts := &ses.GetIdentityNotificationAttributesInput{ Identities: []*string{aws.String(identity)}, } diff --git a/aws/resource_aws_ses_identity_notification_topic_test.go b/aws/resource_aws_ses_identity_notification_topic_test.go index 8eafd947cbc..58c8db55546 100644 --- a/aws/resource_aws_ses_identity_notification_topic_test.go +++ b/aws/resource_aws_ses_identity_notification_topic_test.go @@ -17,6 +17,7 @@ func TestAccAwsSESIdentityNotificationTopic_basic(t *testing.T) { "%s.terraformtesting.com", acctest.RandStringFromCharSet(10, acctest.CharSetAlphaNum)) topicName := fmt.Sprintf("test-topic-%d", acctest.RandInt()) + resourceName := "aws_ses_identity_notification_topic.test" resource.ParallelTest(t, resource.TestCase{ PreCheck: func() { @@ -28,15 +29,20 @@ func TestAccAwsSESIdentityNotificationTopic_basic(t *testing.T) { { Config: fmt.Sprintf(testAccAwsSESIdentityNotificationTopicConfig_basic, domain), Check: resource.ComposeTestCheckFunc( - testAccCheckAwsSESIdentityNotificationTopicExists("aws_ses_identity_notification_topic.test"), + testAccCheckAwsSESIdentityNotificationTopicExists(resourceName), ), }, { Config: fmt.Sprintf(testAccAwsSESIdentityNotificationTopicConfig_update, domain, topicName), Check: resource.ComposeTestCheckFunc( - testAccCheckAwsSESIdentityNotificationTopicExists("aws_ses_identity_notification_topic.test"), + testAccCheckAwsSESIdentityNotificationTopicExists(resourceName), ), }, + { + ResourceName: resourceName, + ImportState: true, + ImportStateVerify: true, + }, }, }) } diff --git a/website/docs/r/ses_identity_notification_topic.markdown b/website/docs/r/ses_identity_notification_topic.markdown index 45d3cf3e34a..512e826513b 100644 --- a/website/docs/r/ses_identity_notification_topic.markdown +++ b/website/docs/r/ses_identity_notification_topic.markdown @@ -27,3 +27,21 @@ The following arguments are supported: * `topic_arn` - (Optional) The Amazon Resource Name (ARN) of the Amazon SNS topic. Can be set to "" (an empty string) to disable publishing. * `notification_type` - (Required) The type of notifications that will be published to the specified Amazon SNS topic. Valid Values: *Bounce*, *Complaint* or *Delivery*. * `identity` - (Required) The identity for which the Amazon SNS topic will be set. You can specify an identity by using its name or by using its Amazon Resource Name (ARN). + +## Import + +Identity Notification Topics can be imported using ID of the record. The ID is made up as IDENTITY|TYPE where IDENTITY is the SES Identity and TYPE is the Notification Type. + +e.g. + +``` +example.com|Bounce +``` + +In this example, `example.com` is the SES Identity and `Bounce` is the Notification Type. + +To import the ID above, it would look as follows: + +``` +$ terraform import aws_ses_identity_notification_topic.test 'example.com|Bounce' +```