belt 0.3.43 → 0.3.44

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: 35d8b66e560a7eedc35c0f801e54e80c5322c0aa81bbba2e84945c679ad37df8
4
- data.tar.gz: 77cac61f6823651528069f69ba79e715acbe9b01054c101cdc51f7dbd5c0227c
3
+ metadata.gz: 7977614906b8f7154ca9e00597f1eb5744bc00ac6814985cfda98a16687d5992
4
+ data.tar.gz: d60ca2ff84dec2ce5d8b6ee97be3f9ef189fc455881e30b4877a37ae3dafef36
5
5
  SHA512:
6
- metadata.gz: 17067c3c5dca6d23f3a7c44576a2653fcb8d281d95951d0ac0faa3deececf9158a6cfeedd08ca2419b196bed86ce75989d0537f29bcdc8f4b288e284505c05d7
7
- data.tar.gz: 7b4dad5df465c3f7ad7cf42bbd6dc803bfe5ef6443cfb92be9918c04a33ca5cb68c5b01082777933fd559cda4d7d9eb4e33dae07a22c1b1b1bf2d62cfa43a7ad
6
+ metadata.gz: b8cf0deed02541a8775b7f4000ba8f5336d09572d6752520bd5191407fd40b97412d5d8c2ee19790b6e8445231be9ffedbd09688c0233b642a96d2ba4494a38c
7
+ data.tar.gz: 025eb3373be5e8c345b29525fd6f81c2e21581b2b044d66dab03482b838e7e491556e6669b099cd128c0b5e5965b29a1ea741761c741b8dee5c489c7f587c34d
@@ -41,11 +41,23 @@ module Belt
41
41
 
42
42
  # Apply the configured aws_profile and env vars to the current process.
43
43
  # Call this before running terraform, aws cli, etc.
44
+ #
45
+ # Note: If AWS credentials are already available via environment variables
46
+ # (AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_SESSION_TOKEN) — as in GitHub
47
+ # Actions OIDC — we skip setting AWS_PROFILE to avoid overriding valid credentials.
44
48
  def apply!
45
- ENV['AWS_PROFILE'] = @aws_profile if aws_profile?
49
+ ENV['AWS_PROFILE'] = @aws_profile if aws_profile? && !credentials_in_env?
46
50
  @env_vars.each { |key, value| ENV[key] = value }
47
51
  end
48
52
 
53
+ # Returns true if AWS credentials are available via environment variables.
54
+ # This happens in CI environments (GitHub Actions OIDC, CodeBuild, etc.)
55
+ def credentials_in_env?
56
+ key = ENV.fetch('AWS_ACCESS_KEY_ID', nil)
57
+ secret = ENV.fetch('AWS_SECRET_ACCESS_KEY', nil)
58
+ !key.to_s.empty? && !secret.to_s.empty?
59
+ end
60
+
49
61
  class ConfigEvaluator
50
62
  def initialize(config)
51
63
  @config = config
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.43'
4
+ VERSION = '0.3.44'
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.43
4
+ version: 0.3.44
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stowzilla