@@ -813,7 +813,10 @@ func newOrganizationProvider(options schema.OptionBlock, id, JSONData, organizat
813813
814814 // Apply exclude filter if configured
815815 excludeIDs := getExcludeProjectIDsFromOptions (options )
816- if len (excludeIDs ) > 0 && len (projects ) > 0 {
816+ if len (excludeIDs ) > 0 {
817+ if len (projects ) == 0 {
818+ return nil , errkit .New ("exclude_project_ids requires project listing to succeed, but no projects were discovered" )
819+ }
817820 excludeScope := newProjectScope (excludeIDs )
818821 if excludeScope != nil {
819822 if manager != nil {
@@ -827,7 +830,8 @@ func newOrganizationProvider(options schema.OptionBlock, id, JSONData, organizat
827830 filtered = append (filtered , p )
828831 }
829832 }
830- gologger .Info ().Msgf ("Excluded %d project(s), %d remaining" , len (projects )- len (filtered ), len (filtered ))
833+ matched := len (projects ) - len (filtered )
834+ gologger .Info ().Msgf ("Excluded %d/%d project(s), %d remaining" , matched , len (excludeIDs ), len (filtered ))
831835 projects = filtered
832836 }
833837
@@ -836,16 +840,14 @@ func newOrganizationProvider(options schema.OptionBlock, id, JSONData, organizat
836840 }
837841
838842 // Build projectScope from remaining projects so Resources() uses per-project Asset API path
839- if len (projects ) > 0 {
840- scope := newProjectScope (projects )
841- if scope != nil {
842- if manager != nil {
843- if err := scope .enrichWithProjectNumbers (context .Background (), manager ); err != nil {
844- gologger .Warning ().Msgf ("Could not resolve remaining project ids: %s" , err )
845- }
843+ scope := newProjectScope (projects )
844+ if scope != nil {
845+ if manager != nil {
846+ if err := scope .enrichWithProjectNumbers (context .Background (), manager ); err != nil {
847+ gologger .Warning ().Msgf ("Could not resolve remaining project ids: %s" , err )
846848 }
847- provider .projectScope = scope
848849 }
850+ provider .projectScope = scope
849851 }
850852 }
851853 }
0 commit comments