@@ -465,15 +465,19 @@ func (r *workspaceSettings) readSettings(ctx context.Context, workspaceID string
465
465
ws , err := r .config .Client .Workspaces .ReadByIDWithOptions (ctx , workspaceID , & tfe.WorkspaceReadOptions {
466
466
Include : []tfe.WSIncludeOpt {tfe .WSEffectiveTagBindings },
467
467
})
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 ) {
469
472
log .Printf ("[DEBUG] Workspace %s read failed due to unsupported Include; retrying without it" , workspaceID )
470
473
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
473
476
} else if err != nil {
474
477
return nil , fmt .Errorf ("Error reading workspace %s without include: %w" , workspaceID , err )
475
478
}
476
479
}
480
+
477
481
if err != nil {
478
482
return nil , fmt .Errorf ("Error reading configuration of workspace %s: %w" , workspaceID , err )
479
483
}
0 commit comments