Skip to content

Commit a78bc48

Browse files
committed
pr feedback
1 parent 737daa8 commit a78bc48

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

pkg/env/env.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,9 @@ type Config struct {
2424
RenderAPIKey string `required:"true" split_words:"true"`
2525
AWSRegion string `required:"true" split_words:"true"`
2626

27-
// If AWSRoleARN is empty, the AWS SDK falls back to access keys from the environment
27+
// OIDC is used if the web identity token file exists on disk (mounted by
28+
// Render when OIDC is enabled). Otherwise the AWS SDK's default credential
29+
// chain falls back to AWS_ACCESS_KEY_ID / AWS_SECRET_ACCESS_KEY.
2830
AWSRoleARN string `required:"false" split_words:"true"`
2931
AWSWebIdentityTokenFile string `required:"false" split_words:"true" default:"/var/lib/render/oidc/aws.jwt"`
3032

@@ -49,7 +51,8 @@ func LoadConfig(ctx context.Context, config *Config) error {
4951
return err
5052
}
5153

52-
if config.AWSRoleARN != "" {
54+
if _, err := os.Stat(config.AWSWebIdentityTokenFile); err == nil {
55+
logger.FromContext(ctx).Info("Using OIDC authentication")
5356
awscfg.Credentials = aws.NewCredentialsCache(stscreds.NewWebIdentityRoleProvider(
5457
sts.NewFromConfig(awscfg),
5558
config.AWSRoleARN,

0 commit comments

Comments
 (0)