Fix missing region error when using Firelens external config.
GetBucketLocation returns null for bucket in us-east-1. Return us-east-1 instead of null in that case.
@@ -28,6 +28,7 @@ import (
)
const (
+ bucketLocationDefault = "us-east-1"
roundtripTimeout = 5 * time.Second
)
@@ -69,6 +70,9 @@ func getRegionFromBucket(svc *s3.S3, bucket string) (string, error) {
if err != nil {
return "", err
}
+ if result.LocationConstraint == nil { // GetBucketLocation returns nil for bucket in us-east-1.
+ return bucketLocationDefault, nil
+ }
return aws.StringValue(result.LocationConstraint), nil
}
