Skip to content

Commit

Permalink
fix: removed state from update as not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
lechnerc77 committed Jul 6, 2023
1 parent 93c2bf5 commit 9d883c1
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions internal/provider/resource_subaccount.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand All @@ -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
Expand Down

0 comments on commit 9d883c1

Please sign in to comment.