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

provider/aws: Implement aws_ses_domain_identity #13098

Merged
merged 3 commits into from
Apr 1, 2017

Conversation

dougneal
Copy link
Contributor

@dougneal dougneal commented Mar 27, 2017

Adding the capability to add domain identities to Amazon SES and capture the domain verification code.

Tasks:

  • Implement CRUD functions
  • Implement import
  • Complete test coverage
  • Update documentation

Should (partially) satisfy #11232.

@dougneal dougneal force-pushed the enh-aws_ses_domain_identity branch 2 times, most recently from ce287f3 to 6997ddc Compare March 27, 2017 21:18
@dougneal dougneal changed the title [WIP] provider/aws: Implement aws_ses_domain_identity provider/aws: Implement aws_ses_domain_identity Mar 27, 2017
@dougneal dougneal force-pushed the enh-aws_ses_domain_identity branch from 6997ddc to 9852daf Compare March 27, 2017 22:31
@dougneal
Copy link
Contributor Author

Build failure appears to be caused by unrelated code.

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Other than randomization of the test, this looks pretty good to me and it's a great start for SES identities! 👍

Let me know if you need any help with addressing the mentioned point(s) or if you have any other questions regarding this.


const testAccAwsSESDomainIdentityConfig = `
resource "aws_ses_domain_identity" "test" {
domain = "example.com"
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind randomizing this domain, so that we can safely run this test multiple times in parallel?
Have a look at how we do it in other tests, e.g. here

I think for the purpose of this test it doesn't matter if we're ever going to be able to finish the verification process (i.e. own the domain or manage DNS for it), so I'd go for something like %d.terraformtesting.com.

}

verificationAttrs := response.VerificationAttributes[domainName]
if verificationAttrs == nil {
Copy link
Member

Choose a reason for hiding this comment

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

I think more idiomatic way to check the existence of a key in a map would be something like

verificationAttrs, ok := response.VerificationAttributes[domainName]
if !ok {


# aws\_ses\_domain_identity

Provides an SES domain identity resource
Copy link
Member

Choose a reason for hiding this comment

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

Would you mind attaching some links and/or details about what steps are expected from the user to actually finish the verification of the domain? What do you think about adding a Route53 DNS record to the example + mentioning the WHOIS records need to point to the zone, or eventually delegate to it? It may sound like an obvious thing, but I think it's good to explain to what extent do we automate this process and help the user along the way.

http://docs.aws.amazon.com/ses/latest/DeveloperGuide/dns-txt-records.html

will signal to SES that the owner of the domain has authorised SES to act on
their behalf. The domain identity will be in state "verification pending"
until this is done. Find out more about verifying domains in Amazon SES in
the [AWS SES docs](http://docs.aws.amazon.com/ses/latest/DeveloperGuide/verify-domains.html).
Copy link
Member

Choose a reason for hiding this comment

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

Oh, I see, you have the explanation here actually, that's good 👍 but I still think we should include an example of a DNS record, like Route53 record.

@radeksimko radeksimko added new-resource provider/aws waiting-response An issue/pull request is waiting for a response from the community labels Mar 30, 2017
@dougneal dougneal force-pushed the enh-aws_ses_domain_identity branch from 9852daf to 43dc3d4 Compare March 30, 2017 13:17
@dougneal
Copy link
Contributor Author

Thanks for the feedback @radeksimko, I've addressed all points. I reordered the documentation slightly to put the example at the end including a Route 53 resource to add the verification token.

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

Thanks for the updates and sorry I missed the two things in the last review. I hope it's understandable & not too difficult to fix 🙈

Let me know if you want me to do it instead, post-merge.

_, ok := err.(awserr.Error)
if !ok {
return err
}
Copy link
Member

Choose a reason for hiding this comment

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

Probably a nitpick, but these 4 line of code are redundant since we always return from any error above (which is the right thing to do btw. as there's nothing like NotFound error in SES API). Would you mind removing these - just to avoid confusions?

Copy link
Contributor Author

@dougneal dougneal Mar 31, 2017

Choose a reason for hiding this comment

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

Sure. I actually lifted most of the code from here so there is probably some further cleanup to be done across the SES code...

Copy link
Member

Choose a reason for hiding this comment

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

Good catch, I think that is slightly different situation as you may get errors, but we should be scoping it down to specific error code(s): http://docs.aws.amazon.com/ses/latest/APIReference/API_DescribeReceiptRule.html#API_DescribeReceiptRule_Errors

return nil
}

d.Set("verification_token", *verificationAttrs.VerificationToken)
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure why I didn't notice this one before 🙀 , but we tend to avoid pointer dereferencing in Set() - the function has a built-in functionality to do this safely for all primitive data types and we have been bitten many times in the past by doing this in the resource code.

The API (for any weird reason) may not return the token here, in which case we'd be dereferencing pointer to nil which would in turn cause crash.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Cool, so should I just pass the pointer in?

@dougneal dougneal force-pushed the enh-aws_ses_domain_identity branch from 43dc3d4 to de30c25 Compare March 31, 2017 11:50
Provide a resource to manage domain identities in SES. Exports the
verification_code attribute which can be used to add the TXT record to
the domain to complete the domain verification.
Provide documentation for the new resource type.
@dougneal dougneal force-pushed the enh-aws_ses_domain_identity branch from de30c25 to 68f9884 Compare March 31, 2017 11:51
@dougneal
Copy link
Contributor Author

All done!

@radeksimko radeksimko removed the waiting-response An issue/pull request is waiting for a response from the community label Apr 1, 2017
@ghost
Copy link

ghost commented Apr 14, 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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@ghost ghost locked and limited conversation to collaborators Apr 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants