Skip to main content
A workflow environment can be configured from two places: the sub_environment_configuration block of the env0_environment resource in the env zero Terraform provider, and the env0.workflow.yaml file. Settings that exist in both do not always behave the same way.

Field reference

How approval is resolved

For each sub-environment, a deployment resolves approval in this order: the value in the deployment request, then the workflow file’s requiresApproval, then the saved setting. These are steps 3 to 5 of the approval priority order. The provider sends approve_plan_automatically in the deployment request, so for the deployment Terraform triggers it wins over the workflow file, and env zero saves it on the sub-environment. The field defaults to true, so a block that omits it still sends “no approval required”, and that overrides a requiresApproval: true in the workflow file for that deployment. A deployment started from the UI, the API, a VCS push, or a schedule does not carry Terraform’s value. For each sub-environment it uses the value in its own request when one is set, then the workflow file’s requiresApproval when set, and otherwise the saved setting. The deploy dialog’s Approve automatically checkbox and the API’s subEnvironments.<alias>.userRequiresApproval field set a request value. VCS pushes and schedules do not.
When the workflow file sets requiresApproval, that value replaces the saved setting on the next deployment that Terraform did not trigger. Terraform state keeps showing the value you configured, because the provider does not read the saved setting back, so no drift is reported.To require approval regardless of what triggers the deployment, set both values: approve_plan_automatically = false in the Terraform block and requiresApproval: true in the workflow file. A deployment request that sets its own approval value, such as the deploy dialog’s Approve automatically checkbox, still overrides both for that deployment.
main.tf
env0.workflow.yaml

Updates with prevent_auto_deploy

With prevent_auto_deploy = true, an update to the resource writes only configuration changes to env zero. The provider sends approve_plan_automatically and workspace only as part of a deployment it triggers, so Terraform records changes to them in state, but they never reach env zero. On create, approve_plan_automatically, workspace, and configuration take effect, and revision has no deployment to apply to.

Next steps