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: 57f12b22980eee716c98dcd00612c63b7b72a964cb3fef007fc0c1e594893cef
4
- data.tar.gz: 81c05386abb62cfd11aceb9c68fb089dc81e5aa870904cfad5f27920d7bf6590
3
+ metadata.gz: 66741e509a64ee8df126ea2f5ddefc6b84c6ad544dcb5528be839c6f2a31556f
4
+ data.tar.gz: d7d4e424fed7aca6be6c7917fb8fa9de87e92fd6b6b0f69b839ba73b3056966d
5
5
  SHA512:
6
- metadata.gz: add692f4eed8cf815613228ed61aa4e9905c9be7bf07289e7f31e736ae943fae216749938282f766bb39a848f4ea7aab5f6e0bfa8e7e2bf85a02c600b68f8910
7
- data.tar.gz: b016a16412ad2bfad897cddd6dd3a765e1a2a0a4760bd1229d960843021331e6964d5512236c09679a0a2ed396a3e6ab8f29e07bc035793b380ba6d1abd9ba96
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
- # and the email_send policy is skipped (count gated on this being non-empty).
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 = var.enable_email && local.email_identity_arn != "" ? 1 : 0
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 = var.enable_email && local.email_identity_arn != "" ? 1 : 0
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 = var.enable_email && local.email_identity_arn != "" ? aws_iam_policy.email_send[0].arn : ""
44
+ value = local.email_identity_enabled ? aws_iam_policy.email_send[0].arn : ""
45
45
  }
46
46
 
47
47
  output "email_domain_dkim_tokens" {
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Belt
4
4
  module Messaging
5
- VERSION = '0.1.0'
5
+ VERSION = '0.1.1'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: belt-messaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stowzilla