@@ -33,6 +33,7 @@ import (
33
33
"github.com/hashicorp/terraform-provider-aws/internal/framework"
34
34
"github.com/hashicorp/terraform-provider-aws/internal/framework/flex"
35
35
fwtypes "github.com/hashicorp/terraform-provider-aws/internal/framework/types"
36
+ tfslices "github.com/hashicorp/terraform-provider-aws/internal/slices"
36
37
"github.com/hashicorp/terraform-provider-aws/internal/tfresource"
37
38
"github.com/hashicorp/terraform-provider-aws/names"
38
39
)
@@ -301,7 +302,7 @@ func (r *projectResource) Delete(ctx context.Context, req resource.DeleteRequest
301
302
deleteTimeout := r .DeleteTimeout (ctx , state .Timeouts )
302
303
_ , err = waitProjectDeleted (ctx , conn , state .DomainIdentifier .ValueString (), state .ID .ValueString (), deleteTimeout )
303
304
304
- if err != nil && ! errs. IsA [ * awstypes. AccessDeniedException ]( err ) {
305
+ if err != nil {
305
306
resp .Diagnostics .AddError (
306
307
create .ProblemStandardMessage (names .DataZone , create .ErrActionWaitingForDeletion , ResNameProject , state .ID .String (), err ),
307
308
err .Error (),
@@ -369,6 +370,14 @@ func statusProject(ctx context.Context, conn *datazone.Client, domain string, id
369
370
return nil , "" , err
370
371
}
371
372
373
+ if len (out .FailureReasons ) > 0 {
374
+ if err := errors .Join (tfslices .ApplyToAll (out .FailureReasons , func (e awstypes.ProjectDeletionError ) error {
375
+ return errors .New (aws .ToString (e .Message ))
376
+ })... ); err != nil {
377
+ return nil , "" , err
378
+ }
379
+ }
380
+
372
381
return out , string (out .ProjectStatus ), nil
373
382
}
374
383
}
@@ -389,7 +398,7 @@ func findProjectByID(ctx context.Context, conn *datazone.Client, domain string,
389
398
return nil , err
390
399
}
391
400
392
- if out == nil || ! ( out . FailureReasons == nil ) {
401
+ if out == nil {
393
402
return nil , tfresource .NewEmptyResultError (in )
394
403
}
395
404
0 commit comments