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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 79ffa332a2eb6408d42c4652d1643009edac470adb6eabbcb9e6818286276977
4
- data.tar.gz: 145edae1f0f725c16232a648d64ad3224ac93baca18273648b901e7d4ef6ad66
3
+ metadata.gz: b3545e62c7890adc16931218212e284d8e68994814be13ae0e231d5aee89b2ec
4
+ data.tar.gz: 89b19c24b919d441bffbbb8cd426697e656b8726596c24c58cf5f03d79233c81
5
5
  SHA512:
6
- metadata.gz: '09e7a47ed0e3d34e699cbd2e1c14785399015ea66cde8b21dfd194e86d09456df246da0363e0bc0e543ad06129938376c148e87edc6885b0b6c9d94645ffdcd3'
7
- data.tar.gz: 16ec119be87259081c896497229cf3202901c3657ac4aea2f3e47e05ff3976d7130e23a99dcdf1c85b80f8d386243878e0acccd4bc9cb721b0ca8d8e189e4122
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Belt
4
- VERSION = '0.3.30'
4
+ VERSION = '0.3.31'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: belt
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.30
4
+ version: 0.3.31
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stowzilla