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

Conversation

jkmart
Copy link
Contributor

@jkmart jkmart commented Jan 26, 2019

Changes proposed in this pull request:

  • Add support to aws_ses_identity_notification_topic for import
  • Update aws_ses_identity_notification_topic docs

Output from acceptance testing:

$ make testacc TESTARGS='-run=TestAccAwsSESIdentityNotification'

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAwsSESIdentityNotification -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAwsSESIdentityNotificationTopic_basic
=== PAUSE TestAccAwsSESIdentityNotificationTopic_basic
=== RUN   TestAccAwsSESIdentityNotification_importBasic
=== PAUSE TestAccAwsSESIdentityNotification_importBasic
=== CONT  TestAccAwsSESIdentityNotificationTopic_basic
=== CONT  TestAccAwsSESIdentityNotification_importBasic
--- PASS: TestAccAwsSESIdentityNotification_importBasic (14.79s)
--- PASS: TestAccAwsSESIdentityNotificationTopic_basic (23.51s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       23.528s

@ghost ghost added size/S Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. service/ses Issues and PRs that pertain to the ses service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Jan 26, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @jkmart 👋 Thanks for submitting this. Please see the below feedback and let us know if you have any questions or do not have time to implement these items.

@@ -17,6 +17,9 @@ func resourceAwsSesNotificationTopic() *schema.Resource {
Read: resourceAwsSesNotificationTopicRead,
Update: resourceAwsSesNotificationTopicSet,
Delete: resourceAwsSesNotificationTopicDelete,
Importer: &schema.ResourceImporter{
State: resourceAwsSesNotificationImport,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since resourceAwsSesNotificationTopicRead already handles parsing the "complex" IDENTITY|TYPE, we can skip the custom import function and instead appropriately fill in the missing d.Set() in resourceAwsSesNotificationTopicRead, e.g.

Suggested change
State: resourceAwsSesNotificationImport,
State: schema.ImportStatePassthrough,
// remove resourceAwsSesNotificationImport 
// add to resourceAwsSesNotificationTopicRead
	d.Set("identity", identity)
	d.Set("notification_type", notificationType)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, made the change.

@@ -41,6 +41,30 @@ func TestAccAwsSESIdentityNotificationTopic_basic(t *testing.T) {
})
}

func TestAccAwsSESIdentityNotification_importBasic(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of creating bespoke _import acceptance tests, which requires duplication of testing infrastructure, we prefer to instead add the TestStep with ImportState: true and ImportStateVerify: true to all existing acceptance tests. 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay got it, didn't see a good example of that in my brief skim through other tests. Changed.

To import the ID above, it would look as follows:

```
$ import aws_ses_identity_notification_topic.test example.com|Bounce
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing terraform and should likely wrap the pipe in single quotes to prevent shell issues

Suggested change
$ import aws_ses_identity_notification_topic.test example.com|Bounce
$ terraform import aws_ses_identity_notification_topic.test 'example.com|Bounce'

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, fixed.

@bflad bflad added enhancement Requests to existing resources that expand the functionality or scope. waiting-response Maintainers are waiting on response from community or contributor. labels Feb 5, 2019
@jkmart
Copy link
Contributor Author

jkmart commented Feb 7, 2019

Made the changes.

make testacc TESTARGS='-run=TestAccAwsSESIdentityNotification'
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./... -v -parallel 20 -run=TestAccAwsSESIdentityNotification -timeout 120m
?       github.com/terraform-providers/terraform-provider-aws   [no test files]
=== RUN   TestAccAwsSESIdentityNotificationTopic_basic
=== PAUSE TestAccAwsSESIdentityNotificationTopic_basic
=== CONT  TestAccAwsSESIdentityNotificationTopic_basic
--- PASS: TestAccAwsSESIdentityNotificationTopic_basic (27.23s)
PASS
ok      github.com/terraform-providers/terraform-provider-aws/aws       (cached)

@ghost ghost removed the waiting-response Maintainers are waiting on response from community or contributor. label Feb 7, 2019
@bflad bflad added this to the v1.59.0 milestone Feb 12, 2019
Copy link
Contributor

@bflad bflad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks great, thanks so much @jkmart! 🚀

--- PASS: TestAccAwsSESIdentityNotificationTopic_basic (18.57s)

@bflad bflad merged commit a3de834 into hashicorp:master Feb 12, 2019
bflad added a commit that referenced this pull request Feb 12, 2019
@bflad
Copy link
Contributor

bflad commented Feb 14, 2019

This has been released in version 1.59.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Mar 31, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Mar 31, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/ses Issues and PRs that pertain to the ses service. size/S Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants