unoverse 0.1.122 → 0.1.124
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.
- package/operator/infra/aws/main.tf +22 -2
- package/operator/lib/destroy.sh +14 -0
- package/package.json +1 -1
|
@@ -318,8 +318,28 @@ resource "aws_db_instance" "postgres" {
|
|
|
318
318
|
|
|
319
319
|
backup_retention_period = 7
|
|
320
320
|
backup_window = "03:00-04:00"
|
|
321
|
-
|
|
322
|
-
|
|
321
|
+
# NO FINAL SNAPSHOT, which is what `unoverse destroy` already promises: "this deletes data
|
|
322
|
+
# that no backup here can restore" (destroy.sh). The code said otherwise, and the two
|
|
323
|
+
# disagreed silently.
|
|
324
|
+
#
|
|
325
|
+
# A FIXED snapshot name cannot survive a SECOND teardown. `<name>-pg-final` derives only
|
|
326
|
+
# from the universe name, so teardown one creates it, it persists for ever, and teardown
|
|
327
|
+
# two is rejected by AWS before the delete even starts:
|
|
328
|
+
#
|
|
329
|
+
# Cannot create the snapshot because a snapshot with the identifier
|
|
330
|
+
# unoversedevtest-pg-final already exists
|
|
331
|
+
#
|
|
332
|
+
# The instance then sits at `available`, never `deleting`, and everything behind it
|
|
333
|
+
# strands: the data SG holds its network interface, the app SG is referenced by data's
|
|
334
|
+
# rules, the alb SG by app's. One rejected call, five resources left billing, and a
|
|
335
|
+
# teardown that reports it did not finish without saying why. Found 2026-08-05, blocked by
|
|
336
|
+
# a snapshot a teardown three days earlier had left behind.
|
|
337
|
+
#
|
|
338
|
+
# Making the name unique would need a new resource (a random suffix), and `terraform
|
|
339
|
+
# destroy` cannot create one on its way past. A one-command teardown means no snapshot.
|
|
340
|
+
# Automated backups (7 days, above) live and die with the instance: take a MANUAL snapshot
|
|
341
|
+
# before destroying if you want to keep anything.
|
|
342
|
+
skip_final_snapshot = true
|
|
323
343
|
# POC: no deletion_protection so teardown stays one command. Turn it on at graduation.
|
|
324
344
|
}
|
|
325
345
|
|
package/operator/lib/destroy.sh
CHANGED
|
@@ -48,6 +48,20 @@ cmd_destroy() {
|
|
|
48
48
|
|
|
49
49
|
local tmp planfile rc
|
|
50
50
|
tmp=$(mktemp -d); planfile="$tmp/plan"
|
|
51
|
+
|
|
52
|
+
# APPLY THE CONFIGURATION FIRST, because destroy does not.
|
|
53
|
+
#
|
|
54
|
+
# `terraform destroy` deletes a resource as the last apply left it, so an attribute that
|
|
55
|
+
# matters only AT DELETE — RDS's `skip_final_snapshot` — comes from STATE, not from
|
|
56
|
+
# main.tf. Fixing main.tf therefore fixes the next universe and does nothing for one
|
|
57
|
+
# already applied. Applying the config to the database writes those settings into state
|
|
58
|
+
# and calls no API; the resource is deleted seconds later, so nothing else here matters.
|
|
59
|
+
#
|
|
60
|
+
# It is the standard terraform answer (apply, then destroy) rather than a special case,
|
|
61
|
+
# and it is best-effort: if it fails, the destroy below reports the real problem.
|
|
62
|
+
[ "$cloud" = "aws" ] && terraform -chdir="$dir" apply -input=false -auto-approve \
|
|
63
|
+
-target=aws_db_instance.postgres >"$tmp/sync.log" 2>&1
|
|
64
|
+
|
|
51
65
|
info "Working out what exists..."
|
|
52
66
|
terraform -chdir="$dir" plan -destroy -input=false -detailed-exitcode -out="$planfile" >"$tmp/log" 2>&1
|
|
53
67
|
rc=$?
|
package/package.json
CHANGED