Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for resource_aws_ses_identity_notification_topic import #7343

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions aws/resource_aws_ses_identity_notification_topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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)},
}
Expand Down
10 changes: 8 additions & 2 deletions aws/resource_aws_ses_identity_notification_topic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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,
},
},
})
}
Expand Down
18 changes: 18 additions & 0 deletions website/docs/r/ses_identity_notification_topic.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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'
```