From 026ae762fa295362419a75c585db0e94ad0d1c4c Mon Sep 17 00:00:00 2001 From: Sam Date: Mon, 9 Dec 2024 09:17:46 -0600 Subject: [PATCH] fix(pg): add region field too (#3628) Signed-off-by: Samantha Coyle --- common/authentication/postgresql/metadata.go | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/common/authentication/postgresql/metadata.go b/common/authentication/postgresql/metadata.go index ccdcc48ce8..7a197dffc3 100644 --- a/common/authentication/postgresql/metadata.go +++ b/common/authentication/postgresql/metadata.go @@ -89,8 +89,12 @@ func (m *PostgresAuthMetadata) InitWithMetadata(meta map[string]string, opts Ini func (m *PostgresAuthMetadata) BuildAwsIamOptions(logger logger.Logger, properties map[string]string) (*aws.Options, error) { awsRegion, _ := metadata.GetMetadataProperty(m.awsEnv.Metadata, "AWSRegion") - if awsRegion == "" { - return nil, errors.New("metadata property AWSRegion is missing") + region, _ := metadata.GetMetadataProperty(m.awsEnv.Metadata, "region") + if region == "" { + region = awsRegion + } + if region == "" { + return nil, errors.New("metadata properties 'region' or 'AWSRegion' is missing") } // Note: access key and secret keys can be optional @@ -114,7 +118,7 @@ func (m *PostgresAuthMetadata) BuildAwsIamOptions(logger logger.Logger, properti sessionName = "DaprDefaultSession" } return &aws.Options{ - Region: awsRegion, + Region: region, AccessKey: awsAccessKey, SecretKey: awsSecretKey, SessionToken: sessionToken,