@@ -127,6 +127,10 @@ func (d *OrganizationDataSource) Read(ctx context.Context, req datasource.ReadRe
127
127
orgID := data .ID .ValueUUID ()
128
128
org ,err = client .Organization (ctx ,orgID )
129
129
if err != nil {
130
+ if isNotFound (err ) {
131
+ resp .State .RemoveResource (ctx )
132
+ return
133
+ }
130
134
resp .Diagnostics .AddError ("Client Error" ,fmt .Sprintf ("Unable to get organization by ID, got error: %s" ,err ))
131
135
return
132
136
}
@@ -137,6 +141,10 @@ func (d *OrganizationDataSource) Read(ctx context.Context, req datasource.ReadRe
137
141
}else if data .IsDefault .ValueBool () {// Get Default
138
142
org ,err = client .OrganizationByName (ctx ,"default" )
139
143
if err != nil {
144
+ if isNotFound (err ) {
145
+ resp .State .RemoveResource (ctx )
146
+ return
147
+ }
140
148
resp .Diagnostics .AddError ("Client Error" ,fmt .Sprintf ("Unable to get default organization, got error: %s" ,err ))
141
149
return
142
150
}
@@ -147,6 +155,10 @@ func (d *OrganizationDataSource) Read(ctx context.Context, req datasource.ReadRe
147
155
}else {// By Name
148
156
org ,err = client .OrganizationByName (ctx ,data .Name .ValueString ())
149
157
if err != nil {
158
+ if isNotFound (err ) {
159
+ resp .State .RemoveResource (ctx )
160
+ return
161
+ }
150
162
resp .Diagnostics .AddError ("Client Error" ,fmt .Sprintf ("Unable to get organization by name, got error: %s" ,err ))
151
163
return
152
164
}