Skip to content

Commit

Permalink
force setting env creds
Browse files Browse the repository at this point in the history
  • Loading branch information
okankoAMZ committed Sep 21, 2023
1 parent 82ff683 commit 0f5cd91
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions packaging/uniformBuild/uniformBuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ import (
"flag"
"fmt"
"github.com/aws/aws-sdk-go-v2/config"
"github.com/aws/aws-sdk-go-v2/credentials"
"os"
"strings"
"time"

Expand Down Expand Up @@ -34,15 +36,15 @@ var DEFAULT_INSTANCE_GUIDE = map[string]OS{
This function will create EC2 instances as a side effect
*/
func CreateRemoteBuildManager(instanceGuide map[string]OS, accountID string) *RemoteBuildManager {
cfg, err := config.LoadDefaultConfig(context.TODO())
// Set up the static credentials provider
creds := credentials.NewStaticCredentialsProvider(os.Getenv("AWS_ACCESS_KEY_ID"),
os.Getenv("AWS_SECRET_ACCESS_KEY"),
os.Getenv("AWS_SESSION_TOKEN"))

cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithCredentialsProvider(creds))
if err != nil {
return nil
}
cred, err := cfg.Credentials.Retrieve(context.TODO())
if cred.SessionToken == "" {
panic("incorrect creds")
return nil
}
//instance := *GetInstanceFromID(client, "i-09fc6fdc80cd713a4")
rbm := RemoteBuildManager{}

Expand Down

0 comments on commit 0f5cd91

Please sign in to comment.