belt 0.6.8 → 0.6.9
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 +4 -4
- data/CHANGELOG.md +17 -0
- data/lib/belt/cli/deploy_command.rb +17 -4
- data/lib/belt/cli/destroy_command.rb +3 -2
- data/lib/belt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d7f8eec96efe780f5d58b8242c0f2c4a8d6dc0e46f53e4484d1b10072ab059aa
|
|
4
|
+
data.tar.gz: a065c3fbd7b2a5ada177a4b516a07314408988c53e498e302e88b0903c01029c
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 3aca3754425f363160d92b60b9385a8b3efaada2a4182e059361acf42e6763001ee9f53834386705e5b638a54c32e2608025f154a284e3280053de096558f99e
|
|
7
|
+
data.tar.gz: 4c314ee70436b6fd009493051349e83e2986956d0e42f7cf22d3a55461ad7f05024aecc7901428da8873fba8d1e0c5c03bf6559763a098c4822b3dadec105945
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.6.9
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- **`belt deploy` no longer hangs forever on an interactive terraform prompt.**
|
|
8
|
+
`run_terraform_plan` shelled out to `terraform plan` via `Open3.popen3` with
|
|
9
|
+
no `-input=false` and left the child's stdin open. If terraform ever hit a
|
|
10
|
+
prompt (a missing variable, a backend/provider confirmation), it blocked on
|
|
11
|
+
`read()` from a pipe nobody was feeding — an unattended `belt deploy --auto`
|
|
12
|
+
could sit at 0% CPU indefinitely (observed: ~8 hours). The plan now runs with
|
|
13
|
+
`-input=false`, sets `TF_IN_AUTOMATION=1`, and closes the child's stdin so
|
|
14
|
+
terraform gets EOF instead of blocking. `terraform init`, the ACM-bootstrap
|
|
15
|
+
`terraform apply`, the final `terraform apply`, and the automated
|
|
16
|
+
`terraform destroy` all gained `-input=false` for the same reason. The
|
|
17
|
+
manual `belt init/plan/apply` subcommands (`terraform_command.rb`) stay
|
|
18
|
+
interactive — they inherit a real TTY on purpose.
|
|
19
|
+
|
|
3
20
|
## 0.6.8
|
|
4
21
|
|
|
5
22
|
### Added
|
|
@@ -772,7 +772,9 @@ module Belt
|
|
|
772
772
|
|
|
773
773
|
def run_init
|
|
774
774
|
puts '━━━ terraform init ━━━'
|
|
775
|
-
|
|
775
|
+
# -input=false: never block on an interactive prompt. In an automated
|
|
776
|
+
# deploy there is nobody at the keyboard, so a prompt would hang forever.
|
|
777
|
+
success = system('terraform', 'init', '-input=false')
|
|
776
778
|
abort "\n✗ terraform init failed" unless success
|
|
777
779
|
puts ''
|
|
778
780
|
end
|
|
@@ -794,7 +796,17 @@ module Belt
|
|
|
794
796
|
require 'open3'
|
|
795
797
|
stderr_buffer = +''
|
|
796
798
|
|
|
797
|
-
|
|
799
|
+
# -input=false makes terraform fail fast on any missing input instead of
|
|
800
|
+
# prompting. TF_IN_AUTOMATION trims interactive hints from the output.
|
|
801
|
+
# We also close stdin immediately below so that even if terraform tried
|
|
802
|
+
# to read from it, it gets EOF rather than blocking forever — this is
|
|
803
|
+
# what caused `belt deploy` to hang indefinitely on an unanswered prompt.
|
|
804
|
+
tf_env = { 'TF_IN_AUTOMATION' => '1' }
|
|
805
|
+
tf_cmd = ['terraform', 'plan', '-input=false', '-out=tfplan', *@extra_args]
|
|
806
|
+
|
|
807
|
+
Open3.popen3(tf_env, *tf_cmd) do |stdin, stdout, stderr, wait_thr|
|
|
808
|
+
stdin.close
|
|
809
|
+
|
|
798
810
|
stdout_thread = Thread.new do
|
|
799
811
|
while (line = stdout.gets)
|
|
800
812
|
print line
|
|
@@ -838,7 +850,8 @@ module Belt
|
|
|
838
850
|
puts ''
|
|
839
851
|
|
|
840
852
|
# Phase 1: Create the certificate only
|
|
841
|
-
success = system('terraform', 'apply', '-
|
|
853
|
+
success = system('terraform', 'apply', '-input=false',
|
|
854
|
+
'-target=module.app.aws_acm_certificate.app', '-auto-approve')
|
|
842
855
|
unless success
|
|
843
856
|
puts ''
|
|
844
857
|
puts ' ✗ Certificate creation failed.'
|
|
@@ -881,7 +894,7 @@ module Belt
|
|
|
881
894
|
|
|
882
895
|
def run_apply
|
|
883
896
|
puts '━━━ terraform apply ━━━'
|
|
884
|
-
success = system('terraform', 'apply', 'tfplan')
|
|
897
|
+
success = system('terraform', 'apply', '-input=false', 'tfplan')
|
|
885
898
|
cleanup_plan
|
|
886
899
|
abort "\n✗ terraform apply failed" unless success
|
|
887
900
|
end
|
|
@@ -401,8 +401,9 @@ module Belt
|
|
|
401
401
|
# Empty S3 buckets before destroy — terraform can't delete non-empty buckets
|
|
402
402
|
empty_s3_buckets_in_state
|
|
403
403
|
|
|
404
|
-
# Run destroy with auto-approve (user already confirmed)
|
|
405
|
-
|
|
404
|
+
# Run destroy with auto-approve (user already confirmed). -input=false
|
|
405
|
+
# keeps it from blocking on an interactive prompt in an automated run.
|
|
406
|
+
unless system('terraform', 'destroy', '-input=false', '-auto-approve')
|
|
406
407
|
puts "\n✗ terraform destroy failed."
|
|
407
408
|
puts ' Infrastructure may still be running. Fix and retry, or use --skip-terraform.'
|
|
408
409
|
exit 1
|
data/lib/belt/version.rb
CHANGED