From 8c52d7ebe021f5ff6327d79bab1c3abf1ae2e028 Mon Sep 17 00:00:00 2001 From: xescugc Date: Tue, 19 Mar 2024 13:23:10 +0100 Subject: [PATCH] prv/organization: Wrong organization passed to the state The 'can' of the created or was passed on update/read to the state as also parent. For some reasons my local TF was not showing the diff of this but a client did and we fixed it now --- provider/organization_resource.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/provider/organization_resource.go b/provider/organization_resource.go index 4795941..56e58d4 100644 --- a/provider/organization_resource.go +++ b/provider/organization_resource.go @@ -108,7 +108,9 @@ func (r *organizationResource) Read(ctx context.Context, req resource.ReadReques return } - organizationCYModelToData(can, org, &data) + orgCan := getOrganizationCanonical(r.provider, data.OrganizationCanonical) + + organizationCYModelToData(orgCan, org, &data) // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...) @@ -151,7 +153,9 @@ func (r *organizationResource) Update(ctx context.Context, req resource.UpdateRe return } - organizationCYModelToData(can, uo, &data) + orgCan := getOrganizationCanonical(r.provider, data.OrganizationCanonical) + + organizationCYModelToData(orgCan, uo, &data) // Save updated data into Terraform state resp.Diagnostics.Append(resp.State.Set(ctx, &data)...)