From 6f0dca420774c3d28a2b5b2717a0c9613750d65f Mon Sep 17 00:00:00 2001 From: harshitsrivastava97 Date: Wed, 4 Dec 2024 22:14:43 +0530 Subject: [PATCH] fix: [CDS-104598]: Add check for panic when OPA policy is denied (#1129) Co-authored-by: Ritek <140505097+ritek01@users.noreply.github.com> --- .../cd_nextgen/connector/cloudProviders/cloudProviders.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/internal/service/cd_nextgen/connector/cloudProviders/cloudProviders.go b/internal/service/cd_nextgen/connector/cloudProviders/cloudProviders.go index b0e4030e8..50acf1707 100644 --- a/internal/service/cd_nextgen/connector/cloudProviders/cloudProviders.go +++ b/internal/service/cd_nextgen/connector/cloudProviders/cloudProviders.go @@ -99,6 +99,10 @@ func resourceConnectorCreateOrUpdateBase(ctx context.Context, d *schema.Resource return nil, helpers.HandleApiError(err, d, httpResp) } + if resp.Data.Connector == nil { + return nil, diag.FromErr(fmt.Errorf("Could not create/update connector. Please check the policy restrictions.")) + } + readCommonConnectorData(d, resp.Data.Connector) return resp.Data.Connector, nil