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 +4 -4
- data/lib/belt/cli/environment_config.rb +13 -1
- 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: 7977614906b8f7154ca9e00597f1eb5744bc00ac6814985cfda98a16687d5992
|
|
4
|
+
data.tar.gz: d60ca2ff84dec2ce5d8b6ee97be3f9ef189fc455881e30b4877a37ae3dafef36
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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