belt 0.3.30 → 0.3.31
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 +12 -0
- data/lib/belt/cli/destroy_command.rb +17 -0
- 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: b3545e62c7890adc16931218212e284d8e68994814be13ae0e231d5aee89b2ec
|
|
4
|
+
data.tar.gz: 89b19c24b919d441bffbbb8cd426697e656b8726596c24c58cf5f03d79233c81
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7df1d7c18c7208d54cb0e37cbea0cf6c998f9b502950651c7e3e304f2786c3a750d664894d5f7f09cbc8848b550f365d7ebe415a5bcb701da45ef115fb7d28bb
|
|
7
|
+
data.tar.gz: '05380ceae6d72a8874e66f52f616b527baa69f7101513842a6240765d2b1b6644bcd7b6d469acffeab246d18a152eabfb618a52c74753f5e61fd8cbbb663143a'
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.3.31
|
|
4
|
+
|
|
5
|
+
### Bug Fix
|
|
6
|
+
|
|
7
|
+
- **`belt destroy environment` now uses the environment's AWS profile**: The
|
|
8
|
+
terraform destroy path (and remote-state detection) previously inherited
|
|
9
|
+
whatever `AWS_PROFILE` was in the shell, which could point at the wrong
|
|
10
|
+
account and fail with "No valid credential sources found". It now loads
|
|
11
|
+
`infrastructure/<env>/belt.rb` and applies the configured `aws_profile` and
|
|
12
|
+
env vars before running terraform — matching `belt deploy` and
|
|
13
|
+
`belt terraform`.
|
|
14
|
+
|
|
3
15
|
## 0.3.16
|
|
4
16
|
|
|
5
17
|
### Enhancement
|
|
@@ -6,6 +6,7 @@ require_relative 'auth_command'
|
|
|
6
6
|
require_relative 'frontend_registry'
|
|
7
7
|
require_relative 'generator_registry'
|
|
8
8
|
require_relative 'tables_command'
|
|
9
|
+
require_relative 'environment_config'
|
|
9
10
|
require_relative '../inflector'
|
|
10
11
|
|
|
11
12
|
module Belt
|
|
@@ -214,6 +215,13 @@ module Belt
|
|
|
214
215
|
end
|
|
215
216
|
end
|
|
216
217
|
|
|
218
|
+
# Apply the environment's AWS profile + env vars from infrastructure/<env>/belt.rb
|
|
219
|
+
# BEFORE any terraform/aws calls, so both remote-state detection and the
|
|
220
|
+
# subsequent destroy authenticate against the correct account. Without this,
|
|
221
|
+
# terraform inherits whatever AWS_PROFILE is in the shell, which may point at
|
|
222
|
+
# the wrong account (mirrors `belt deploy` / `belt terraform`).
|
|
223
|
+
apply_env_config! unless @skip_terraform
|
|
224
|
+
|
|
217
225
|
# Check if terraform state exists (infra may still be live)
|
|
218
226
|
if !@skip_terraform && terraform_state_exists?(dir)
|
|
219
227
|
puts "⚠ Environment '#{@name}' appears to have active infrastructure."
|
|
@@ -380,6 +388,15 @@ module Belt
|
|
|
380
388
|
puts ' ✓ Infrastructure destroyed.'
|
|
381
389
|
end
|
|
382
390
|
|
|
391
|
+
# Load infrastructure/<env>/belt.rb and apply its aws_profile + env vars to
|
|
392
|
+
# the current process so terraform (and any aws CLI calls during destroy)
|
|
393
|
+
# authenticate against the right account. Mirrors DeployCommand / TerraformCommand.
|
|
394
|
+
def apply_env_config!
|
|
395
|
+
env_config = EnvironmentConfig.load(@name)
|
|
396
|
+
env_config.apply!
|
|
397
|
+
puts " 🔑 Using AWS profile: #{env_config.aws_profile}" if env_config.aws_profile?
|
|
398
|
+
end
|
|
399
|
+
|
|
383
400
|
def empty_s3_buckets_in_state
|
|
384
401
|
output = `terraform state list 2>/dev/null`
|
|
385
402
|
return unless Process.last_status.success?
|
data/lib/belt/version.rb
CHANGED