@@ -465,15 +465,19 @@ func (r *workspaceSettings) readSettings(ctx context.Context, workspaceID string
465465 ws , err := r .config .Client .Workspaces .ReadByIDWithOptions (ctx , workspaceID , & tfe.WorkspaceReadOptions {
466466 Include : []tfe.WSIncludeOpt {tfe .WSEffectiveTagBindings },
467467 })
468- if err != nil && errors .Is (err , tfe .ErrInvalidIncludeValue ) {
468+ if errors .Is (err , tfe .ErrResourceNotFound ) {
469+ log .Printf ("[DEBUG] Workspace %s no longer exists" , workspaceID )
470+ return nil , errWorkspaceNoLongerExists
471+ } else if errors .Is (err , tfe .ErrInvalidIncludeValue ) {
469472 log .Printf ("[DEBUG] Workspace %s read failed due to unsupported Include; retrying without it" , workspaceID )
470473 ws , err = r .config .Client .Workspaces .ReadByID (ctx , workspaceID )
471- if err != nil && errors .Is (err , tfe .ErrResourceNotFound ) {
472- return nil , err
474+ if errors .Is (err , tfe .ErrResourceNotFound ) {
475+ return nil , errWorkspaceNoLongerExists
473476 } else if err != nil {
474477 return nil , fmt .Errorf ("Error reading workspace %s without include: %w" , workspaceID , err )
475478 }
476479 }
480+
477481 if err != nil {
478482 return nil , fmt .Errorf ("Error reading configuration of workspace %s: %w" , workspaceID , err )
479483 }
0 commit comments