From 9d883c15f62355ea9aa043d99c7befbcb41176f7 Mon Sep 17 00:00:00 2001 From: Christian Lechner Date: Thu, 6 Jul 2023 12:55:37 +0200 Subject: [PATCH] fix: removed state from update as not needed --- internal/provider/resource_subaccount.go | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/internal/provider/resource_subaccount.go b/internal/provider/resource_subaccount.go index af194b42..bc9ebeea 100644 --- a/internal/provider/resource_subaccount.go +++ b/internal/provider/resource_subaccount.go @@ -225,7 +225,7 @@ func (rs *subaccountResource) Create(ctx context.Context, req resource.CreateReq args.Directory = parentID } - if plan.BetaEnabled.IsUnknown() { + if !plan.BetaEnabled.IsUnknown() { betaEnabled := plan.BetaEnabled.ValueBool() args.BetaEnabled = betaEnabled } @@ -278,14 +278,11 @@ func (rs *subaccountResource) Create(ctx context.Context, req resource.CreateReq } func (rs *subaccountResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse) { - var plan, state subaccountType + var plan subaccountType diags := req.Plan.Get(ctx, &plan) resp.Diagnostics.Append(diags...) - diags = req.State.Get(ctx, &state) - resp.Diagnostics.Append(diags...) - if resp.Diagnostics.HasError() { return } @@ -295,7 +292,7 @@ func (rs *subaccountResource) Update(ctx context.Context, req resource.UpdateReq Description: plan.Description.ValueString(), Directory: plan.ParentID.ValueString(), DisplayName: plan.Name.ValueString(), - SubaccountId: state.ID.ValueString(), + SubaccountId: plan.ID.ValueString(), } var labels map[string][]string