Skip to content

Commit ca1eab4

Browse files
committed
Set $ASSUMED_ROLE in environment
1 parent 4851064 commit ca1eab4

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

main.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -108,11 +108,11 @@ func main() {
108108
return
109109
}
110110

111-
err = execWithCredentials(args, creds)
111+
err = execWithCredentials(role, args, creds)
112112
must(err)
113113
}
114114

115-
func execWithCredentials(argv []string, creds *credentials.Value) error {
115+
func execWithCredentials(role string, argv []string, creds *credentials.Value) error {
116116
argv0, err := exec.LookPath(argv[0])
117117
if err != nil {
118118
return err
@@ -122,6 +122,7 @@ func execWithCredentials(argv []string, creds *credentials.Value) error {
122122
os.Setenv("AWS_SECRET_ACCESS_KEY", creds.SecretAccessKey)
123123
os.Setenv("AWS_SESSION_TOKEN", creds.SessionToken)
124124
os.Setenv("AWS_SECURITY_TOKEN", creds.SessionToken)
125+
os.Setenv("ASSUMED_ROLE", role)
125126

126127
env := os.Environ()
127128
return syscall.Exec(argv0, argv, env)

0 commit comments

Comments
 (0)