Skip to content

Commit

Permalink
Set $ASSUMED_ROLE in environment
Browse files Browse the repository at this point in the history
  • Loading branch information
benhartley committed Feb 8, 2018
1 parent 4851064 commit ca1eab4
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ func main() {
return
}

err = execWithCredentials(args, creds)
err = execWithCredentials(role, args, creds)
must(err)
}

func execWithCredentials(argv []string, creds *credentials.Value) error {
func execWithCredentials(role string, argv []string, creds *credentials.Value) error {
argv0, err := exec.LookPath(argv[0])
if err != nil {
return err
Expand All @@ -122,6 +122,7 @@ func execWithCredentials(argv []string, creds *credentials.Value) error {
os.Setenv("AWS_SECRET_ACCESS_KEY", creds.SecretAccessKey)
os.Setenv("AWS_SESSION_TOKEN", creds.SessionToken)
os.Setenv("AWS_SECURITY_TOKEN", creds.SessionToken)
os.Setenv("ASSUMED_ROLE", role)

env := os.Environ()
return syscall.Exec(argv0, argv, env)
Expand Down

0 comments on commit ca1eab4

Please sign in to comment.