unoverse 0.1.60 → 0.1.62
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/deploy.sh +27 -9
- package/package.json +1 -1
package/operator/lib/deploy.sh
CHANGED
|
@@ -18,6 +18,28 @@ cmd_deploy() {
|
|
|
18
18
|
done
|
|
19
19
|
fi
|
|
20
20
|
|
|
21
|
+
# INFRA CHANGES SHIP TOO. If the ground has pending changes (edited tfvars, a new
|
|
22
|
+
# resource in main.tf from an update), deploy applies them first — through
|
|
23
|
+
# terraform's own plan-and-yes gate — then re-renders the env, since outputs may
|
|
24
|
+
# have changed. Without this, deploy only ever shipped images once a server
|
|
25
|
+
# existed, and infrastructure edits silently rotted.
|
|
26
|
+
local g_applied
|
|
27
|
+
if command -v terraform >/dev/null 2>&1; then
|
|
28
|
+
local g rc
|
|
29
|
+
for g in digitalocean aws; do
|
|
30
|
+
[ -d "$ROOT/infra/$g/.terraform" ] || continue
|
|
31
|
+
terraform -chdir="$ROOT/infra/$g" plan -input=false -detailed-exitcode >/dev/null 2>&1
|
|
32
|
+
rc=$?
|
|
33
|
+
if [ "$rc" = "2" ]; then
|
|
34
|
+
info "Your $g infrastructure has pending changes"
|
|
35
|
+
terraform -chdir="$ROOT/infra/$g" apply || { fail "apply did not complete. Re-run: unoverse deploy"; exit 1; }
|
|
36
|
+
terraform -chdir="$ROOT/infra/$g" output -raw env_production > "$env_prod" 2>/dev/null && ok "Refreshed .env.production from the ground"
|
|
37
|
+
g_applied=1
|
|
38
|
+
fi
|
|
39
|
+
break
|
|
40
|
+
done
|
|
41
|
+
fi
|
|
42
|
+
|
|
21
43
|
# Missing .env.production is not an error if a ground has been applied — the
|
|
22
44
|
# file is just a Terraform output, so render it ourselves. Reading state is
|
|
23
45
|
# not wrapping terraform: apply stays the developer's explicit act.
|
|
@@ -109,16 +131,12 @@ cmd_deploy() {
|
|
|
109
131
|
fi
|
|
110
132
|
ok "terraform.tfvars is complete"
|
|
111
133
|
|
|
112
|
-
#
|
|
113
|
-
# for
|
|
114
|
-
#
|
|
134
|
+
# STRAIGHT INTO TERRAFORM. Its plan plus its own typed "yes" IS the decision gate
|
|
135
|
+
# for billable infrastructure; a [Y/n] in front of it was asking permission to ask
|
|
136
|
+
# permission. Answering "no" is terraform's "no".
|
|
137
|
+
echo ""
|
|
138
|
+
info "Provisioning. Terraform shows the plan and asks for your ${BOLD}yes${NC} before creating anything"
|
|
115
139
|
echo ""
|
|
116
|
-
local REPLY
|
|
117
|
-
read -r -p " Provision now? terraform runs here and shows its plan first. [Y/n] " REPLY
|
|
118
|
-
if [[ "$REPLY" =~ ^[Nn]$ ]]; then
|
|
119
|
-
info "When ready: cd infra/$cloud && terraform init && terraform apply && cd ../.. && unoverse deploy"
|
|
120
|
-
exit 0
|
|
121
|
-
fi
|
|
122
140
|
# Terraform is one static binary: install it directly from the official release
|
|
123
141
|
# rather than sending anyone to brew (whose compile chain can demand Xcode Command
|
|
124
142
|
# Line Tools updates for a tool that needs no compiling).
|
package/package.json
CHANGED