Skip to content

Commit

Permalink
fix credentials not defined error (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
mrufsvold authored Aug 6, 2024
1 parent 60960e8 commit 9738799
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/aws.jl
Original file line number Diff line number Diff line change
Expand Up @@ -198,18 +198,18 @@ function loadRoleArn(roleArn, credFile, configFile)
sprofile = get(AWS_CONFIGS, "source_profile", "")
params["Action"] = "AssumeRole"
params["Version"] = "2011-06-15"
if sprofile != ""
credentials = if sprofile != ""
# source_profile is the config file profile we should use for creds to call STS
Figgy.load!(AWS_CONFIGS, Figgy.IniFile(credFile, sprofile), Figgy.IniFile(configFile, sprofile))
credentials = AWSCredentials(
AWSCredentials(
get(AWS_CONFIGS, "aws_access_key_id", ""),
get(AWS_CONFIGS, "aws_secret_access_key", ""),
get(AWS_CONFIGS, "aws_session_token", "")
)
elseif haskey(AWS_CONFIGS, "credential_source")
# if credential_source is provided, we've already loaded source creds
# above via environment variables, ecs, or ec2, so we should be ready to call STS
credentials = AWSCredentials(
AWSCredentials(
get(AWS_CONFIGS, "aws_access_key_id", ""),
get(AWS_CONFIGS, "aws_secret_access_key", ""),
get(AWS_CONFIGS, "aws_session_token", "")
Expand All @@ -218,7 +218,7 @@ function loadRoleArn(roleArn, credFile, configFile)
# load the web identity token to be passed to STS
params["WebIdentityToken"] = read(AWS_CONFIGS["web_identity_token_file"])
params["Action"] = "AssumeRoleWithWebIdentity"
credentials = nothing
nothing
end
if haskey(AWS_CONFIGS, "duration_seconds")
dur = parse(Int, AWS_CONFIGS["duration_seconds"])
Expand Down

0 comments on commit 9738799

Please sign in to comment.