belt 0.3.24 → 0.3.26

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: 9e5f26e4b71c7d784ea8e6a2596952a21d9357f65a9284b9358c5c79a34e50a8
4
- data.tar.gz: f98d7e78c1620e38700eb53151cbf21daaace261f0b2802dc36633665bc50d1d
3
+ metadata.gz: 7a5cf0b2661bd7ea2b9e0e2ebe13fcb6090506bb3b268a606b6d5fd6b4e21511
4
+ data.tar.gz: 344bd5cce8ca35f81e0b8ba5e4c4a43a182bb031a56ddc9db01ec2bd5a01ba26
5
5
  SHA512:
6
- metadata.gz: d6d165f29d693cbc4cd19b693a74867ad578c70bcc255ffc25672ae616694a7604870e090800df16a73d6534e772d95fd417bdad888c07674f15998f838cdaa7
7
- data.tar.gz: 835dfd43f148de3966d7cba26784922b2c6f952ab24d1c9fb61abf4f51f596d29107526c91a6cdba5be191f061f91acd6504298bd6067ccc756ac7b556b09a88
6
+ metadata.gz: 39c2ec3441b7622cb8ab1913afe6d76eb6b300c6c41c5767361efea0e76c94a97ba738bb2fd09d2fde68a5ec0353c909afe9c392066f655a56c393a72a8b1ea0
7
+ data.tar.gz: 8f9c6cb95c3d775d86f4e53ddf708c6ed8be8bcbf823ffa70dc5427752bd87444d1dcfc91cc19ba85572ecd9186ff2d05f69dbc05db8412972cd36c1c3e1ff3a
@@ -314,10 +314,17 @@ module Belt
314
314
  end
315
315
 
316
316
  # Resolve state bucket for a specific AWS profile.
317
- # If profile is provided, uses that profile's account ID.
317
+ # If profile is explicitly provided, uses that profile's account ID directly.
318
318
  # Otherwise falls back to existing sibling backend.tf or current credentials.
319
319
  def resolve_state_bucket_for_profile(profile)
320
- bucket_from_sibling || bucket_from_aws_profile(profile) || 'belt-terraform-state'
320
+ if profile
321
+ # Explicit profile = derive bucket from that profile's account ID
322
+ # Do NOT fall back to sibling backends — they're likely different accounts
323
+ bucket_from_aws_profile(profile) || 'belt-terraform-state'
324
+ else
325
+ # No profile = use existing sibling or current credentials
326
+ bucket_from_sibling || bucket_from_aws_profile(nil) || 'belt-terraform-state'
327
+ end
321
328
  end
322
329
 
323
330
  def bucket_from_sibling
@@ -94,7 +94,11 @@ module Belt
94
94
  setup_or_verify_bucket
95
95
  apply_lifecycle(@bucket_name)
96
96
  say ' ensure lifecycle rules (90-day noncurrent expiration)'
97
- update_backend_config
97
+
98
+ # Only update backend configs when we know the target scope.
99
+ # If --aws-profile is set but no env_name, we're creating a bucket for a specific
100
+ # account (e.g., DNS infrastructure) — don't touch other environments' backends.
101
+ update_backend_config unless @aws_profile && @env_name.nil?
98
102
  print_success_message
99
103
  end
100
104
 
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.24'
4
+ VERSION = '0.3.26'
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.24
4
+ version: 0.3.26
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stowzilla