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’srequiresApproval, 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.
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
- Approval policies - Require approval by policy, evaluated before the request and workflow file values.
- Partial workflow deployment - Deploy or destroy a subset of the workflow graph.
- Managing workflow variables - Configure variables and output passing at the template level.