belt-messaging 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 66741e509a64ee8df126ea2f5ddefc6b84c6ad544dcb5528be839c6f2a31556f
|
|
4
|
+
data.tar.gz: d7d4e424fed7aca6be6c7917fb8fa9de87e92fd6b6b0f69b839ba73b3056966d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cdca528c94667c4fd4dfb4071c3aa5a132dc016d39c668c9d1daa328cbf1290cecada794620dab4940632d8522a699e9eebb8653089eb107f79b67c208630577
|
|
7
|
+
data.tar.gz: 6d2f2ba6f8cf82c88c669508910e9b22cbe7f21c4753036c2df13ee11f658294be1f3170e3add197e0a0af4625e50113d287581b1a09f19828c00881bf52e022
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.1.1
|
|
4
|
+
|
|
5
|
+
- Fix Terraform `email_send` IAM policy failing to apply on a fresh deploy: its `count` was gated on the SES identity ARN, a computed attribute unknown until apply, which raised `Invalid count argument`. Gate the policy document, policy resource, and `email_send_policy_arn` output on a plan-time-known local derived from input variables instead. Without this, the Lambda role never received `ses:SendEmail` and outbound transactional email silently never sent.
|
|
6
|
+
|
|
3
7
|
## 0.1.0
|
|
4
8
|
|
|
5
9
|
- Add `Belt::Messaging.send_email(to:, subject:, body:, html:)` — send email via AWS SESv2
|
|
@@ -25,9 +25,16 @@ locals {
|
|
|
25
25
|
ManagedBy = "Terraform"
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
+
# Whether an email identity will be created — known entirely from input vars at
|
|
29
|
+
# plan time. Gate the email_send policy's count on THIS, not on the resulting ARN:
|
|
30
|
+
# the ARN is a computed attribute of the SES identity and isn't known until apply,
|
|
31
|
+
# so using it in a count throws "Invalid count argument".
|
|
32
|
+
email_identity_enabled = var.enable_email && (var.email_domain != "" || var.email_from_address != "")
|
|
33
|
+
|
|
28
34
|
# Safe three-way resolution: domain takes precedence, then address, then empty.
|
|
29
35
|
# If enable_email is true but neither identity var is set, this resolves to ""
|
|
30
|
-
#
|
|
36
|
+
# (email_identity_enabled is false, so nothing references it). Used only inside
|
|
37
|
+
# resource bodies, where an unknown-until-apply value is fine.
|
|
31
38
|
email_identity_arn = var.enable_email ? (
|
|
32
39
|
var.email_domain != "" ? aws_sesv2_email_identity.domain[0].arn : (
|
|
33
40
|
var.email_from_address != "" ? aws_sesv2_email_identity.address[0].arn : ""
|
|
@@ -243,7 +250,7 @@ check "email_identity_configured" {
|
|
|
243
250
|
}
|
|
244
251
|
|
|
245
252
|
data "aws_iam_policy_document" "email_send" {
|
|
246
|
-
count =
|
|
253
|
+
count = local.email_identity_enabled ? 1 : 0
|
|
247
254
|
|
|
248
255
|
statement {
|
|
249
256
|
effect = "Allow"
|
|
@@ -256,7 +263,7 @@ data "aws_iam_policy_document" "email_send" {
|
|
|
256
263
|
}
|
|
257
264
|
|
|
258
265
|
resource "aws_iam_policy" "email_send" {
|
|
259
|
-
count =
|
|
266
|
+
count = local.email_identity_enabled ? 1 : 0
|
|
260
267
|
|
|
261
268
|
name = "${var.app_name}-${var.environment}-email-send"
|
|
262
269
|
description = "Allow Lambda to send email via SESv2"
|
|
@@ -41,7 +41,7 @@ output "email_identity_verification_status" {
|
|
|
41
41
|
|
|
42
42
|
output "email_send_policy_arn" {
|
|
43
43
|
description = "ARN of IAM policy granting ses:SendEmail"
|
|
44
|
-
value =
|
|
44
|
+
value = local.email_identity_enabled ? aws_iam_policy.email_send[0].arn : ""
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
output "email_domain_dkim_tokens" {
|