Skip to content

Commit 9a1ee37

Browse files
authored
fix: remote_hook_id should use value from state (#71)
* fix: remote_hook_id should use value from state Because remote_hook_id is a computed value, it should use the value from state in update operation. * remove commented code
1 parent 0a2f1d3 commit 9a1ee37

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

internal/provider/workspace_webhook_resource.go

+6-7
Original file line numberDiff line numberDiff line change
@@ -150,12 +150,11 @@ func (r *WorkspaceWebhookResource) Create(ctx context.Context, req resource.Crea
150150
plan.Branch.ElementsAs(ctx, &branchList, true)
151151
plan.Path.ElementsAs(ctx, &pathList, true)
152152
bodyRequest := &client.WorkspaceWebhookEntity{
153-
ID: uuid.New().String(),
154-
Path: strings.Join(pathList, ","),
155-
Branch: strings.Join(branchList, ","),
156-
TemplateId: plan.TemplateId.ValueString(),
157-
RemoteHookId: plan.RemoteHookId.ValueString(),
158-
Event: plan.Event.ValueString(),
153+
ID: uuid.New().String(),
154+
Path: strings.Join(pathList, ","),
155+
Branch: strings.Join(branchList, ","),
156+
TemplateId: plan.TemplateId.ValueString(),
157+
Event: plan.Event.ValueString(),
159158
}
160159

161160
var out = new(bytes.Buffer)
@@ -279,7 +278,7 @@ func (r *WorkspaceWebhookResource) Update(ctx context.Context, req resource.Upda
279278
Path: strings.Join(pathList, ","),
280279
Branch: strings.Join(branchList, ","),
281280
TemplateId: plan.TemplateId.ValueString(),
282-
RemoteHookId: plan.RemoteHookId.ValueString(),
281+
RemoteHookId: state.RemoteHookId.ValueString(),
283282
Event: plan.Event.ValueString(),
284283
ID: state.ID.ValueString(),
285284
}

0 commit comments

Comments
 (0)