AzBuilder / terrakube

Open source IaC Automation and Collaboration Software.
https://docs.terrakube.io
Apache License 2.0
496 stars 38 forks source link

CLI Workspace with Local Execution mode ignores workspace lock #1248

Closed iam-take closed 3 weeks ago

iam-take commented 3 weeks ago

Bug description 🐞

834 Was reported by myself a while ago and has a fix in #983 however this fix only works for CLI workspaces which are set to remote execution mode this still isn't working for CLI Workspaces which are set to local execution mode.

Orginal description: When running a workspace in local execution mode and enabling a state/workspace lock on that workspace wont result in a block on running the workspace either Terraform Plan or Apply.

Instead Terrakube will remove the lock on the workspace and allowing either the plan or apply to continue. The whole purpose of locking the state is preventing a workspace to be ran. This should make no difference between local or remote execution mode.

For the remote cli workspace configuration the setting in the portal stays on locked when a plan is ran, although a plan should also already be blocked when locking the state. When running a apply Terrakube will also unlock the state and allow a apply to be ran.

Steps to reproduce

Create a cli workspace with local execution mode For a local execution mode workspace run a terraform plan and the state/workspace will be unlocked, same for Terraform Apply

Expected behavior

The state / workspace should remain locked until the user removes the lock either through the portal or api call.

Example repository

No response

Anything else?

No response

iam-take commented 3 weeks ago

To confirm #983 does fix this for the CLI Workspace with remote mode enabled just not for local mode!