From 8d9ac35a530510f728cf07073ec5e231880208df Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Arango Gutierrez Date: Tue, 13 Feb 2024 12:57:37 +0100 Subject: [PATCH] Enable AWS ENV VAR key auth Signed-off-by: Carlos Eduardo Arango Gutierrez --- pkg/provider/aws/aws.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/provider/aws/aws.go b/pkg/provider/aws/aws.go index 8b42b845..6ac59c90 100644 --- a/pkg/provider/aws/aws.go +++ b/pkg/provider/aws/aws.go @@ -83,7 +83,11 @@ type Client struct { func New(log *logger.FunLogger, env v1alpha1.Environment, cacheFile string) (*Client, error) { // Create an AWS session and configure the EC2 client - cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion(env.Spec.Region)) + region := env.Spec.Region + if envRegion := os.Getenv("AWS_REGION"); envRegion != "" { + region = envRegion + } + cfg, err := config.LoadDefaultConfig(context.TODO(), config.WithRegion(region)) if err != nil { return nil, err }