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

Prevent panic from nil SES active receipt rule set #27073

Merged
merged 5 commits into from
Oct 5, 2022

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented Oct 3, 2022

Description

Handles cases where there is no SES receipt rule set as active. An empty result error is now returned in this scenario:

data.aws_ses_active_receipt_rule_set.active_receipt_rule_set: Reading...
╷
│ Error: empty result
│
│   with data.aws_ses_active_receipt_rule_set.active_receipt_rule_set,
│   on main.tf line 15, in data "aws_ses_active_receipt_rule_set" "active_receipt_rule_set":
│   15: data "aws_ses_active_receipt_rule_set" "active_receipt_rule_set" {}
│
╵

Relations

Closes #26936

Output from Acceptance Testing

$ make testacc TESTS='TestAccSESActiveReceiptRuleSet_serial' PKG=ses
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ses/... -v -count 1 -parallel 20 -run='TestAccSESActiveReceiptRuleSet_serial'  -timeout 180m
=== RUN   TestAccSESActiveReceiptRuleSet_serial
=== RUN   TestAccSESActiveReceiptRuleSet_serial/Resource
=== RUN   TestAccSESActiveReceiptRuleSet_serial/Resource/disappears
=== RUN   TestAccSESActiveReceiptRuleSet_serial/Resource/basic
=== RUN   TestAccSESActiveReceiptRuleSet_serial/DataSource
=== RUN   TestAccSESActiveReceiptRuleSet_serial/DataSource/basic
=== RUN   TestAccSESActiveReceiptRuleSet_serial/DataSource/noActiveRuleSet
--- PASS: TestAccSESActiveReceiptRuleSet_serial (45.07s)
    --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource (28.15s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource/disappears (14.75s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource/basic (13.40s)
    --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource (16.92s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource/basic (14.81s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource/noActiveRuleSet (2.11s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ses        47.569s

@github-actions
Copy link

github-actions bot commented Oct 3, 2022

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@github-actions github-actions bot added size/XS Managed by automation to categorize the size of a PR. service/ses Issues and PRs that pertain to the ses service. labels Oct 3, 2022
@jar-b jar-b force-pushed the b-ses-active-reciept-rule-set-panic branch from c1e70fa to bc4eb77 Compare October 4, 2022 15:39
@github-actions github-actions bot added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/M Managed by automation to categorize the size of a PR. and removed size/XS Managed by automation to categorize the size of a PR. labels Oct 4, 2022
Comment on lines +101 to +103
_, err = conn.SetActiveReceiptRuleSet(&ses.SetActiveReceiptRuleSetInput{
RuleSetName: nil,
})
Copy link
Member Author

Choose a reason for hiding this comment

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

Passing a null RuleSetName is how the AWS docs suggest removing an active receipt rule set:
https://pkg.go.dev/github.com/aws/aws-sdk-go-v2/service/ses#Client.SetActiveReceiptRuleSet

@johnsonaj
Copy link
Contributor

$ make testacc TESTS='TestAccSESActiveReceiptRuleSet_serial' PKG=ses

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ses/... -v -count 1 -parallel 20 -run='TestAccSESActiveReceiptRuleSet_serial'  -timeout 180m
=== RUN   TestAccSESActiveReceiptRuleSet_serial
=== RUN   TestAccSESActiveReceiptRuleSet_serial/Resource
=== RUN   TestAccSESActiveReceiptRuleSet_serial/Resource/basic
=== RUN   TestAccSESActiveReceiptRuleSet_serial/Resource/disappears
=== RUN   TestAccSESActiveReceiptRuleSet_serial/DataSource
=== RUN   TestAccSESActiveReceiptRuleSet_serial/DataSource/basic
=== RUN   TestAccSESActiveReceiptRuleSet_serial/DataSource/noActiveRuleSet
--- PASS: TestAccSESActiveReceiptRuleSet_serial (68.47s)
    --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource (23.33s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource/basic (12.35s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource/disappears (10.98s)
    --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource (45.14s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource/basic (43.28s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource/noActiveRuleSet (1.86s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ses	71.256s

@johnsonaj johnsonaj self-requested a review October 5, 2022 14:26
Copy link
Contributor

@johnsonaj johnsonaj left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀

@jar-b jar-b merged commit 5cf5796 into main Oct 5, 2022
@jar-b jar-b deleted the b-ses-active-reciept-rule-set-panic branch October 5, 2022 14:52
@github-actions github-actions bot added this to the v4.34.0 milestone Oct 5, 2022
github-actions bot pushed a commit that referenced this pull request Oct 5, 2022
@github-actions
Copy link

github-actions bot commented Oct 6, 2022

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

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

github-actions bot commented Nov 7, 2022

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Nov 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
service/ses Issues and PRs that pertain to the ses service. size/M 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.

data_source/aws_ses_active_receipt_rule_set: Panic when no SES Active Receipt Rule Set exists
2 participants