@@ -186,6 +186,9 @@ func (r *customDomainResource) Create(ctx context.Context, req resource.CreateRe
186186 if resp .Diagnostics .HasError () {
187187 return
188188 }
189+
190+ ctx = core .InitProviderContext (ctx )
191+
189192 projectId := model .ProjectId .ValueString ()
190193 ctx = tflog .SetField (ctx , "project_id" , projectId )
191194 distributionId := model .DistributionId .ValueString ()
@@ -207,6 +210,9 @@ func (r *customDomainResource) Create(ctx context.Context, req resource.CreateRe
207210 core .LogAndAddError (ctx , & resp .Diagnostics , "Error creating CDN custom domain" , fmt .Sprintf ("Calling API: %v" , err ))
208211 return
209212 }
213+
214+ ctx = core .LogResponse (ctx )
215+
210216 _ , err = wait .CreateCDNCustomDomainWaitHandler (ctx , r .client , projectId , distributionId , name ).SetTimeout (5 * time .Minute ).WaitWithContext (ctx )
211217 if err != nil {
212218 core .LogAndAddError (ctx , & resp .Diagnostics , "Error creating CDN custom domain" , fmt .Sprintf ("Waiting for create: %v" , err ))
@@ -240,6 +246,8 @@ func (r *customDomainResource) Read(ctx context.Context, req resource.ReadReques
240246 return
241247 }
242248
249+ ctx = core .InitProviderContext (ctx )
250+
243251 projectId := model .ProjectId .ValueString ()
244252 ctx = tflog .SetField (ctx , "project_id" , projectId )
245253 distributionId := model .DistributionId .ValueString ()
@@ -248,7 +256,6 @@ func (r *customDomainResource) Read(ctx context.Context, req resource.ReadReques
248256 ctx = tflog .SetField (ctx , "name" , name )
249257
250258 customDomainResp , err := r .client .GetCustomDomain (ctx , projectId , distributionId , name ).Execute ()
251-
252259 if err != nil {
253260 var oapiErr * oapierror.GenericOpenAPIError
254261 // n.b. err is caught here if of type *oapierror.GenericOpenAPIError, which the stackit SDK client returns
@@ -261,6 +268,9 @@ func (r *customDomainResource) Read(ctx context.Context, req resource.ReadReques
261268 core .LogAndAddError (ctx , & resp .Diagnostics , "Error reading CDN custom domain" , fmt .Sprintf ("Calling API: %v" , err ))
262269 return
263270 }
271+
272+ ctx = core .LogResponse (ctx )
273+
264274 err = mapCustomDomainResourceFields (customDomainResp , & model )
265275 if err != nil {
266276 core .LogAndAddError (ctx , & resp .Diagnostics , "Error reading CDN custom domain" , fmt .Sprintf ("Processing API payload: %v" , err ))
@@ -283,6 +293,8 @@ func (r *customDomainResource) Update(ctx context.Context, req resource.UpdateRe
283293 return
284294 }
285295
296+ ctx = core .InitProviderContext (ctx )
297+
286298 projectId := model .ProjectId .ValueString ()
287299 ctx = tflog .SetField (ctx , "project_id" , projectId )
288300 distributionId := model .DistributionId .ValueString ()
@@ -306,6 +318,8 @@ func (r *customDomainResource) Update(ctx context.Context, req resource.UpdateRe
306318 return
307319 }
308320
321+ ctx = core .LogResponse (ctx )
322+
309323 _ , err = wait .CreateCDNCustomDomainWaitHandler (ctx , r .client , projectId , distributionId , name ).SetTimeout (5 * time .Minute ).WaitWithContext (ctx )
310324 if err != nil {
311325 core .LogAndAddError (ctx , & resp .Diagnostics , "Error updating CDN custom domain certificate" , fmt .Sprintf ("Waiting for update: %v" , err ))
@@ -338,6 +352,8 @@ func (r *customDomainResource) Delete(ctx context.Context, req resource.DeleteRe
338352 return
339353 }
340354
355+ ctx = core .InitProviderContext (ctx )
356+
341357 projectId := model .ProjectId .ValueString ()
342358 ctx = tflog .SetField (ctx , "project_id" , projectId )
343359 distributionId := model .DistributionId .ValueString ()
@@ -349,6 +365,9 @@ func (r *customDomainResource) Delete(ctx context.Context, req resource.DeleteRe
349365 if err != nil {
350366 core .LogAndAddError (ctx , & resp .Diagnostics , "Delete CDN custom domain" , fmt .Sprintf ("Delete custom domain: %v" , err ))
351367 }
368+
369+ ctx = core .LogResponse (ctx )
370+
352371 _ , err = wait .DeleteCDNCustomDomainWaitHandler (ctx , r .client , projectId , distributionId , name ).WaitWithContext (ctx )
353372 if err != nil {
354373 core .LogAndAddError (ctx , & resp .Diagnostics , "Delete CDN custom domain" , fmt .Sprintf ("Waiting for deletion: %v" , err ))
0 commit comments