GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — sendgrid integration by davidcheung · Pull Request #79 · commitdev/zero-aws-eks-stack

Conversation

@davidcheung

@davidcheung davidcheung commented Sep 2, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Order of things that happens

  • while zero apply it will run scripts/init(in the project_dir) with parameters [sendgridApiKey] along with other env
  • running scripts/init.sh results in 2 files being create [sendgrid.auto.tfvars.json / sendgrid-secrets.auto.tfvars.json] in the environment's root (stage/prod)
  • sendgrid-secrets.auto.tfvars.json contains the sendgrid-api-key; and gets .gitignored so it will not be commited
  • sendgrid.auto.tfvars.json will contain the sendgrid_domain_id(unique identifier from sendgrid) / CNAMEs we need for verification, and send_enabled:true (to override default sendgrid is off)
  • when apply runs make apply-env it will already have the variables in the root, then it will create route53, then call API to complete the verification

assumes commitdev/terraform-aws-zero#1 to be released as 0.0.2

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@davidcheung
davidcheung requested a review from bmonkman September 2, 2020 00:47
bmonkman
bmonkman reviewed Sep 2, 2020
View reviewed changes
Comment thread Makefile Resolved

Uh oh!

There was an error while loading. Please reload this page.

@davidcheung
davidcheung force-pushed the sendgrid branch 2 times, most recently from 10cf22b to 42f2cab Compare September 2, 2020 23:00
bmonkman
bmonkman reviewed Sep 2, 2020
View reviewed changes
Comment thread templates/scripts/pre-env.sh Outdated

@bmonkman bmonkman Sep 2, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Maybe we should do something similar to what I did in post-apply, and source a script that is specific to sendgrid, then we can optionally include it. We may want to make this support optional via a parameter.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

davidcheung reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
bmonkman
bmonkman reviewed Sep 2, 2020
View reviewed changes
Comment thread templates/scripts/pre-env.sh Outdated

@bmonkman bmonkman Sep 2, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

All this stuff is quite vulnerable to them making changes to their API, but it seems like it's the only option.. :feelsbadman:

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@davidcheung davidcheung Sep 3, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yeah hopefully they won't make breaking changes on their /v3 api, then we would have the option to manually upgrade it 🤞

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
bmonkman
bmonkman reviewed Sep 2, 2020
View reviewed changes
Comment thread templates/terraform/environments/prod/main.tf Outdated

@bmonkman bmonkman Sep 2, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This should be templated rather than a var?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@davidcheung davidcheung Sep 2, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

I'm relying on the script to generate tfvars.json that will look something like

//terraform/environments/stage/sendgrid.auto.tfvars.json
{
  "sendgrid_enabled": true,
  "sendgrid_domain_id": 9104854,
  "sendgrid_cname": [
    [
      "em7596.email.get0.dev",
      "u18291290.wl041.sendgrid.net"
    ],
    [
      "s1._domainkey.email.get0.dev",
      "s1.domainkey.u18291290.wl041.sendgrid.net"
    ],
    [
      "s2._domainkey.email.get0.dev",
      "s2.domainkey.u18291290.wl041.sendgrid.net"
    ]
  ]
}

// terraform/environments/stage/sendgrid-secrets.auto.tfvars.json
{"sendgrid_apikey": "SG.blahblah-secret"}

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bmonkman bmonkman Sep 3, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Oh yeah, I must have missed that. Hm, not sure how I feel about this.. I'll think a bit more about it.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@bmonkman bmonkman Sep 3, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Yeah, actually this would make the tf totally unusable.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@davidcheung davidcheung Sep 3, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

with the variables and default values in the stage/prod, they will just go to the default (enabled:false) and empty values

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bmonkman

bmonkman commented Sep 3, 2020

Copy link
Copy Markdown
Contributor

Could use something in the readme about how to create a sendgrid account and an api key and have everything in the right state to start this process.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bmonkman
bmonkman reviewed Sep 3, 2020
View reviewed changes
Comment thread templates/terraform/environments/stage/variables.tf Outdated

@bmonkman bmonkman Sep 3, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

should be "sendgrid_cnames"

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

davidcheung reacted with thumbs up emoji
All reactions
  • 👍 1 reaction
@davidcheung
davidcheung force-pushed the sendgrid branch 4 times, most recently from bcfa649 to de15e2c Compare September 3, 2020 16:45
@davidcheung
sendgrid integration
1dac36b
@davidcheung
davidcheung force-pushed the sendgrid branch 2 times, most recently from 2a90088 to af652d7 Compare September 4, 2020 01:04
@davidcheung
reimpl with external datasource
fc37a51
@davidcheung
davidcheung force-pushed the sendgrid branch from af652d7 to fc37a51 Compare September 4, 2020 01:08
davidcheung
davidcheung commented Sep 4, 2020
View reviewed changes
Comment thread templates/terraform/modules/environment/main.tf
count = var.sendgrid_enabled ? 1 : 0

zone_name = var.domain_name
sendgrid_api_key_secret_name = var.sendgrid_api_key_secret_name

@davidcheung davidcheung Sep 4, 2020

Copy link
Copy Markdown
Contributor Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

almost all the logic has been moved to commitdev/terraform-aws-zero@bd194a0 with the external-datasource 🎉

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
bmonkman
bmonkman reviewed Sep 4, 2020
View reviewed changes
Comment thread templates/terraform/bootstrap/secrets/main.tf

module "sendgrid_api_key" {
source = "../../modules/secret"
name = "${local.project}-sendgrid-<% index .Params `randomSeed` %>"

@bmonkman bmonkman Sep 4, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

This assumes the same api key will be shared for both staging / production, which I think is probably fine for now.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
bmonkman
bmonkman reviewed Sep 4, 2020
View reviewed changes
Comment thread zero-module.yml
- "kibana"
- field: sendgridApiKey
label: API key to setup email integration
info: Signup at https://signup.sendgrid.com or create an API key from https://app.sendgrid.com/settings/api_keys. Sendgrid is an email delivery service enabling transactional email sending and more.

@bmonkman bmonkman Sep 4, 2020

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

How about a note here that they can leave this blank to not set up sendgrid?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@davidcheung
docs: message for optional sendgird api key
c40187a
bmonkman
bmonkman approved these changes Sep 4, 2020
View reviewed changes
@davidcheung
davidcheung merged commit 83d2633 into main Sep 4, 2020
@davidcheung
davidcheung deleted the sendgrid branch September 4, 2020 21:40
bmonkman pushed a commit that referenced this pull request Oct 10, 2020
@davidcheung
sendgrid integration (#79)
3864021
* sendgrid integration

* reimpl with external datasource

* docs: message for optional sendgird api key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

1 more reviewer
@bmonkman bmonkman bmonkman approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@davidcheung @bmonkman
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.