Conversation
10cf22b to
42f2cab
Compare
templates/scripts/pre-env.sh
Outdated
There was a problem hiding this comment.
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.
templates/scripts/pre-env.sh
Outdated
There was a problem hiding this comment.
All this stuff is quite vulnerable to them making changes to their API, but it seems like it's the only option.. :feelsbadman:
There was a problem hiding this comment.
Yeah hopefully they won't make breaking changes on their /v3 api, then we would have the option to manually upgrade it 🤞
There was a problem hiding this comment.
This should be templated rather than a var?
There was a problem hiding this comment.
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"}There was a problem hiding this comment.
Oh yeah, I must have missed that. Hm, not sure how I feel about this.. I'll think a bit more about it.
There was a problem hiding this comment.
Yeah, actually this would make the tf totally unusable.
There was a problem hiding this comment.
with the variables and default values in the stage/prod, they will just go to the default (enabled:false) and empty values
|
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. |
There was a problem hiding this comment.
should be "sendgrid_cnames"
bcfa649 to
de15e2c
Compare
2a90088 to
af652d7
Compare
af652d7 to
fc37a51
Compare
| count = var.sendgrid_enabled ? 1 : 0 | ||
|
|
||
| zone_name = var.domain_name | ||
| sendgrid_api_key_secret_name = var.sendgrid_api_key_secret_name |
There was a problem hiding this comment.
almost all the logic has been moved to commitdev/terraform-aws-zero@bd194a0 with the external-datasource 🎉
|
|
||
| module "sendgrid_api_key" { | ||
| source = "../../modules/secret" | ||
| name = "${local.project}-sendgrid-<% index .Params `randomSeed` %>" |
There was a problem hiding this comment.
This assumes the same api key will be shared for both staging / production, which I think is probably fine for now.
| - "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. |
There was a problem hiding this comment.
How about a note here that they can leave this blank to not set up sendgrid?
* sendgrid integration * reimpl with external datasource * docs: message for optional sendgird api key
Order of things that happens
zero applyit will runscripts/init(in the project_dir) with parameters [sendgridApiKey] along with other envscripts/init.shresults 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.jsoncontains the sendgrid-api-key; and gets.gitignoredso it will not be commitedsendgrid.auto.tfvars.jsonwill contain the sendgrid_domain_id(unique identifier from sendgrid) / CNAMEs we need for verification, andsend_enabled:true(to override default sendgrid is off)make apply-envit will already have the variables in the root, then it will create route53, then call API to complete the verificationassumes commitdev/terraform-aws-zero#1 to be released as
0.0.2