Skip to content

Commit ab7847c

Browse files
committed
feat(dsql-cluster): limit to supported regions
1 parent 327ae41 commit ab7847c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

resources/dsql-cluster.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ package resources
33
import (
44
"context"
55
"errors"
6+
"slices"
67
"time"
78

89
"github.com/gotidy/ptr"
@@ -39,6 +40,10 @@ func (l *DSQLClusterLister) List(ctx context.Context, o interface{}) ([]resource
3940
svc := dsql.NewFromConfig(*opts.Config)
4041
var resources []resource.Resource
4142

43+
if !l.IsSupportedRegion(opts.Region.Name) {
44+
return resources, nil
45+
}
46+
4247
params := &dsql.ListClustersInput{
4348
MaxResults: ptr.Int32(100),
4449
}
@@ -89,6 +94,17 @@ func (l *DSQLClusterLister) List(ctx context.Context, o interface{}) ([]resource
8994
return resources, nil
9095
}
9196

97+
func (l *DSQLClusterLister) IsSupportedRegion(region string) bool {
98+
// https://aws.amazon.com/rds/aurora/dsql/faqs/#:~:text=available%20in%20all-,AWS%20Regions,-%3F
99+
// NOTE: us-west-2 (Oregon) is available as a witness region, but clusters cannot be created in this region
100+
supportedRegions := []string{
101+
"us-east-1",
102+
"us-east-2",
103+
}
104+
105+
return slices.Contains(supportedRegions, region)
106+
}
107+
92108
type DSQLCluster struct {
93109
svc *dsql.Client
94110
settings *libsettings.Setting

0 commit comments

Comments
 (0)