@@ -71,7 +71,7 @@ func describeAvailabilityZones(ctx context.Context, session *session.Session, re
7171
7272// filterZonesByType retrieves a list of zones by a given ZoneType attribute within the region.
7373// ZoneType can be availability-zone, local-zone or wavelength-zone.
74- func filterZonesByType (ctx context.Context , session * session.Session , region string , zoneType string ) ([]string , error ) {
74+ func filterZonesByType (ctx context.Context , session * session.Session , region , zoneType string ) ([]string , error ) {
7575 azs , err := describeAvailabilityZones (ctx , session , region , []string {})
7676 if err != nil {
7777 return nil , fmt .Errorf ("fetching %s: %w" , zoneType , err )
@@ -83,16 +83,19 @@ func filterZonesByType(ctx context.Context, session *session.Session, region str
8383 }
8484 }
8585
86- if len (zones ) == 0 {
87- return nil , fmt .Errorf ("no zones with type %s in %s" , zoneType , region )
88- }
89-
9086 return zones , nil
9187}
9288
9389// availabilityZones retrieves a list of zones type 'availability-zone' in the region.
9490func availabilityZones (ctx context.Context , session * session.Session , region string ) ([]string , error ) {
95- return filterZonesByType (ctx , session , region , typesaws .AvailabilityZoneType )
91+ zones , err := filterZonesByType (ctx , session , region , typesaws .AvailabilityZoneType )
92+ if err != nil {
93+ return nil , err
94+ }
95+ if len (zones ) == 0 {
96+ return nil , fmt .Errorf ("no zones with type availability-zone in %s" , region )
97+ }
98+ return zones , nil
9699}
97100
98101// edgeZones retrieves a list of zones type 'local-zone' and 'wavelength-zone' in the region.
@@ -110,6 +113,10 @@ func edgeZones(ctx context.Context, session *session.Session, region string) ([]
110113 edgeZones = append (edgeZones , localZones ... )
111114 edgeZones = append (edgeZones , wavelengthZones ... )
112115
116+ if len (edgeZones ) == 0 {
117+ return nil , fmt .Errorf ("unable to find zone types with local-zone or wavelength-zone in the region %s" , region )
118+ }
119+
113120 return edgeZones , nil
114121}
115122
0 commit comments