unoverse 0.1.123 → 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/lib/destroy.sh +14 -0
- package/package.json +1 -1
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