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 import of aws_ses_active_receipt_rule_set resource #27604

Conversation

yktakaha4
Copy link
Contributor

@yktakaha4 yktakaha4 commented Nov 3, 2022

Enable Import with the following command.

terraform import aws_ses_active_receipt_rule_set.my_rule_set my_rule_set_name

As a specification of SES, only one active receipt rule set is valid within the same region.

describe-active-receipt-rule-set AWS API cannot take any arguments and return an active rule set when called.
Import command will succeed only if the rule_set_name passed matches the API return value.

ref: https://docs.aws.amazon.com/cli/latest/reference/ses/describe-active-receipt-rule-set.html

Relations

Closes #29369

References

If no Active ruleset exists, Import will fail.

image

$ terraform import aws_ses_active_receipt_rule_set.my_rule_set hoge
aws_ses_active_receipt_rule_set.my_rule_set: Importing from ID "hoge"...
╷
│ Error: no active Receipt Rule Set found
│ 
│ 
╵

Import will also fail if the ruleset names do not match.

image

$ terraform import aws_ses_active_receipt_rule_set.my_rule_set fuga
aws_ses_active_receipt_rule_set.my_rule_set: Importing from ID "fuga"...
╷
│ Error: SES Receipt Rule Set (fuga) belonging to SES Active Receipt Rule Set not found
│ 
│ 
╵

If rule_set_name matches,

$ terraform import aws_ses_active_receipt_rule_set.my_rule_set hoge
aws_ses_active_receipt_rule_set.my_rule_set: Importing from ID "hoge"...
aws_ses_active_receipt_rule_set.my_rule_set: Import prepared!
  Prepared aws_ses_active_receipt_rule_set for import
aws_ses_active_receipt_rule_set.my_rule_set: Refreshing state... [id=hoge]

Import successful!

The resources that were imported are shown above. These resources are now in
your Terraform state and will henceforth be managed by Terraform.

$ terraform plan                                                   
╷
│ Warning: Provider development overrides are in effect
│ 
│ The following provider development overrides are set in the CLI configuration:
│  - hashicorp/aws in /home/tkhs/go/bin
│ 
│ The behavior may therefore not match any released version of the provider and applying changes may cause the state to become incompatible with published releases.
╵
aws_ses_active_receipt_rule_set.my_rule_set: Refreshing state... [id=hoge]

No changes. Your infrastructure matches the configuration.

Terraform has compared your real infrastructure against your configuration and found no differences, so no changes are needed.

Output from Acceptance Testing

In my local.

$ make testacc TESTS=TestAccSESActiveReceiptRuleSet PKG=ses       
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ses/... -v -count 1 -parallel 20 -run='TestAccSESActiveReceiptRuleSet'  -timeout 180m
=== RUN   TestAccSESActiveReceiptRuleSet_serial
=== RUN   TestAccSESActiveReceiptRuleSet_serial/DataSource
=== RUN   TestAccSESActiveReceiptRuleSet_serial/DataSource/basic
=== RUN   TestAccSESActiveReceiptRuleSet_serial/DataSource/noActiveRuleSet
=== RUN   TestAccSESActiveReceiptRuleSet_serial/Resource
=== RUN   TestAccSESActiveReceiptRuleSet_serial/Resource/basic
=== RUN   TestAccSESActiveReceiptRuleSet_serial/Resource/disappears
--- PASS: TestAccSESActiveReceiptRuleSet_serial (98.90s)
    --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource (38.36s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource/basic (33.18s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource/noActiveRuleSet (5.17s)
    --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource (60.54s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource/basic (32.96s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource/disappears (27.58s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ses        98.980s

@github-actions
Copy link

github-actions bot commented Nov 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/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. needs-triage Waiting for first response or review from a maintainer. labels Nov 3, 2022
@yktakaha4 yktakaha4 force-pushed the f-aws_ses_active_receipt_rule_set-import-support branch from 57ab30f to 7511ca5 Compare November 3, 2022 03:26
@justinretzolk justinretzolk added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Nov 3, 2022
Copy link
Collaborator

@kamilturek kamilturek left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@yktakaha4
Copy link
Contributor Author

@kamilturek @ewbankkit Is there anything I can do to help with this PR merge?
I look forward to using this PR in production code.

@yktakaha4 yktakaha4 force-pushed the f-aws_ses_active_receipt_rule_set-import-support branch from 7511ca5 to b04f424 Compare December 13, 2022 13:06
@yktakaha4 yktakaha4 force-pushed the f-aws_ses_active_receipt_rule_set-import-support branch from b04f424 to ed0730e Compare February 13, 2023 11:22
@yktakaha4
Copy link
Contributor Author

Conflicts resolved.

$ make testacc TESTS=TestAccSESActiveReceiptRuleSet PKG=ses
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ses/... -v -count 1 -parallel 20 -run='TestAccSESActiveReceiptRuleSet'  -timeout 180m
=== RUN   TestAccSESActiveReceiptRuleSet_serial
=== PAUSE TestAccSESActiveReceiptRuleSet_serial
=== CONT  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 (86.02s)
    --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource (55.87s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource/basic (31.21s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource/disappears (24.66s)
    --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource (30.15s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource/basic (25.59s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource/noActiveRuleSet (4.56s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ses        86.129s

@yktakaha4 yktakaha4 changed the title Add import support to aws_ses_active_receipt_rule_set resource Add import of aws_ses_active_receipt_rule_set resource Feb 13, 2023
Copy link
Member

@jar-b jar-b left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

$ make testacc PKG=ses TESTS=TestAccSESActiveReceiptRuleSet_serial
==> 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
=== PAUSE TestAccSESActiveReceiptRuleSet_serial
=== CONT  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 (50.98s)
    --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource (32.66s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource/basic (18.04s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/Resource/disappears (14.62s)
    --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource (18.32s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource/basic (15.94s)
        --- PASS: TestAccSESActiveReceiptRuleSet_serial/DataSource/noActiveRuleSet (2.37s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ses        54.441s

@jar-b jar-b merged commit f62cbe3 into hashicorp:main Jun 16, 2023
@jar-b
Copy link
Member

jar-b commented Jun 16, 2023

Thanks for your contribution, @yktakaha4! 👍

@github-actions github-actions bot added this to the v5.5.0 milestone Jun 16, 2023
@github-actions
Copy link

This functionality has been released in v5.5.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

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 Jul 23, 2023
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.

[Enhancement]: importing aws_ses_active_receipt_rule_set
4 participants