Skip to content

Commit

Permalink
Edit workspace controller
Browse files Browse the repository at this point in the history
  • Loading branch information
sheneska committed Feb 24, 2025
1 parent 4fa9862 commit 930d8e2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions internal/controller/workspace_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,8 @@ func applyMethodToBool(applyMethod string) bool {
}

// autoApplyRunTriggerToBool turns spec.autoapplyRunTrigger field into bool
func autoApplyRunTriggerToBool(autoApplyRunTrigger bool) bool {
return autoApplyRunTrigger
func applyRunTriggerToBool(applyRunTrigger string) bool {
return applyRunTrigger == "auto"
}

func (r *WorkspaceReconciler) addFinalizer(ctx context.Context, instance *appv1alpha2.Workspace) error {
Expand Down Expand Up @@ -257,7 +257,7 @@ func (r *WorkspaceReconciler) createWorkspace(ctx context.Context, w *workspaceI
Name: tfc.String(spec.Name),
AllowDestroyPlan: tfc.Bool(spec.AllowDestroyPlan),
AutoApply: tfc.Bool(applyMethodToBool(spec.ApplyMethod)),
AutoApplyRunTrigger: tfc.Bool(autoApplyRunTriggerToBool(spec.AutoApplyRunTrigger)),
AutoApplyRunTrigger: tfc.Bool(applyRunTriggerToBool(spec.ApplyRunTrigger)),
Description: tfc.String(spec.Description),
ExecutionMode: tfc.String(spec.ExecutionMode),
TerraformVersion: tfc.String(spec.TerraformVersion),
Expand Down Expand Up @@ -355,8 +355,8 @@ func (r *WorkspaceReconciler) updateWorkspace(ctx context.Context, w *workspaceI
updateOptions.AutoApply = tfc.Bool(applyMethodToBool(spec.ApplyMethod))
}

if workspace.AutoApplyRunTrigger != autoApplyRunTriggerToBool(spec.AutoApplyRunTrigger) {
updateOptions.AutoApplyRunTrigger = tfc.Bool(autoApplyRunTriggerToBool(spec.AutoApplyRunTrigger))
if workspace.AutoApplyRunTrigger != applyRunTriggerToBool(spec.ApplyRunTrigger) {
updateOptions.AutoApplyRunTrigger = tfc.Bool(applyRunTriggerToBool(spec.ApplyRunTrigger))
}

if workspace.AllowDestroyPlan != spec.AllowDestroyPlan {
Expand Down

0 comments on commit 930d8e2

Please sign in to comment.