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 sesv2 data sources for email identity and mail from attributes #32026

Merged
merged 9 commits into from
Jun 22, 2023

Conversation

jchorl
Copy link
Contributor

@jchorl jchorl commented Jun 16, 2023

Description

Adds two data sources:

  • aws_sesv2_email_identity
  • aws_sesv2_email_identity_mail_from_attributes

Relations

Relates #26796

References

I mostly cargo-culted the other two data sources that were present

Output from Acceptance Testing

I first tested manually:

data "aws_sesv2_email_identity" "example" {
  email_identity = "example.com"
}

data "aws_sesv2_email_identity_mail_from_attributes" "example" {
  email_identity = data.aws_sesv2_email_identity.example.email_identity
}

output "tokens" {
  value = data.aws_sesv2_email_identity.example.dkim_signing_attributes[0].tokens
}

output "mail_from" {
  value = data.aws_sesv2_email_identity_mail_from_attributes.example.mail_from_domain
}

terraform refresh showed the values!

Then I did some automated testing:

root@ca07733e14b8:/work# make testacc TESTS=TestAccSESV2EmailIdentityDataSource_basic PKG=sesv2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sesv2/... -v -count 1 -parallel 20 -run='TestAccSESV2EmailIdentityDataSource_basic'  -timeout 180m
=== RUN   TestAccSESV2EmailIdentityDataSource_basic
=== PAUSE TestAccSESV2EmailIdentityDataSource_basic
=== CONT  TestAccSESV2EmailIdentityDataSource_basic
--- PASS: TestAccSESV2EmailIdentityDataSource_basic (48.90s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/sesv2      49.039s


root@ca07733e14b8:/work# make testacc TESTS=TestAccSESV2EmailIdentityMailFromAttributesDataSource_basic PKG=sesv2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sesv2/... -v -count 1 -parallel 20 -run='TestAccSESV2EmailIdentityMailFromAttributesDataSource_basic'  -timeout 180m
=== RUN   TestAccSESV2EmailIdentityMailFromAttributesDataSource_basic
=== PAUSE TestAccSESV2EmailIdentityMailFromAttributesDataSource_basic
=== CONT  TestAccSESV2EmailIdentityMailFromAttributesDataSource_basic
--- PASS: TestAccSESV2EmailIdentityMailFromAttributesDataSource_basic (48.79s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/sesv2      48.954s

@github-actions
Copy link

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 generators Relates to code generators. service/sesv2 Issues and PRs that pertain to the sesv2 service. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. size/XL Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. documentation Introduces or discusses updates to documentation. labels Jun 16, 2023
@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 Jun 16, 2023
@jar-b jar-b self-assigned this Jun 22, 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=sesv2 TESTS=TestAccSESV2EmailIdentityDataSource_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sesv2/... -v -count 1 -parallel 20 -run='TestAccSESV2EmailIdentityDataSource_'  -timeout 180m
=== RUN   TestAccSESV2EmailIdentityDataSource_basic
=== PAUSE TestAccSESV2EmailIdentityDataSource_basic
=== CONT  TestAccSESV2EmailIdentityDataSource_basic
--- PASS: TestAccSESV2EmailIdentityDataSource_basic (17.86s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/sesv2      21.028s
$ make testacc PKG=sesv2 TESTS=TestAccSESV2EmailIdentityMailFromAttributesDataSource_
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/sesv2/... -v -count 1 -parallel 20 -run='TestAccSESV2EmailIdentityMailFromAttributesDataSource_'  -timeout 180m
=== RUN   TestAccSESV2EmailIdentityMailFromAttributesDataSource_basic
=== PAUSE TestAccSESV2EmailIdentityMailFromAttributesDataSource_basic
=== CONT  TestAccSESV2EmailIdentityMailFromAttributesDataSource_basic
--- PASS: TestAccSESV2EmailIdentityMailFromAttributesDataSource_basic (18.37s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/sesv2      21.583s

@jar-b jar-b merged commit 3d58e24 into hashicorp:main Jun 22, 2023
46 checks passed
@jar-b
Copy link
Member

jar-b commented Jun 22, 2023

Thanks for your contribution, @jchorl! 👍

@github-actions github-actions bot added this to the v5.5.0 milestone Jun 22, 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!

@@ -120,5 +121,5 @@ func dataSourceEmailIdentityRead(ctx context.Context, d *schema.ResourceData, me
d.Set("identity_type", string(out.IdentityType))
d.Set("verified_for_sending_status", out.VerifiedForSendingStatus)

return nil
return diags
Copy link
Contributor Author

Choose a reason for hiding this comment

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

For my edification, why is this commit necessary? Do folks add diagnostics in non-error cases? Is this just setting up for a future where we may add diagnostics all throughout this function?

Copy link
Member

Choose a reason for hiding this comment

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

The latter - future-proofing for cases where we might add non-error diagnostics. The newer Plugin-Framework uses this diagnostics pattern, so we try to make Plugin-SDK based resources look similar.

There are a bunch of legacy Plugin-SDK based resources that don't look this way, but when new stuff comes in its a simple enough change we usually switch over.

@jchorl
Copy link
Contributor Author

jchorl commented Jun 23, 2023

I think this was my first aws tf contribution, so thanks a bunch for cleaning it up and driving it through.

@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 24, 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. generators Relates to code generators. service/sesv2 Issues and PRs that pertain to the sesv2 service. size/XL 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.

3 participants