From 68326c685fb6257220845195fd9cb5cbb3907f06 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Mon, 25 Sep 2023 00:06:41 +0200 Subject: Fixed identity resource RawData idempotency --- internal/provider/identity_resource.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'internal/provider/identity_resource.go') diff --git a/internal/provider/identity_resource.go b/internal/provider/identity_resource.go index 8804f54..4df4219 100644 --- a/internal/provider/identity_resource.go +++ b/internal/provider/identity_resource.go @@ -143,7 +143,14 @@ func (r *IdentityResource) Read(ctx context.Context, req resource.ReadRequest, r data.Connector = types.StringValue(identity.Connector) data.Id = types.StringValue(identity.Id.String()) data.Name = types.StringValue(identity.Name) - data.RawData = types.StringValue(string(identity.RawData)) + rawDataEquals, err := JSONRawDataEqual(identity.RawData, json.RawMessage(data.RawData.ValueString())) + if err != nil { + resp.Diagnostics.AddError("JSONRawDataequal", fmt.Sprintf("Unable to compare identities RawData, got error: %s", err)) + return + } + if !rawDataEquals { + data.RawData = types.StringValue(string(identity.RawData)) + } data.Status = types.StringValue(string(identity.Status)) data.Type = types.StringValue(identity.Type) resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) -- cgit v1.2.3