belt 0.4.0 → 0.4.2

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: 5a04110a957fa2d24cbca0245df1aa6aa421547ac140467cb5e6a15e9d0e1fb1
4
- data.tar.gz: 17ffdd470fe0dd613ac82cd0554c12146fb527ee1a6ccd179f3de4b3e3024eab
3
+ metadata.gz: e17e0755e497e26d8bd10604e6f050b0c6e0b69e3627276f8d83be984862d5da
4
+ data.tar.gz: b4249c4ac11715ae45a091c3eced0d0bad8ecd5d89a750edfaa8586ab6449758
5
5
  SHA512:
6
- metadata.gz: 540c4da110ef61d412c09af5ce4db33bd534ec460d636ac2988e9784cb0fc58ac54e6cd9eeb201b48f863832d7d936ae5677bbcb78d37e702f04915e234ee230
7
- data.tar.gz: ecc50065fcff0b93904c89cbc8c0e3c1a0c45e8f54c7c12af80d9546d894ed12b0a9f8103f8ca5eae3623c1cbd0e38d703137acf86e242ca9fe05946734ac28f
6
+ metadata.gz: abe5b18f7eeeb92bba2863746e7cc71d854078462274993403c4d7b93af81ff2c82a3b5c1db2fbdf537f8a139ec15964d76aad042505ade12ad64e6069f40a5a
7
+ data.tar.gz: dba1d0cca64620fc48b495ee844600e7a8e38c577ad3f27ada191263038f38a081a3d640f9a66e00fd97c138e1686ae91654d6995225d357bec8a5016e903f5e
data/CHANGELOG.md CHANGED
@@ -1,5 +1,70 @@
1
1
  # Changelog
2
2
 
3
+ ## Unreleased
4
+
5
+ ### Bug Fix
6
+
7
+ - **`belt setup tables` no longer silently clobbers hand-added tables/GSIs.**
8
+ Regenerating `dynamodb.tf` is a full overwrite from `lambda/models/*.rb`, so a
9
+ table or `global_secondary_index` added straight into the `.tf` file — one the
10
+ models don't declare — used to vanish on the next run. Dropping a live GSI is
11
+ not harmless: queries against it start failing. The generator now diffs the
12
+ existing file and, when the regen would remove infrastructure it can't
13
+ re-derive, it warns and lists exactly what would disappear. An interactive run
14
+ prompts before overwriting; a generator auto-sync refuses and leaves the file
15
+ untouched. Pass `--force` (`-f`/`--yes`/`-y`) to overwrite anyway. The
16
+ `dynamodb.tf` header comment now spells out this behavior too. (Fixes the
17
+ misleading "harmless diff" framing in the 0.4.0 notes below.)
18
+
19
+ - **Apply environment AWS profile in `belt deploy frontend`, `belt frontend env`, `belt logs`, and `belt server`**:
20
+ Standalone frontend deployment (`belt deploy frontend <env>`), frontend env generation (`belt frontend env <env>`),
21
+ log viewing (`belt logs`), and the local dev server (`belt server`) now load `infrastructure/<env>/belt.rb`
22
+ and apply its configured `aws_profile` and environment variables. Previously, running `belt deploy frontend <env>`
23
+ directly would query Terraform outputs without the environment's AWS profile, causing a 403 against remote S3
24
+ state backends and aborting with `Error: Could not determine S3 bucket. Run belt apply <env> first.`
25
+
26
+ ## 0.4.1
27
+
28
+ ### Feature
29
+
30
+ - **`belt dns doctor`**: New diagnostic command that checks DNS health across all
31
+ environments. Shows zone status, NS delegation, ACM certificate state, and
32
+ API Gateway custom domain configuration. Use `--env prod` to check a specific
33
+ environment only.
34
+
35
+ ```bash
36
+ belt dns doctor
37
+ belt dns doctor --env prod
38
+ ```
39
+
40
+ - **`belt dns sync-validation`**: New command to sync ACM validation CNAMEs from
41
+ an environment's zone to the root zone. Needed for apex domains (e.g., prod →
42
+ `example.com`) where the root zone is authoritative for the apex domain.
43
+
44
+ ```bash
45
+ belt dns sync-validation prod
46
+ ```
47
+
48
+ - **Auto-sync ACM validation for apex environments**: `belt deploy prod` now
49
+ automatically syncs ACM validation CNAMEs to the root zone when deploying
50
+ environments that use the apex domain. No manual intervention needed — the
51
+ "prod is special" logic is handled by Belt internally.
52
+
53
+ This fixes the issue where prod ACM certificates would timeout waiting for
54
+ validation because the validation CNAMEs were created in the prod zone, but
55
+ ACM validates against the authoritative zone (the root zone managed by
56
+ `infrastructure/dns`).
57
+
58
+ ### Bug Fix
59
+
60
+ - **Fix misleading nested environment domain announcement**: `belt generate
61
+ environment <name> <parent>` printed `Domain will be:
62
+ api.<env>.<parent>.<domain>`, but the deployed infrastructure actually uses
63
+ the single-level `api-<env>.<parent>.<domain>` form (the `api-` prefix keeps
64
+ the host under the parent's `*.<parent>.<domain>` wildcard cert). The message
65
+ now matches the real deployed domain. Infrastructure was already correct —
66
+ only the CLI output was wrong.
67
+
3
68
  ## 0.4.0
4
69
 
5
70
  ### New Features
@@ -14,6 +14,7 @@ require_relative 'zip_artifact_builder'
14
14
  require_relative 'nested_environment'
15
15
  require_relative 'cognito_sharer'
16
16
  require_relative 'dynamo_copier'
17
+ require_relative 'dns_command'
17
18
  require_relative 'apex_dns_sync'
18
19
 
19
20
  module Belt
@@ -177,6 +178,11 @@ module Belt
177
178
  # Sync apex DNS records to root zone (if this is a prod/apex environment)
178
179
  run_apex_dns_sync
179
180
 
181
+ # Sync ACM validation CNAMEs for apex domains (e.g., prod)
182
+ # This handles the case where prod uses the apex domain (example.com)
183
+ # and needs validation CNAMEs in the root zone, not the env's zone.
184
+ sync_acm_validation_if_apex
185
+
180
186
  puts "\n✅ Deployed #{@env} successfully!"
181
187
  print_outputs(env_dir)
182
188
 
@@ -299,6 +305,27 @@ module Belt
299
305
  end
300
306
  end
301
307
 
308
+ # ─── ACM Validation Sync ────────────────────────────────────────
309
+
310
+ # For apex environments (prod), ACM validation CNAMEs need to be in the
311
+ # root zone (managed by infrastructure/dns), not the environment's zone.
312
+ # This is because the registrar points to the root zone, which is
313
+ # authoritative for the apex domain.
314
+ def sync_acm_validation_if_apex
315
+ # Only sync if DNS infrastructure exists
316
+ return unless Dir.exist?(File.join(@infra_dir, '..', 'infrastructure', 'dns')) ||
317
+ Dir.exist?('infrastructure/dns')
318
+
319
+ # Check if this is an apex environment
320
+ return unless apex_environment?
321
+
322
+ DnsCommand.sync_acm_validation_if_needed(@env)
323
+ end
324
+
325
+ def apex_environment?
326
+ %w[prod production].include?(@env)
327
+ end
328
+
302
329
  # ─── Backup Phase ───────────────────────────────────────────────
303
330
 
304
331
  def run_backups