Open nabuskey opened 2 years ago
Need to use something like this to fallback to w/e is available in credentials chain:
// UseProviderSecret - AWS configuration which can be used to issue requests against AWS API func useProviderSecret(ctx context.Context, data []byte, region, profile string) (*aws.Config, error) { creds, err := credentialsIDSecret(data, profile) if err != nil { return nil, errors.Wrap(err, "cannot parse credentials secret") } if creds.AccessKeyID == "" && creds.SecretAccessKey == "" { conf, err := config.LoadDefaultConfig(ctx, config.WithRegion(region)) if err != nil { return nil, errors.Wrap(err, "cannot obtain credentials from temporary credentials chain") } _, err = conf.Credentials.Retrieve(ctx) if err != nil { return nil, errors.Wrap(err, "failed to retrieve credentials") } return &conf, nil } conf, err := config.LoadDefaultConfig(ctx, config.WithRegion(region), config.WithCredentialsProvider(credentials.StaticCredentialsProvider{ Value: creds, })) return &conf, err }
This is working in my setup. I'll make a PR later.
sounds good, thanks!
Need to use something like this to fallback to w/e is available in credentials chain:
This is working in my setup. I'll make a PR later.