unoverse 0.1.124 → 0.1.125

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.
@@ -49,7 +49,7 @@ cmd_destroy() {
49
49
  local tmp planfile rc
50
50
  tmp=$(mktemp -d); planfile="$tmp/plan"
51
51
 
52
- # APPLY THE CONFIGURATION FIRST, because destroy does not.
52
+ # APPLY THE CONFIGURATION TO THE DATABASE FIRST, because destroy does not.
53
53
  #
54
54
  # `terraform destroy` deletes a resource as the last apply left it, so an attribute that
55
55
  # matters only AT DELETE — RDS's `skip_final_snapshot` — comes from STATE, not from
@@ -57,10 +57,23 @@ cmd_destroy() {
57
57
  # already applied. Applying the config to the database writes those settings into state
58
58
  # and calls no API; the resource is deleted seconds later, so nothing else here matters.
59
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
60
+ # ONLY IF IT IS ALREADY IN STATE. Without that test this is not an update, it is a CREATE:
61
+ # `apply -target` on a resource the configuration declares and the state does not have
62
+ # builds it. So a teardown of a universe whose database had already gone — deleted by
63
+ # hand, or removed from state — silently provisioned a NEW one, with -auto-approve, on the
64
+ # way to being told to destroy everything. In state means the only possible change is to
65
+ # the resource's own attributes.
66
+ #
67
+ # ANNOUNCED, because it runs before the first progress line and terraform can sit on an
68
+ # RDS refresh for a while. Sending it to a log with nothing on screen made `unoverse
69
+ # destroy` look frozen at the banner.
70
+ if [ "$cloud" = "aws" ] \
71
+ && terraform -chdir="$dir" state list 2>/dev/null | grep -qx "aws_db_instance.postgres"; then
72
+ info "Checking the database's delete settings..."
73
+ terraform -chdir="$dir" apply -input=false -auto-approve \
74
+ -target=aws_db_instance.postgres >"$tmp/sync.log" 2>&1 \
75
+ || warn "could not update them; the teardown may stop on the database"
76
+ fi
64
77
 
65
78
  info "Working out what exists..."
66
79
  terraform -chdir="$dir" plan -destroy -input=false -detailed-exitcode -out="$planfile" >"$tmp/log" 2>&1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "unoverse",
3
- "version": "0.1.124",
3
+ "version": "0.1.125",
4
4
  "description": "The Unoverse front door — create a Studio project, a universe, or a client app, and launch Studio.",
5
5
  "license": "SEE LICENSE IN README.md",
6
6
  "type": "module",