# Assign agents to projects Source: https://docs.envzero.com/api-reference/agents-settings/assign-agents-to-projects /api-reference/openapi.yml post /agents/projects-assignments Assign projects to agents, send a request body where each key represents a Project ID and the corresponding value is the Agent Key assigned to that project. Request Body Example: ```json { "projectId1": "agentKey1", "projectId2": "agentKey2" } ``` # Create agent Source: https://docs.envzero.com/api-reference/agents-settings/create-agent /api-reference/openapi.yml post /agents Create a new self-hosted agent # Create agent secret Source: https://docs.envzero.com/api-reference/agents-settings/create-agent-secret /api-reference/openapi.yml post /agents/{agentKey}/secrets Creates a new secret for an agent. Returns the plain secret value once. # Delete agent Source: https://docs.envzero.com/api-reference/agents-settings/delete-agent /api-reference/openapi.yml delete /agents/{agentKey} Delete an agent (soft delete) # Get agent Source: https://docs.envzero.com/api-reference/agents-settings/get-agent /api-reference/openapi.yml get /agents/{agentKey} Get agent details by key # Get agent assignments of projects Source: https://docs.envzero.com/api-reference/agents-settings/get-agent-assignments-of-projects /api-reference/openapi.yml get /agents/projects-assignments returns the current default agent key and a map of project ids to agent key assignments # Get agent .env file content (Deprecated) Source: https://docs.envzero.com/api-reference/agents-settings/get-agent-env-file-content-deprecated /api-reference/openapi.yml get /agents/{agentKey}/dotenv Deprecated. Not supported for agents created via the UI, API, or Terraform provider. # Get agent secrets metadata Source: https://docs.envzero.com/api-reference/agents-settings/get-agent-secrets-metadata /api-reference/openapi.yml get /agents/{agentKey}/secrets Returns metadata for all secrets associated with an agent (does not return secret values) # Get agent values file content (Deprecated) Source: https://docs.envzero.com/api-reference/agents-settings/get-agent-values-file-content-deprecated /api-reference/openapi.yml get /agents/{agentKey}/values Deprecated. Not supported for agents created via the UI, API, or Terraform provider. # Get the agent assignment of a project Source: https://docs.envzero.com/api-reference/agents-settings/get-the-agent-assignment-of-a-project /api-reference/openapi.yml get /agents/projects-assignments/{projectId} Returns the assigned agent # List agents Source: https://docs.envzero.com/api-reference/agents-settings/list-agents /api-reference/openapi.yml get /agents Get a list of the organization agents # Revoke agent secret Source: https://docs.envzero.com/api-reference/agents-settings/revoke-agent-secret /api-reference/openapi.yml delete /agents/{agentKey}/secrets/{secretId} Delete an agent secret (immediate and irreversible) # Set default agent for organization Source: https://docs.envzero.com/api-reference/agents-settings/set-default-agent-for-organization /api-reference/openapi.yml put /agents/default-agent sets the default agent for the organization # Update agent Source: https://docs.envzero.com/api-reference/agents-settings/update-agent /api-reference/openapi.yml patch /agents/{agentKey} Update agent properties # Assign Approval Policy To Scope Source: https://docs.envzero.com/api-reference/approval-policy/assign-approval-policy-to-scope /api-reference/openapi.yml post /approval-policy/assignment # Create Approval Policy Source: https://docs.envzero.com/api-reference/approval-policy/create-approval-policy /api-reference/openapi.yml post /approval-policy # Delete Approval Policy Source: https://docs.envzero.com/api-reference/approval-policy/delete-approval-policy /api-reference/openapi.yml delete /approval-policy/delete/{id} # Get Approval Policy Assignments By Scope Source: https://docs.envzero.com/api-reference/approval-policy/get-approval-policy-assignments-by-scope /api-reference/openapi.yml get /approval-policy/{scope}/{scopeId} # Get Approval Policy By Name Source: https://docs.envzero.com/api-reference/approval-policy/get-approval-policy-by-name /api-reference/openapi.yml get /approval-policy # Get Policy Catalog Source: https://docs.envzero.com/api-reference/approval-policy/get-policy-catalog /api-reference/openapi.yml get /policy-catalog Returns a list of available policy templates for the policy catalog # List Approval Policies Source: https://docs.envzero.com/api-reference/approval-policy/list-approval-policies /api-reference/openapi.yml get /approval-policies Returns all approval policies associated with an organization. # Unassign Approval Policy by assignment id Source: https://docs.envzero.com/api-reference/approval-policy/unassign-approval-policy-by-assignment-id /api-reference/openapi.yml delete /approval-policy/assignment # Unassign Approval Policy From Scope Source: https://docs.envzero.com/api-reference/approval-policy/unassign-approval-policy-from-scope /api-reference/openapi.yml delete /approval-policy/assignment/{scope}/{scopeId} # Update Existing Approval Policy Source: https://docs.envzero.com/api-reference/approval-policy/update-existing-approval-policy /api-reference/openapi.yml put /approval-policy # Fetch Audit Logs Source: https://docs.envzero.com/api-reference/audit-events/fetch-audit-logs /api-reference/openapi.yml get /audit/events # Bulk add environment tags Source: https://docs.envzero.com/api-reference/bulk-operations/bulk-add-environment-tags /api-reference/openapi.yml post /bulk-operations/add-tags Applies the same tags to every selected environment - a key that already exists has its values replaced wholesale, and keys that are not listed are left untouched # Bulk approve Source: https://docs.envzero.com/api-reference/bulk-operations/bulk-approve /api-reference/openapi.yml post /bulk-operations/approve # Bulk archive Source: https://docs.envzero.com/api-reference/bulk-operations/bulk-archive /api-reference/openapi.yml post /bulk-operations/archive # Bulk cancel queued deployments Source: https://docs.envzero.com/api-reference/bulk-operations/bulk-cancel-queued-deployments /api-reference/openapi.yml post /bulk-operations/cancel-queued-deployments # Bulk deploy Source: https://docs.envzero.com/api-reference/bulk-operations/bulk-deploy /api-reference/openapi.yml post /bulk-operations/deploy # Bulk deploy Source: https://docs.envzero.com/api-reference/bulk-operations/bulk-deploy-1 /api-reference/openapi.yml post /bulk-operations/cancel # Bulk destroy Source: https://docs.envzero.com/api-reference/bulk-operations/bulk-destroy /api-reference/openapi.yml post /bulk-operations/destroy # Bulk lock Source: https://docs.envzero.com/api-reference/bulk-operations/bulk-lock /api-reference/openapi.yml post /bulk-operations/lock # Bulk remove environment tags Source: https://docs.envzero.com/api-reference/bulk-operations/bulk-remove-environment-tags /api-reference/openapi.yml post /bulk-operations/remove-tags Removes the listed tag keys, values and all, from every selected environment - a key an environment does not carry is a no-op # Bulk run task Source: https://docs.envzero.com/api-reference/bulk-operations/bulk-run-task /api-reference/openapi.yml post /bulk-operations/run-task # Bulk unlock Source: https://docs.envzero.com/api-reference/bulk-operations/bulk-unlock /api-reference/openapi.yml post /bulk-operations/unlock # Get bulk operation Source: https://docs.envzero.com/api-reference/bulk-operations/get-bulk-operation /api-reference/openapi.yml get /bulk-operations/{operationId} Returns the per-environment status of a bulk operation - only the user who triggered it may read it # Check Which Cloud Compass Resources env zero Manages Source: https://docs.envzero.com/api-reference/cloud-compass/check-which-cloud-compass-resources-env-zero-manages /api-reference/openapi.yml post /cloud/assets/managed-status Returns the ids among those given that env zero manages. Reads only; POST because the id list can outgrow a query string. # Count Cloud Compass Insights Source: https://docs.envzero.com/api-reference/cloud-compass/count-cloud-compass-insights /api-reference/openapi.yml get /cloud/insights Returns insight counts by severity for the resources env zero manages, for the whole organization or per environment. # Count Cloud Compass Resources By Group Source: https://docs.envzero.com/api-reference/cloud-compass/count-cloud-compass-resources-by-group /api-reference/openapi.yml get /cloud/assets/counts Groups the organization's cloud resources by one dimension and returns each group's resource, drift and insight counts. # Count Cloud Compass Unmanaged Resources Per Environment Source: https://docs.envzero.com/api-reference/cloud-compass/count-cloud-compass-unmanaged-resources-per-environment /api-reference/openapi.yml get /cloud/unmanaged-attribution Returns, for each of the organization's live environments, how many cloud resources Cloud Compass attributes to it that env zero does not manage. # Create A Cloud Compass Management Rule Source: https://docs.envzero.com/api-reference/cloud-compass/create-a-cloud-compass-management-rule /api-reference/openapi.yml post /cloud/management-rules Creates a rule. A resource with no live env0 link that matches every condition reads Externally managed, including resources found later. # Create Cloud Account Source: https://docs.envzero.com/api-reference/cloud-compass/create-cloud-account /api-reference/openapi.yml post /cloud/configurations # Delete A Cloud Compass Management Rule Source: https://docs.envzero.com/api-reference/cloud-compass/delete-a-cloud-compass-management-rule /api-reference/openapi.yml delete /cloud/management-rules/{ruleId} Deletes a rule; its resources read Unmanaged again on the next read. The built-in rule cannot be deleted. # Delete Cloud Account Source: https://docs.envzero.com/api-reference/cloud-compass/delete-cloud-account /api-reference/openapi.yml delete /cloud/configurations/{id} # Export A Cloud Compass Resource List Source: https://docs.envzero.com/api-reference/cloud-compass/export-a-cloud-compass-resource-list /api-reference/openapi.yml post /cloud/resource-lists/exports Starts a CSV export of every row in a list that matches the filter and search, in the requested order. The inventory surface exports every Cloud Compass asset the filter matches. Poll the export for its download URL. # Find Cloud Account by id Source: https://docs.envzero.com/api-reference/cloud-compass/find-cloud-account-by-id /api-reference/openapi.yml get /cloud/configurations/{id} # Find Cloud Resources Source: https://docs.envzero.com/api-reference/cloud-compass/find-cloud-resources /api-reference/openapi.yml post /cloud/resources # Find Trends Data Source: https://docs.envzero.com/api-reference/cloud-compass/find-trends-data /api-reference/openapi.yml get /cloud/trends # Generate IaC for Cloud Resources Source: https://docs.envzero.com/api-reference/cloud-compass/generate-iac-for-cloud-resources /api-reference/openapi.yml post /cloud/resources/codify # Get A Cloud Compass Resource List Export Source: https://docs.envzero.com/api-reference/cloud-compass/get-a-cloud-compass-resource-list-export /api-reference/openapi.yml get /cloud/resource-lists/exports/{exportId} Returns whether the export is running, completed or failed, and once completed a short-lived download URL. # Get a link to resource's change event Source: https://docs.envzero.com/api-reference/cloud-compass/get-a-link-to-resources-change-event /api-reference/openapi.yml get /cloud/resources/events/{id} # Get Cloud Compass Insight Details Source: https://docs.envzero.com/api-reference/cloud-compass/get-cloud-compass-insight-details /api-reference/openapi.yml get /cloud/insights/{insightId} Returns one insight with its evidence, mitigation, silence and every affected resource with its environment. # Get Cloud Compass Project Tree Source: https://docs.envzero.com/api-reference/cloud-compass/get-cloud-compass-project-tree /api-reference/openapi.yml get /cloud/tree Returns the organization's project and environment tree, each environment's status, and its managed and drifted resource counts, rolled up every project level. With a filter or search, it returns only the environments with matching resources and the projects above them, each counting its matches. # Get Cloud Compass Resource Details Source: https://docs.envzero.com/api-reference/cloud-compass/get-cloud-compass-resource-details /api-reference/openapi.yml get /cloud/assets/{resourceType}/{platformId}/details Returns one cloud resource with whether env zero manages it, its drift, external id, environment and insights. # Get Cloud Compass Resource Graph Of An Environment Source: https://docs.envzero.com/api-reference/cloud-compass/get-cloud-compass-resource-graph-of-an-environment /api-reference/openapi.yml get /cloud/environments/{environmentId}/graph Returns the environment's cloud resources, managed first and then unmanaged, with their insights and owner, and the relationships between them. truncated says the graph is incomplete: the environment has more than 4,000 resources, or CloudQuery capped the relationships it returned. # Get Cloud Compass Resource Graph Of An Unmanaged Environment Source: https://docs.envzero.com/api-reference/cloud-compass/get-cloud-compass-resource-graph-of-an-unmanaged-environment /api-reference/openapi.yml get /cloud/unmanaged-environments/{unmanagedEnvironmentId}/graph Returns the cloud resources of the unmanaged environment that env zero does not manage, with their insights and owner, and the relationships between them. truncated says the graph is incomplete: the environment has more than 4,000 resources, or CloudQuery capped the relationships it returned. # Get Event By ID Source: https://docs.envzero.com/api-reference/cloud-compass/get-event-by-id /api-reference/openapi.yml get /cloud/events/{id} # Get Resource Events Source: https://docs.envzero.com/api-reference/cloud-compass/get-resource-events /api-reference/openapi.yml get /cloud/resources/{id}/events # Group A Cloud Compass Resource List Source: https://docs.envzero.com/api-reference/cloud-compass/group-a-cloud-compass-resource-list /api-reference/openapi.yml get /cloud/resource-lists/groups Returns one page of the values of a column in a resource list, each with how many resources hold it, and how many values there are. # List Cloud Compass Connected Resources Source: https://docs.envzero.com/api-reference/cloud-compass/list-cloud-compass-connected-resources /api-reference/openapi.yml get /cloud/assets/{resourceType}/{platformId}/related Returns the resources connected to this one, split into cloud resources and metadata about it, such as policies and activity events. truncated says the connections passed 4,000 and the rest were left out. # List Cloud Compass Filter Values Source: https://docs.envzero.com/api-reference/cloud-compass/list-cloud-compass-filter-values /api-reference/openapi.yml get /cloud/filters/{dimension}/values Returns the distinct values of one Cloud Compass filter dimension across the organization's cloud resources. # List Cloud Compass Insights Source: https://docs.envzero.com/api-reference/cloud-compass/list-cloud-compass-insights /api-reference/openapi.yml get /cloud/insights/list Returns the organization's insights that match the filter and title search, each with its resources, environments and silence, plus severity, resource, environment and silenced totals. Silenced resources are left out of the counts. truncated says CloudQuery held more than one read returns. # List Cloud Compass Managed Resources Of An Environment Source: https://docs.envzero.com/api-reference/cloud-compass/list-cloud-compass-managed-resources-of-an-environment /api-reference/openapi.yml get /cloud/environments/{environmentId}/managed-resources Returns one page of the resources the environment declares in IaC, with drift, insights, whether Cloud Compass finds it in the cloud, and the total. Terraform data sources are left out. # List Cloud Compass Management Rules Source: https://docs.envzero.com/api-reference/cloud-compass/list-cloud-compass-management-rules /api-reference/openapi.yml get /cloud/management-rules Lists the organization's rules that mark resources as externally managed, the built-in CloudFormation rule first, with how many resources each marks and suggested Managed by labels. # List Cloud Compass Orphaned Or Unattributed Resources Of A Project Source: https://docs.envzero.com/api-reference/cloud-compass/list-cloud-compass-orphaned-or-unattributed-resources-of-a-project /api-reference/openapi.yml get /cloud/resource-lists Returns one page of the cloud resources Cloud Compass places on the project that env zero does not manage: orphaned resources, whose environment is no longer live, or unattributed resources, linked to the project but to no environment. # List Cloud Compass Resources Source: https://docs.envzero.com/api-reference/cloud-compass/list-cloud-compass-resources /api-reference/openapi.yml get /cloud/assets Returns one page of the organization's cloud resources, with whether env zero manages each one and its insight counts. # List Cloud Compass Resources Of An Unmanaged Environment Source: https://docs.envzero.com/api-reference/cloud-compass/list-cloud-compass-resources-of-an-unmanaged-environment /api-reference/openapi.yml get /cloud/unmanaged-environments/{unmanagedEnvironmentId}/resources Returns one page of the cloud resources of the unmanaged environment that env zero does not manage, with the total, how many are attributed to it, and how many of those have a cloud resource. # List Cloud Compass Unmanaged Environments Source: https://docs.envzero.com/api-reference/cloud-compass/list-cloud-compass-unmanaged-environments /api-reference/openapi.yml get /cloud/unmanaged-environments Returns each unmanaged environment: a group of cloud resources that belong together and that env zero does not manage, with its owner and how many of its resources are unmanaged. Environments with no unmanaged resources are left out. # List Cloud Compass Unmanaged Resources In No Environment Source: https://docs.envzero.com/api-reference/cloud-compass/list-cloud-compass-unmanaged-resources-in-no-environment /api-reference/openapi.yml get /cloud/unmanaged/resources Returns one page of the cloud resources that belong to no env zero environment and no unmanaged environment, with the total. # List Cloud Compass Unmanaged Resources Of An Environment Source: https://docs.envzero.com/api-reference/cloud-compass/list-cloud-compass-unmanaged-resources-of-an-environment /api-reference/openapi.yml get /cloud/environments/{environmentId}/unmanaged-resources Returns one page of the cloud resources Cloud Compass attributes to the environment that env zero does not manage, with the total and how many are attributed. # List Environment State Resources Source: https://docs.envzero.com/api-reference/cloud-compass/list-environment-state-resources /api-reference/openapi.yml get /cloud/environments/{environmentId}/state-resources Returns the cloud resources from the latest state-updating deployment of an environment (Terraform/OpenTofu/Terragrunt only), including cloud join keys (cloudId, cloudCompassResourceId, region, accountId). # List Organization State Resources Source: https://docs.envzero.com/api-reference/cloud-compass/list-organization-state-resources /api-reference/openapi.yml get /cloud/state-resources Returns the cloud resources from the latest state-updating deployment of every environment in an organization (Terraform/OpenTofu/Terragrunt only), with each resource's environment id and cloud join keys (cloudId, cloudCompassResourceId, region, accountId). Resources are sorted by environment id, then logical name. When the page is full, the x-next-cursor response header holds the cursor of the next page. # List Organization's Cloud Accounts Source: https://docs.envzero.com/api-reference/cloud-compass/list-organizations-cloud-accounts /api-reference/openapi.yml get /cloud/configurations Returns all Cloud Accounts associated with an organization. # List The Values Of A Cloud Compass Resource List Column Source: https://docs.envzero.com/api-reference/cloud-compass/list-the-values-of-a-cloud-compass-resource-list-column /api-reference/openapi.yml get /cloud/resource-lists/values Returns up to 200 distinct values of a column in a resource list, for its filter. # Preview A Cloud Compass Management Rule Source: https://docs.envzero.com/api-reference/cloud-compass/preview-a-cloud-compass-management-rule /api-reference/openapi.yml post /cloud/management-rules/preview Counts the resources draft conditions would mark as externally managed and the env0-managed ones they match, and lists the first 20 it would mark. # Read Cloud Compass Metadata Rows Source: https://docs.envzero.com/api-reference/cloud-compass/read-cloud-compass-metadata-rows /api-reference/openapi.yml post /cloud/assets/{resourceType}/{platformId}/metadata-rows Returns the given resources' rows, keyed by platform id, without internal columns and empty values. Every row must be a resource connected to this one. The connections are read once per request. Reads only; POST because the row list can outgrow a query string. # Silence A Cloud Compass Insight Source: https://docs.envzero.com/api-reference/cloud-compass/silence-a-cloud-compass-insight /api-reference/openapi.yml post /cloud/insights/{insightId}/silence Silences the whole insight, or with environmentIds its current resources in those environments, until the given time or indefinitely. Returns the insight as it reads afterwards. # Test Cloud Account Source: https://docs.envzero.com/api-reference/cloud-compass/test-cloud-account /api-reference/openapi.yml post /cloud/configurations/{id}/test # Unsilence A Cloud Compass Insight Source: https://docs.envzero.com/api-reference/cloud-compass/unsilence-a-cloud-compass-insight /api-reference/openapi.yml delete /cloud/insights/{insightId}/silence Removes every silence on the insight. Returns the insight as it reads afterwards. # Update A Cloud Compass Management Rule Source: https://docs.envzero.com/api-reference/cloud-compass/update-a-cloud-compass-management-rule /api-reference/openapi.yml put /cloud/management-rules/{ruleId} Changes a rule's Managed by label, conditions or whether it is on. The built-in rule can only be switched on or off. # Update Cloud Account Source: https://docs.envzero.com/api-reference/cloud-compass/update-cloud-account /api-reference/openapi.yml put /cloud/configurations/{id} # Update Cloud Resources Source: https://docs.envzero.com/api-reference/cloud-compass/update-cloud-resources /api-reference/openapi.yml put /cloud/resources # Generate Code For Issue Source: https://docs.envzero.com/api-reference/code-optimizer-beta/generate-code-for-issue /api-reference/openapi.yml post /code-optimizer/issues/{id}/generate-code Trigger code generation for a specific issue # Get Issue Source: https://docs.envzero.com/api-reference/code-optimizer-beta/get-issue /api-reference/openapi.yml get /code-optimizer/issues/{id} Retrieve a single code issue with its relevant environments # Get Issues Source: https://docs.envzero.com/api-reference/code-optimizer-beta/get-issues /api-reference/openapi.yml get /code-optimizer/issues Retrieve code quality issues for an organization, optionally filtered by state # Get Latest Scan Status Source: https://docs.envzero.com/api-reference/code-optimizer-beta/get-latest-scan-status /api-reference/openapi.yml get /code-optimizer/scans/latest Get the overall scan status for all repositories in an organization, including the timestamp of the most recent completed scan # Get Repository States Source: https://docs.envzero.com/api-reference/code-optimizer-beta/get-repository-states /api-reference/openapi.yml get /code-optimizer/repository-states Retrieve scan status for all repositories in an organization, including error messages for failed scans # Ignore Issue Source: https://docs.envzero.com/api-reference/code-optimizer-beta/ignore-issue /api-reference/openapi.yml post /code-optimizer/issues/{id}/ignore Change issue state to IGNORED # Trigger Code Scan Source: https://docs.envzero.com/api-reference/code-optimizer-beta/trigger-code-scan /api-reference/openapi.yml post /code-optimizer/scans Trigger a static code analysis scan # Unignore Issue Source: https://docs.envzero.com/api-reference/code-optimizer-beta/unignore-issue /api-reference/openapi.yml post /code-optimizer/issues/{id}/unignore Change issue state back from IGNORED # Approve the plan of an AWS access setup Source: https://docs.envzero.com/api-reference/configuration/approve-the-plan-of-an-aws-access-setup /api-reference/openapi.yml post /aws-access-setups/{id}/approve # Assign sets to entity Source: https://docs.envzero.com/api-reference/configuration/assign-sets-to-entity /api-reference/openapi.yml post /configuration-sets/assignments/{scope}/{scopeId} # Associate credentials with project Source: https://docs.envzero.com/api-reference/configuration/associate-credentials-with-project /api-reference/openapi.yml put /credentials/deployment/{credentialId}/project/{projectId} Associate cloud provider, kubernetes or vault deployment credentials to Project # Cancel an AWS access setup Source: https://docs.envzero.com/api-reference/configuration/cancel-an-aws-access-setup /api-reference/openapi.yml post /aws-access-setups/{id}/cancel Cancels the setup deployment while it is queued or waiting for approval, so another setup can start. # Check a deployment credential against AWS Source: https://docs.envzero.com/api-reference/configuration/check-a-deployment-credential-against-aws /api-reference/openapi.yml post /aws-access-setups/check Signs in to the role of an AWS_OIDC or AWS_ASSUMED_ROLE_FOR_DEPLOYMENT credential with a read-only session. In Organization mode it also lists the OUs and active accounts the role can read. The OIDC token carries the organization's subject and audience only, and an assume-role credential of an organization with a self-hosted agent is not checked. # Create a Cloud Compass credential from a verified draft Source: https://docs.envzero.com/api-reference/configuration/create-a-cloud-compass-credential-from-a-verified-draft /api-reference/openapi.yml post /cloud-compass/credentials Creates the credential and its 4 CloudQuery syncs. A retry with the same draft is safe. Answers 409 when another credential covers the same AWS account or AWS Organization. # Create a configuration set Source: https://docs.envzero.com/api-reference/configuration/create-a-configuration-set /api-reference/openapi.yml post /configuration-sets # Create a git token Source: https://docs.envzero.com/api-reference/configuration/create-a-git-token /api-reference/openapi.yml post /tokens # Create a new SSH key Source: https://docs.envzero.com/api-reference/configuration/create-a-new-ssh-key /api-reference/openapi.yml post /ssh-keys # Create Credentials Source: https://docs.envzero.com/api-reference/configuration/create-credentials /api-reference/openapi.yml post /credentials Create a set of new cloud provider, kubernetes, vault or cost credentials for an Organization which may then be associated with a Project # Create or update an organization CloudQuery integration Source: https://docs.envzero.com/api-reference/configuration/create-or-update-an-organization-cloudquery-integration /api-reference/openapi.yml put /cloudquery-integrations Stores the CloudQuery API key (encrypted) and tenant slug. A single integration is kept per organization. # Create or update variable Source: https://docs.envzero.com/api-reference/configuration/create-or-update-variable /api-reference/openapi.yml post /configuration # Delete a Cloud Compass credential Source: https://docs.envzero.com/api-reference/configuration/delete-a-cloud-compass-credential /api-reference/openapi.yml delete /cloud-compass/credentials/{id} Deletes the 4 CloudQuery syncs, then the credential. The synced data stays in CloudQuery. Also removes a create that did not finish. Answers 503 when CloudQuery cannot delete all the syncs; env0 then keeps the credential for a retry, but some syncs may already be deleted. Answers 409 or 424 when CloudQuery is not connected or rejects the stored key; reconnect CloudQuery, then delete again. # Delete a configuration set Source: https://docs.envzero.com/api-reference/configuration/delete-a-configuration-set /api-reference/openapi.yml delete /configuration-sets/{id} # Delete a git token Source: https://docs.envzero.com/api-reference/configuration/delete-a-git-token /api-reference/openapi.yml delete /tokens/{id} # Delete a variable Source: https://docs.envzero.com/api-reference/configuration/delete-a-variable /api-reference/openapi.yml delete /configuration/{id} # Delete an organization CloudQuery integration Source: https://docs.envzero.com/api-reference/configuration/delete-an-organization-cloudquery-integration /api-reference/openapi.yml delete /cloudquery-integrations/{id} Removes the organization CloudQuery integration. # Delete Credentials Source: https://docs.envzero.com/api-reference/configuration/delete-credentials /api-reference/openapi.yml delete /credentials/{id} # Delete SSH key Source: https://docs.envzero.com/api-reference/configuration/delete-ssh-key /api-reference/openapi.yml delete /ssh-keys/{id} # Discard a Cloud Compass credential wizard draft Source: https://docs.envzero.com/api-reference/configuration/discard-a-cloud-compass-credential-wizard-draft /api-reference/openapi.yml delete /cloud-compass/drafts/{id} # Dissociate credentials with project Source: https://docs.envzero.com/api-reference/configuration/dissociate-credentials-with-project /api-reference/openapi.yml delete /credentials/deployment/{credentialId}/project/{projectId} Dissociate cloud provider, kubernetes or vault deployment credentials with Project # Edit the role ARN, External ID or OUs of a Cloud Compass credential Source: https://docs.envzero.com/api-reference/configuration/edit-the-role-arn-external-id-or-ous-of-a-cloud-compass-credential /api-reference/openapi.yml patch /cloud-compass/credentials/{id} Returns 202 at once with the pending edit. Poll GET cloud-compass/credentials/{id}: when every CloudQuery test passes, env0 updates the same 4 syncs and the credential; when one fails, nothing changes. Answers 400 for a role in another AWS account, and 409 while a create or an earlier edit is still being applied. # Find sets assigned to scope Source: https://docs.envzero.com/api-reference/configuration/find-sets-assigned-to-scope /api-reference/openapi.yml get /configuration-sets/assignments/{scope}/{scopeId} # For creating or updating log forwarding configuration Source: https://docs.envzero.com/api-reference/configuration/for-creating-or-updating-log-forwarding-configuration /api-reference/openapi.yml put /log-forwarding/configurations Log forwarding configuration is used to forward logs to external services # For deleting log forwarding configuration Source: https://docs.envzero.com/api-reference/configuration/for-deleting-log-forwarding-configuration /api-reference/openapi.yml delete /log-forwarding/configurations/{id} # For finding log forwarding configuration Source: https://docs.envzero.com/api-reference/configuration/for-finding-log-forwarding-configuration /api-reference/openapi.yml get /log-forwarding/configurations # Get a Cloud Compass credential with its features and syncs Source: https://docs.envzero.com/api-reference/configuration/get-a-cloud-compass-credential-with-its-features-and-syncs /api-reference/openapi.yml get /cloud-compass/credentials/{id} Returns the 3 features, the status and last run of each of the 4 syncs, read from CloudQuery on each call. While an edit is open, each call reads its tests and returns it as pendingEdit; once every test passed, the call applies the edit to the same 4 syncs and the credential. # Get a Cloud Compass credential wizard draft Source: https://docs.envzero.com/api-reference/configuration/get-a-cloud-compass-credential-wizard-draft /api-reference/openapi.yml get /cloud-compass/drafts/{id} Returns the draft status and the stack outputs. A guided draft with no callback after 60 minutes shows as failed. # Get an AWS access setup Source: https://docs.envzero.com/api-reference/configuration/get-an-aws-access-setup /api-reference/openapi.yml get /aws-access-setups/{id} Returns where the setup environment is: planning, waiting for approval, applying, done or failed. # Get an organization CloudQuery integration Source: https://docs.envzero.com/api-reference/configuration/get-an-organization-cloudquery-integration /api-reference/openapi.yml get /cloudquery-integrations Returns the organization CloudQuery integration without its secret value, or null when none is configured. # Get configuration set by its ID Source: https://docs.envzero.com/api-reference/configuration/get-configuration-set-by-its-id /api-reference/openapi.yml get /configuration-sets/{id} # Get git token by id Source: https://docs.envzero.com/api-reference/configuration/get-git-token-by-id /api-reference/openapi.yml get /tokens/{id} # Get the log of the last run of a Cloud Compass sync Source: https://docs.envzero.com/api-reference/configuration/get-the-log-of-the-last-run-of-a-cloud-compass-sync /api-reference/openapi.yml get /cloud-compass/credentials/{id}/logs Reads the newest 500 log lines of the latest run from CloudQuery; env0 stores no logs. Answers 503 when CloudQuery does not answer. # Get what an AWS deploy role trusts Source: https://docs.envzero.com/api-reference/configuration/get-what-an-aws-deploy-role-trusts /api-reference/openapi.yml get /aws-access-setups/trust Returns env zero's AWS account and the External ID, for a deploy role that env zero signs in to by assume role. # List all available SSH keys Source: https://docs.envzero.com/api-reference/configuration/list-all-available-ssh-keys /api-reference/openapi.yml get /ssh-keys # List deployment credentials by project id Source: https://docs.envzero.com/api-reference/configuration/list-deployment-credentials-by-project-id /api-reference/openapi.yml get /credentials/deployment/project/{projectId} List deployment credentials by project id # List git tokens Source: https://docs.envzero.com/api-reference/configuration/list-git-tokens /api-reference/openapi.yml get /tokens # List Organization credentials Source: https://docs.envzero.com/api-reference/configuration/list-organization-credentials /api-reference/openapi.yml get /credentials # List Sets created by Scope Source: https://docs.envzero.com/api-reference/configuration/list-sets-created-by-scope /api-reference/openapi.yml get /configuration-sets # List the Cloud Compass credentials and open drafts of an organization Source: https://docs.envzero.com/api-reference/configuration/list-the-cloud-compass-credentials-and-open-drafts-of-an-organization /api-reference/openapi.yml get /cloud-compass/credentials Reads the sync status from CloudQuery on each call; it is unknown when CloudQuery does not answer. Disconnected means the last 2 runs of every sync failed before reading a row. A create that stopped in the middle shows as setup_not_finished, with its draftId while the draft can still be retried. # List the OUs and accounts of a Cloud Compass credential AWS Organization Source: https://docs.envzero.com/api-reference/configuration/list-the-ous-and-accounts-of-a-cloud-compass-credential-aws-organization /api-reference/openapi.yml get /cloud-compass/credentials/{id}/organizational-units Organization mode only. CloudQuery reads the OU tree with the management account role of the credential. # List the OUs and accounts of a Cloud Compass draft AWS Organization Source: https://docs.envzero.com/api-reference/configuration/list-the-ous-and-accounts-of-a-cloud-compass-draft-aws-organization /api-reference/openapi.yml get /cloud-compass/drafts/{id}/organizational-units Organization mode only. CloudQuery reads the OU tree with the management account role of the draft. Answers 409 until the draft has that role. # List Variables by Scope Source: https://docs.envzero.com/api-reference/configuration/list-variables-by-scope /api-reference/openapi.yml get /configuration Lists all variables for the provided scope(s). If more than one scope is given - variables will be overridden by lower level scopes - just like env zero does. For example - Provided both organizationId and projectId, if a variable exists on both scopes, a single instance of it will be returned, with its Project scope value # Query configuration variable by id Source: https://docs.envzero.com/api-reference/configuration/query-configuration-variable-by-id /api-reference/openapi.yml get /configuration/{id} # Retry a failed AWS access setup Source: https://docs.envzero.com/api-reference/configuration/retry-a-failed-aws-access-setup /api-reference/openapi.yml post /aws-access-setups/{id}/retry Reads the outputs again when only that failed; otherwise deploys the environment again, with new member accounts when given. The plan waits for approval. # Set up AWS access through an env zero environment Source: https://docs.envzero.com/api-reference/configuration/set-up-aws-access-through-an-env-zero-environment /api-reference/openapi.yml post /aws-access-setups Creates a Cloud Compass draft, the "env zero setup" project and an "env zero aws roles" environment, and deploys it with the given deployment credential. The plan waits for approval. # Start a Cloud Compass credential wizard draft Source: https://docs.envzero.com/api-reference/configuration/start-a-cloud-compass-credential-wizard-draft /api-reference/openapi.yml post /cloud-compass/drafts Creates a draft with an External ID and a one-time callback token, and returns the CloudFormation quick-create link and commands, and the OpenTofu module call. # Start the CloudQuery test connections of a Cloud Compass draft Source: https://docs.envzero.com/api-reference/configuration/start-the-cloudquery-test-connections-of-a-cloud-compass-draft /api-reference/openapi.yml post /cloud-compass/drafts/{id}/verify Returns 202 at once. Poll GET cloud-compass/drafts/{id} for the result per feature. Manual verify sends the role ARN and the CUR outputs; guided verify uses the stack outputs. # Unassign sets from entity Source: https://docs.envzero.com/api-reference/configuration/unassign-sets-from-entity /api-reference/openapi.yml delete /configuration-sets/assignments/{scope}/{scopeId} # Update a configuration set Source: https://docs.envzero.com/api-reference/configuration/update-a-configuration-set /api-reference/openapi.yml put /configuration-sets/{id} # Update an existing SSH key Source: https://docs.envzero.com/api-reference/configuration/update-an-existing-ssh-key /api-reference/openapi.yml put /ssh-keys/{id} # Update Credentials Source: https://docs.envzero.com/api-reference/configuration/update-credentials /api-reference/openapi.yml patch /credentials/{id} Update deployment credentials or cost credentials for an organization # Associate Cost Credentials with Project Source: https://docs.envzero.com/api-reference/cost/associate-cost-credentials-with-project /api-reference/openapi.yml put /costs/project/{projectId}/credentials Associate Cloud provider Cost Credentials to a Project. This will enable cost tagging in deployments in the project. # Dissociate Cost Credentials from Project Source: https://docs.envzero.com/api-reference/cost/dissociate-cost-credentials-from-project /api-reference/openapi.yml delete /costs/project/{projectId}/credentials/{credentialsId} Dissociate Cloud provider Cost Credentials to a Project. This will disable cost tagging in deployments in the project. # Get a project's accumulated costs Source: https://docs.envzero.com/api-reference/cost/get-a-projects-accumulated-costs /api-reference/openapi.yml get /costs/budget/accumulated # Get a project's budget Source: https://docs.envzero.com/api-reference/cost/get-a-projects-budget /api-reference/openapi.yml get /costs/project/{projectId}/budget # Get costs for a Project Source: https://docs.envzero.com/api-reference/cost/get-costs-for-a-project /api-reference/openapi.yml get /costs/projects/{projectId} # Get costs for an Environment Source: https://docs.envzero.com/api-reference/cost/get-costs-for-an-environment /api-reference/openapi.yml get /costs/environments/{environmentId} # Get costs for an Organization Source: https://docs.envzero.com/api-reference/cost/get-costs-for-an-organization /api-reference/openapi.yml get /costs # Get projects' budget summary of the current period Source: https://docs.envzero.com/api-reference/cost/get-projects-budget-summary-of-the-current-period /api-reference/openapi.yml get /costs/budget/summary # Get weekly costs for projects or environments Source: https://docs.envzero.com/api-reference/cost/get-weekly-costs-for-projects-or-environments /api-reference/openapi.yml get /costs/weekly # List Cost Credentials associated to Project Source: https://docs.envzero.com/api-reference/cost/list-cost-credentials-associated-to-project /api-reference/openapi.yml get /costs/project/{projectId}/credentials # List projects with cost credentials associated to organization Source: https://docs.envzero.com/api-reference/cost/list-projects-with-cost-credentials-associated-to-organization /api-reference/openapi.yml get /costs/projects/enabled # Remove a project's budget Source: https://docs.envzero.com/api-reference/cost/remove-a-projects-budget /api-reference/openapi.yml delete /costs/project/{projectId}/budget # Return wether or not cost is enabled for a project Source: https://docs.envzero.com/api-reference/cost/return-wether-or-not-cost-is-enabled-for-a-project /api-reference/openapi.yml get /costs/project/{projectId}/enabled # Upsert a project's budget Source: https://docs.envzero.com/api-reference/cost/upsert-a-projects-budget /api-reference/openapi.yml put /costs/project/{projectId}/budget # Create API Key Source: https://docs.envzero.com/api-reference/credentials/create-api-key /api-reference/openapi.yml post /api-keys # Create personal API Key Source: https://docs.envzero.com/api-reference/credentials/create-personal-api-key /api-reference/openapi.yml post /personal-api-keys # Delete a User's personal API Key endpoint Source: https://docs.envzero.com/api-reference/credentials/delete-a-users-personal-api-key-endpoint /api-reference/openapi.yml delete /personal-api-keys/{id} # Delete an API Key Source: https://docs.envzero.com/api-reference/credentials/delete-an-api-key /api-reference/openapi.yml delete /api-keys/{id} # List Organization API Keys Source: https://docs.envzero.com/api-reference/credentials/list-organization-api-keys /api-reference/openapi.yml get /api-keys # List User's personal API Keys endpoint Source: https://docs.envzero.com/api-reference/credentials/list-users-personal-api-keys-endpoint /api-reference/openapi.yml get /personal-api-keys # Update a personal API Key IP allowlist Source: https://docs.envzero.com/api-reference/credentials/update-a-personal-api-key-ip-allowlist /api-reference/openapi.yml put /personal-api-keys/{id}/ip-allowlist # Update an API Key IP allowlist Source: https://docs.envzero.com/api-reference/credentials/update-an-api-key-ip-allowlist /api-reference/openapi.yml put /api-keys/{id}/ip-allowlist # Assign Custom Flow Source: https://docs.envzero.com/api-reference/custom-flow/assign-custom-flow /api-reference/openapi.yml post /custom-flow/assign # Create Custom Flow Source: https://docs.envzero.com/api-reference/custom-flow/create-custom-flow /api-reference/openapi.yml post /custom-flow # Delete Custom Flow Source: https://docs.envzero.com/api-reference/custom-flow/delete-custom-flow /api-reference/openapi.yml delete /custom-flow/{id} # Find Custom Flows Source: https://docs.envzero.com/api-reference/custom-flow/find-custom-flows /api-reference/openapi.yml get /custom-flows # Get Custom Flow Assignments Source: https://docs.envzero.com/api-reference/custom-flow/get-custom-flow-assignments /api-reference/openapi.yml post /custom-flow/get-assignments # Unassign Custom Flow Source: https://docs.envzero.com/api-reference/custom-flow/unassign-custom-flow /api-reference/openapi.yml post /custom-flow/unassign # Update Custom Flow Source: https://docs.envzero.com/api-reference/custom-flow/update-custom-flow /api-reference/openapi.yml put /custom-flow # Get query result Source: https://docs.envzero.com/api-reference/dashboard/get-query-result /api-reference/openapi.yml get /dashboards # Find all steps by Deployment Id Source: https://docs.envzero.com/api-reference/deployment-logs/find-all-steps-by-deployment-id /api-reference/openapi.yml get /deployments/{deploymentLogId}/steps # Get logs for specific step Source: https://docs.envzero.com/api-reference/deployment-logs/get-logs-for-specific-step /api-reference/openapi.yml get /deployments/{deploymentLogId}/steps/{name}/log # Get Drift Causes Source: https://docs.envzero.com/api-reference/drift/get-drift-causes /api-reference/openapi.yml get /drift-causes # Get Drift Fix Stats Source: https://docs.envzero.com/api-reference/drift/get-drift-fix-stats /api-reference/openapi.yml get /drift-causes/fix-stats # Get Ignored Drift Causes Source: https://docs.envzero.com/api-reference/drift/get-ignored-drift-causes /api-reference/openapi.yml get /drift-causes/ignored # Ignore Drift Cause Source: https://docs.envzero.com/api-reference/drift/ignore-drift-cause /api-reference/openapi.yml post /drift-causes/{causeId}/ignore # Un-ignore Drift Cause Source: https://docs.envzero.com/api-reference/drift/un-ignore-drift-cause /api-reference/openapi.yml post /drift-causes/{causeId}/un-ignore # Connect to migration source Source: https://docs.envzero.com/api-reference/environment-import/connect-to-migration-source /api-reference/openapi.yml post /environment-import/source/connect # Delete a migration session Source: https://docs.envzero.com/api-reference/environment-import/delete-a-migration-session /api-reference/openapi.yml delete /environment-import/source/sessions/{sessionId} # Discover Unimported Environments Source: https://docs.envzero.com/api-reference/environment-import/discover-unimported-environments /api-reference/openapi.yml post /environment-import/discover # Find Discovered Environments Source: https://docs.envzero.com/api-reference/environment-import/find-discovered-environments /api-reference/openapi.yml get /environment-import/discovered # Find Selection Issues Source: https://docs.envzero.com/api-reference/environment-import/find-selection-issues /api-reference/openapi.yml post /environment-import/source/sessions/{sessionId}/issues Missing secrets, VCS connections and remote backend workspace names an env0 environment already holds, for the given workspaces. The JSON body is required: send {} to cover every workspace that can still be selected. # Finish a migration session Source: https://docs.envzero.com/api-reference/environment-import/finish-a-migration-session /api-reference/openapi.yml put /environment-import/source/sessions/{sessionId}/finish # Get a migration session by ID Source: https://docs.envzero.com/api-reference/environment-import/get-a-migration-session-by-id /api-reference/openapi.yml get /environment-import/source/sessions/{sessionId} # Get active migration session for an organization Source: https://docs.envzero.com/api-reference/environment-import/get-active-migration-session-for-an-organization /api-reference/openapi.yml get /environment-import/source/sessions/active # Get migration inventory for a session Source: https://docs.envzero.com/api-reference/environment-import/get-migration-inventory-for-a-session /api-reference/openapi.yml get /environment-import/source/sessions/{sessionId}/inventory # Get migration results for a session Source: https://docs.envzero.com/api-reference/environment-import/get-migration-results-for-a-session /api-reference/openapi.yml get /environment-import/source/sessions/{sessionId}/results # Go live — lock TFC workspaces and unlock env zero environments Source: https://docs.envzero.com/api-reference/environment-import/go-live-—-lock-tfc-workspaces-and-unlock-env-zero-environments /api-reference/openapi.yml post /environment-import/source/sessions/{sessionId}/go-live # Import Discovered Environments Source: https://docs.envzero.com/api-reference/environment-import/import-discovered-environments /api-reference/openapi.yml post /environment-import/batch # Rerun environments which failed to import Source: https://docs.envzero.com/api-reference/environment-import/rerun-environments-which-failed-to-import /api-reference/openapi.yml post /environment-import/rerun # Skip or unskip a workspace Source: https://docs.envzero.com/api-reference/environment-import/skip-or-unskip-a-workspace /api-reference/openapi.yml put /environment-import/source/sessions/{sessionId}/workspaces/{workspaceId}/skip # Start migration for selected workspaces Source: https://docs.envzero.com/api-reference/environment-import/start-migration-for-selected-workspaces /api-reference/openapi.yml post /environment-import/source/sessions/{sessionId}/migrate # Trigger scan of migration source organization Source: https://docs.envzero.com/api-reference/environment-import/trigger-scan-of-migration-source-organization /api-reference/openapi.yml post /environment-import/source/sessions/{sessionId}/scan # Update variable set secrets Source: https://docs.envzero.com/api-reference/environment-import/update-variable-set-secrets /api-reference/openapi.yml patch /environment-import/source/sessions/{sessionId}/variable-sets/{variableSetId}/secrets # Update workspace secrets Source: https://docs.envzero.com/api-reference/environment-import/update-workspace-secrets /api-reference/openapi.yml patch /environment-import/source/sessions/{sessionId}/workspaces/{workspaceId}/secrets # Create and update environment state access configuration Source: https://docs.envzero.com/api-reference/environment-outputs/create-and-update-environment-state-access-configuration /api-reference/openapi.yml put /environment-state/{environmentId}/access-control Creates and update configuration describing which environments, or projects in the organization may access a given environment's state # Delete environment state access configuration Source: https://docs.envzero.com/api-reference/environment-outputs/delete-environment-state-access-configuration /api-reference/openapi.yml delete /environment-state/{environmentId}/access-control Deletes an existing environment state access configuration # Get environment state access configuration Source: https://docs.envzero.com/api-reference/environment-outputs/get-environment-state-access-configuration /api-reference/openapi.yml get /environment-state/{environmentId}/access-control Describe which environments, or projects in the organization may access a given environment's state # Abort Deployment Source: https://docs.envzero.com/api-reference/environments/abort-deployment /api-reference/openapi.yml post /environments/deployments/{id}/abort # Batch Cancel Deployments Source: https://docs.envzero.com/api-reference/environments/batch-cancel-deployments /api-reference/openapi.yml put /environments/{id}/deployments/cancel # Cancel Deployment Source: https://docs.envzero.com/api-reference/environments/cancel-deployment /api-reference/openapi.yml put /environments/deployments/{id}/cancel # Check Environment meets Project limits Source: https://docs.envzero.com/api-reference/environments/check-environment-meets-project-limits /api-reference/openapi.yml get /policies/limits/check # Count Environments Source: https://docs.envzero.com/api-reference/environments/count-environments /api-reference/openapi.yml get /environments/count # Counts all selected statuses of organization projects Source: https://docs.envzero.com/api-reference/environments/counts-all-selected-statuses-of-organization-projects /api-reference/openapi.yml get /environments/statuses/counts # Create an Environment Without Template Source: https://docs.envzero.com/api-reference/environments/create-an-environment-without-template /api-reference/openapi.yml post /environments/without-template # Create Environment Source: https://docs.envzero.com/api-reference/environments/create-environment /api-reference/openapi.yml post /environments # Create or Update Workflow Trigger Source: https://docs.envzero.com/api-reference/environments/create-or-update-workflow-trigger /api-reference/openapi.yml put /environments/{id}/downstream Env0 allows you to configure chained dependent environments to your current environment. Using workflow triggers, you can define which environments would trigger a deployment downstream in response to a deployment of your current environment. This allows you to configure a cascading series of environment deployments." More on https://docs.envzero.com/docs/workflow-triggers # Deploy Environment Source: https://docs.envzero.com/api-reference/environments/deploy-environment /api-reference/openapi.yml post /environments/{id}/deployments # Destroy Environment Source: https://docs.envzero.com/api-reference/environments/destroy-environment /api-reference/openapi.yml post /environments/{id}/destroy # Download Deployment Plan JSON Source: https://docs.envzero.com/api-reference/environments/download-deployment-plan-json /api-reference/openapi.yml get /environments/deployments/{id}/plan-json Downloads the complete Terraform/OpenTofu plan JSON (the output of 'show -json') of the given deployment, including resources with no changes - unlike the parsed plan returned by 'GET /environments/deployments/{id}?fields=plan', which contains only changed resources. Intended for external policy evaluation (for example Checkov). Responses: * 302 (default) - the 'Location' header holds a short-lived (5 minutes) signed download URL. Follow the redirect to download the file, for example with 'curl -L'. * 200 - only when 'redirect=false' is passed: the same signed URL is returned as a JSON body ({ "url": "..." }) instead of a redirect. Browser clients should prefer this, since following the 302 with a cross-origin request that carries custom headers triggers a CORS preflight against the storage bucket. * 404 - the deployment does not exist, or no plan JSON is available for it (see below). * 403 - the caller is not allowed to view the deployment's environment. NOTE: the generated schema below documents only the 200 response body; the default response of this endpoint is the 302 described above. Sensitive values are masked with Terraform's placeholders: '(sensitive value)', '(sensitive value changed)' when the value changes, and '(sensitive default value)' for variable defaults. Values of sensitive env zero variables are redacted. Expect masked placeholders rather than real secrets in the file. A plan JSON is available only when all of the following hold, otherwise the endpoint returns 404: * the deployment is a deploy, destroy, or dry run - drift detection, PR plan and remote plan deployments do not produce one * the template is Terraform, OpenTofu or Terragrunt (Terragrunt run-all is not supported) * the deployment reached and completed its plan step * the deployment ran on an agent version that supports the feature (self-hosted agents may need an upgrade) * the deployment is less than 30 days old - plan JSON files are retained for 30 days and then deleted # Find deployment drift status Source: https://docs.envzero.com/api-reference/environments/find-deployment-drift-status /api-reference/openapi.yml get /environments/deployments/{id}/drift-status # Get a drifted resource's event details Source: https://docs.envzero.com/api-reference/environments/get-a-drifted-resources-event-details /api-reference/openapi.yml get /environments/deployments/{id}/resources/{resourceId}/events/{eventId} # Get a drifted resource's events Source: https://docs.envzero.com/api-reference/environments/get-a-drifted-resources-events /api-reference/openapi.yml get /environments/deployments/{id}/resources/{resourceId}/{resourceType}/events # Get Deployment Source: https://docs.envzero.com/api-reference/environments/get-deployment /api-reference/openapi.yml get /environments/deployments/{id} # Get downstream environments that will be triggered by this environment deployment Source: https://docs.envzero.com/api-reference/environments/get-downstream-environments-that-will-be-triggered-by-this-environment-deployment /api-reference/openapi.yml get /environments/{id}/downstream # Get Environment Source: https://docs.envzero.com/api-reference/environments/get-environment /api-reference/openapi.yml get /environments/{id} # Get Environments Outputs Source: https://docs.envzero.com/api-reference/environments/get-environments-outputs /api-reference/openapi.yml get /environment-outputs # Get Environments With Outputs Source: https://docs.envzero.com/api-reference/environments/get-environments-with-outputs /api-reference/openapi.yml get /environment-outputs/by-environment List the output names of every environment whose outputs the project may use. Pass sourceProjectId or environmentId to return only that project or environment # Get Plan Impact For Deployments Source: https://docs.envzero.com/api-reference/environments/get-plan-impact-for-deployments /api-reference/openapi.yml get /environments/deployments/plan-impact Returns, per deployment id, how many resources its stored plan would create, update, delete, recreate or only change in state, plus the destructive changes it would make. Reads the plan already stored for the deployment; it runs no new plan. A recreate is destructive and is also counted under 'recreate'. 'metadata' counts resources whose state changes but whose infrastructure does not (a move or an import), and never appears in 'destructive'. 'forget' counts resources removed from state while the cloud object is kept, including a create that forgets the previous object, which is also counted under 'create' - so the counts can add up to more than the number of resources. A forget is never destructive. 'destructive' is capped at 50 entries; 'destructiveTotal' is the true count and 'destructiveTypeCounts' covers every destructive change, not just the returned ones. 'planReadable' is false when no readable plan is stored, in which case every count is absent rather than zero. A legacy deployment that stored only a plan summary is readable but partial: it carries 'create', 'update', 'delete' and 'destructiveTotal', carries 'forget' only when the summary recorded it, and omits 'recreate', 'metadata', 'destructive' and 'destructiveTypeCounts', so read each field for presence rather than inferring it from 'planReadable'. Deployments the caller may not view are absent from the response. At most 200 ids per request. # Get Projects With Outputs Source: https://docs.envzero.com/api-reference/environments/get-projects-with-outputs /api-reference/openapi.yml get /environment-outputs/projects List the projects whose environment outputs the project may use # Get Sub Deployment Log In A Workflow By Workflow Deployment Id And Environment Id Source: https://docs.envzero.com/api-reference/environments/get-sub-deployment-log-in-a-workflow-by-workflow-deployment-id-and-environment-id /api-reference/openapi.yml get /workflow-deployments/{workflowDeploymentId}/sub-environments/{subEnvironmentId}/deployment # List Deployment Resources Source: https://docs.envzero.com/api-reference/environments/list-deployment-resources /api-reference/openapi.yml get /environments/deployments/{id}/resources # List Deployments Source: https://docs.envzero.com/api-reference/environments/list-deployments /api-reference/openapi.yml get /environments/{id}/deployments # List Environment Tags Source: https://docs.envzero.com/api-reference/environments/list-environment-tags /api-reference/openapi.yml get /environments/tags Returns every tag key on the organization's environments that the caller may view, mapped to its distinct values # List Environments Source: https://docs.envzero.com/api-reference/environments/list-environments /api-reference/openapi.yml get /environments # Lock/Unlock environment Source: https://docs.envzero.com/api-reference/environments/lockunlock-environment /api-reference/openapi.yml put /environments/{id}/lock # Move Environment between Projects Source: https://docs.envzero.com/api-reference/environments/move-environment-between-projects /api-reference/openapi.yml post /environments/{id}/move # Remediate Drift Deployment Source: https://docs.envzero.com/api-reference/environments/remediate-drift-deployment /api-reference/openapi.yml post /environments/deployments/{id}/remediate-drift Remediate a drifted environment, using a drift detection deployment ID # Rerun PR plan Source: https://docs.envzero.com/api-reference/environments/rerun-pr-plan /api-reference/openapi.yml post /environments/deployments/{id}/rerun # Resume Deployment Source: https://docs.envzero.com/api-reference/environments/resume-deployment /api-reference/openapi.yml put /environments/deployments/{id} # Returns an organization's monthly-runs limit and, for run-limited orgs only, its count of successful deploy, destroy and drift-detection runs this month (count is null for uncapped orgs) Source: https://docs.envzero.com/api-reference/environments/returns-an-organizations-monthly-runs-limit-and-for-run-limited-orgs-only-its-count-of-successful-deploy-destroy-and-drift-detection-runs-this-month-count-is-null-for-uncapped-orgs /api-reference/openapi.yml get /environments/runs-usage # Save VCS environment as a template Source: https://docs.envzero.com/api-reference/environments/save-vcs-environment-as-a-template /api-reference/openapi.yml put /environments/{id}/template # Scan for Drift Events Source: https://docs.envzero.com/api-reference/environments/scan-for-drift-events /api-reference/openapi.yml post /environments/deployments/{id}/drift-scan # Subscribe environments as workflow-trigger Source: https://docs.envzero.com/api-reference/environments/subscribe-environments-as-workflow-trigger /api-reference/openapi.yml post /environments/{id}/downstream/subscribe # Unsubscribe environments as workflow-trigger Source: https://docs.envzero.com/api-reference/environments/unsubscribe-environments-as-workflow-trigger /api-reference/openapi.yml post /environments/{id}/downstream/unsubscribe # Update Environment Source: https://docs.envzero.com/api-reference/environments/update-environment /api-reference/openapi.yml put /environments/{id} # Update Environment Tags Source: https://docs.envzero.com/api-reference/environments/update-environment-tags /api-reference/openapi.yml put /environments/{id}/tags Applies a JSON merge-patch (RFC 7396) to the environment's tags - a non-empty array replaces that key's values wholesale, null removes the key, and keys that are not mentioned are left untouched # Update Environment TTL Source: https://docs.envzero.com/api-reference/environments/update-environment-ttl /api-reference/openapi.yml put /environments/{id}/ttl # Create module Source: https://docs.envzero.com/api-reference/modules/create-module /api-reference/openapi.yml post /modules # Delete module Source: https://docs.envzero.com/api-reference/modules/delete-module /api-reference/openapi.yml delete /modules/{id} # Get module Source: https://docs.envzero.com/api-reference/modules/get-module /api-reference/openapi.yml get /modules/{id} # Get Module README Source: https://docs.envzero.com/api-reference/modules/get-module-readme /api-reference/openapi.yml get /modules/{id}/versions/{releaseId} Returns the Module README.md file content from a specific version # Get Module Test Run by ID Source: https://docs.envzero.com/api-reference/modules/get-module-test-run-by-id /api-reference/openapi.yml get /module/tests/{testRunId} # Get Module Usage Source: https://docs.envzero.com/api-reference/modules/get-module-usage /api-reference/openapi.yml get /module-usage Returns the active environments that use a module source, grouped by version, newest first. Counts include environments you may not view, and hiddenEnvironmentCount says how many they are. Only environments you may view are listed. # List Module Test Runs Source: https://docs.envzero.com/api-reference/modules/list-module-test-runs /api-reference/openapi.yml get /module/{moduleId}/tests # List Module Usage Sources Source: https://docs.envzero.com/api-reference/modules/list-module-usage-sources /api-reference/openapi.yml get /module-usage/sources Returns the module sources used by active environments of an organization, with the number of environments overall and at each version, newest version first. Counts include environments you may not view. Subdirectories of a module source are counted under the source itself. # List Module Versions Source: https://docs.envzero.com/api-reference/modules/list-module-versions /api-reference/openapi.yml get /modules/{id}/versions Returns all versions of the module. # List Modules Source: https://docs.envzero.com/api-reference/modules/list-modules /api-reference/openapi.yml get /modules Returns all modules associated with an organization. # Trigger Module Test Run Source: https://docs.envzero.com/api-reference/modules/trigger-module-test-run /api-reference/openapi.yml post /module/{moduleId}/test # Update module Source: https://docs.envzero.com/api-reference/modules/update-module /api-reference/openapi.yml patch /modules/{id} # Create Notification Endpoint Source: https://docs.envzero.com/api-reference/notifications/create-notification-endpoint /api-reference/openapi.yml post /notifications/endpoints # Delete Notification Endpoint Source: https://docs.envzero.com/api-reference/notifications/delete-notification-endpoint /api-reference/openapi.yml delete /notifications/endpoints/{endpointId} # Get Notification Endpoint settings Source: https://docs.envzero.com/api-reference/notifications/get-notification-endpoint-settings /api-reference/openapi.yml get /notifications/projects/{projectId} # List Notification Endpoints Source: https://docs.envzero.com/api-reference/notifications/list-notification-endpoints /api-reference/openapi.yml get /notifications/endpoints # Test webhook notification target Source: https://docs.envzero.com/api-reference/notifications/test-webhook-notification-target /api-reference/openapi.yml post /notifications/endpoints/{endpointId}/test # Update Notification Endpoint Source: https://docs.envzero.com/api-reference/notifications/update-notification-endpoint /api-reference/openapi.yml patch /notifications/endpoints/{endpointId} # Update Notification Settings Source: https://docs.envzero.com/api-reference/notifications/update-notification-settings /api-reference/openapi.yml put /notifications/projects/{projectId}/endpoints/{endpointId} # Create a new Organization Source: https://docs.envzero.com/api-reference/organization/create-a-new-organization /api-reference/openapi.yml post /organizations # Create SSO Edit Ticket Source: https://docs.envzero.com/api-reference/organization/create-sso-edit-ticket /api-reference/openapi.yml post /organizations/{id}/sso/edit-ticket # Create SSO Ticket Source: https://docs.envzero.com/api-reference/organization/create-sso-ticket /api-reference/openapi.yml post /organizations/{id}/sso/ticket # Delete SSO Connection Source: https://docs.envzero.com/api-reference/organization/delete-sso-connection /api-reference/openapi.yml delete /organizations/{id}/sso # Get Organization Source: https://docs.envzero.com/api-reference/organization/get-organization /api-reference/openapi.yml get /organizations/{id} # Get Organization Limits Source: https://docs.envzero.com/api-reference/organization/get-organization-limits /api-reference/openapi.yml get /organizations/{id}/limits # Get Organization Onboarding Source: https://docs.envzero.com/api-reference/organization/get-organization-onboarding /api-reference/openapi.yml get /organizations/{id}/onboarding # Get SSO Configuration Source: https://docs.envzero.com/api-reference/organization/get-sso-configuration /api-reference/openapi.yml get /organizations/{id}/sso # Invite User Source: https://docs.envzero.com/api-reference/organization/invite-user /api-reference/openapi.yml post /invites # List Organizations Source: https://docs.envzero.com/api-reference/organization/list-organizations /api-reference/openapi.yml get /organizations # List Users Source: https://docs.envzero.com/api-reference/organization/list-users /api-reference/openapi.yml get /organizations/{id}/users # Remove User Source: https://docs.envzero.com/api-reference/organization/remove-user /api-reference/openapi.yml delete /organizations/{id}/users/{userId} # Update Organization Source: https://docs.envzero.com/api-reference/organization/update-organization /api-reference/openapi.yml put /organizations/{id} # Update Organization Onboarding Source: https://docs.envzero.com/api-reference/organization/update-organization-onboarding /api-reference/openapi.yml patch /organizations/{id}/onboarding # Update Policy Source: https://docs.envzero.com/api-reference/organization/update-policy /api-reference/openapi.yml post /organizations/{id}/policies # Update User's Organization Role Assignment Source: https://docs.envzero.com/api-reference/organization/update-users-organization-role-assignment /api-reference/openapi.yml put /organizations/{id}/users/{userId}/role # Archive a Project Source: https://docs.envzero.com/api-reference/projects/archive-a-project /api-reference/openapi.yml delete /projects/{id} This can not be undone. Running Environments will NOT be destroyed and continuous and scheduled Deployments will NOT continue to occur. # Create a new Project Source: https://docs.envzero.com/api-reference/projects/create-a-new-project /api-reference/openapi.yml post /projects # Get a Project By ID Source: https://docs.envzero.com/api-reference/projects/get-a-project-by-id /api-reference/openapi.yml get /projects/{id} # Get Modules Testing Project for Organization Source: https://docs.envzero.com/api-reference/projects/get-modules-testing-project-for-organization /api-reference/openapi.yml get /projects/modules/testing/{organizationId} # Get Policy Source: https://docs.envzero.com/api-reference/projects/get-policy /api-reference/openapi.yml get /policies # Get Users With Access to Project Source: https://docs.envzero.com/api-reference/projects/get-users-with-access-to-project /api-reference/openapi.yml get /projects/{id}/users Returns all users who have access to a project, including organization admins, users with direct project assignments, and users who have access through team assignments. Currently supports organizations with up to approximately 1000 users due to our limits. # List Direct Sub-Projects Source: https://docs.envzero.com/api-reference/projects/list-direct-sub-projects /api-reference/openapi.yml get /projects/children Returns a single layer of active projects: the Organization's root Projects when parentProjectId is omitted, or the direct sub-projects of parentProjectId when it is given. Each Project carries hasSubProjects so the caller knows whether it can be expanded further. # List Organization Projects Tags Source: https://docs.envzero.com/api-reference/projects/list-organization-projects-tags /api-reference/openapi.yml get /projects/tags # List Projects Source: https://docs.envzero.com/api-reference/projects/list-projects /api-reference/openapi.yml get /projects # List Projects (slim tree) Source: https://docs.envzero.com/api-reference/projects/list-projects-slim-tree /api-reference/openapi.yml get /projects/tree # Move a project to be a sub-project of another project Source: https://docs.envzero.com/api-reference/projects/move-a-project-to-be-a-sub-project-of-another-project /api-reference/openapi.yml post /projects/{id}/move # Update a Project Source: https://docs.envzero.com/api-reference/projects/update-a-project /api-reference/openapi.yml put /projects/{id} # Update Policy Source: https://docs.envzero.com/api-reference/projects/update-policy /api-reference/openapi.yml put /policies # Create a new GPG key Source: https://docs.envzero.com/api-reference/provider-registry/create-a-new-gpg-key /api-reference/openapi.yml post /gpg-keys # Create a new provider Source: https://docs.envzero.com/api-reference/provider-registry/create-a-new-provider /api-reference/openapi.yml post /providers # Create a new provider version Source: https://docs.envzero.com/api-reference/provider-registry/create-a-new-provider-version /api-reference/openapi.yml post /providers/{providerId}/versions # Delete a GPG key Source: https://docs.envzero.com/api-reference/provider-registry/delete-a-gpg-key /api-reference/openapi.yml delete /gpg-keys/{id} # Delete a provider Source: https://docs.envzero.com/api-reference/provider-registry/delete-a-provider /api-reference/openapi.yml delete /providers/{providerId} # Find a provider by id Source: https://docs.envzero.com/api-reference/provider-registry/find-a-provider-by-id /api-reference/openapi.yml get /providers/{providerId} # Find a provider by type Source: https://docs.envzero.com/api-reference/provider-registry/find-a-provider-by-type /api-reference/openapi.yml get /providers/v1/{namespace}/{type}/versions # Find all providers in an organization Source: https://docs.envzero.com/api-reference/provider-registry/find-all-providers-in-an-organization /api-reference/openapi.yml get /providers # Get a download url for a specific version Source: https://docs.envzero.com/api-reference/provider-registry/get-a-download-url-for-a-specific-version /api-reference/openapi.yml get /providers/v1/{namespace}/{type}/{version}/download/{os}/{architecture} # List all available GPG keys Source: https://docs.envzero.com/api-reference/provider-registry/list-all-available-gpg-keys /api-reference/openapi.yml get /gpg-keys # Update a provider Source: https://docs.envzero.com/api-reference/provider-registry/update-a-provider /api-reference/openapi.yml put /providers/{providerId} # Create remote state access configuration Source: https://docs.envzero.com/api-reference/remote-backend/create-remote-state-access-configuration /api-reference/openapi.yml put /remote-backend/states/{environmentId}/access-control Creates configuration describing which environments, or projects in the organization may access a given environment's state # Delete remote state access configuration Source: https://docs.envzero.com/api-reference/remote-backend/delete-remote-state-access-configuration /api-reference/openapi.yml delete /remote-backend/states/{environmentId}/access-control Deletes an existing environment state access configuration # Get remote state access configuration Source: https://docs.envzero.com/api-reference/remote-backend/get-remote-state-access-configuration /api-reference/openapi.yml get /remote-backend/states/{environmentId}/access-control Describe which environments, or projects in the organization may access a given environment's state # Assign a role to a user in a project Source: https://docs.envzero.com/api-reference/role-based-access/assign-a-role-to-a-user-in-a-project /api-reference/openapi.yml post /permissions/projects/{projectId} # Get the user's role assignments in a project Source: https://docs.envzero.com/api-reference/role-based-access/get-the-users-role-assignments-in-a-project /api-reference/openapi.yml get /permissions/projects/{projectId} # Remove user's role assignment on project Source: https://docs.envzero.com/api-reference/role-based-access/remove-users-role-assignment-on-project /api-reference/openapi.yml delete /permissions/projects/{projectId}/users/{userId} # Update user's role assignment on project Source: https://docs.envzero.com/api-reference/role-based-access/update-users-role-assignment-on-project /api-reference/openapi.yml put /permissions/projects/{projectId}/users/{userId} # Create a Role Source: https://docs.envzero.com/api-reference/roles/create-a-role /api-reference/openapi.yml post /roles # Create or Update a Role Assignment for a Team Source: https://docs.envzero.com/api-reference/roles/create-or-update-a-role-assignment-for-a-team /api-reference/openapi.yml put /roles/assignments/teams Specifying `environmentId`, `projectId`, or `organizationId` is required. `role` is a default role name (for example `Admin`) or the id of a custom role, not its name. # Create or Update a Role Assignment for a User Source: https://docs.envzero.com/api-reference/roles/create-or-update-a-role-assignment-for-a-user /api-reference/openapi.yml put /roles/assignments/users Currently supports environment scope assignments only. `role` is a default role name (for example `Admin`) or the id of a custom role, not its name. # Delete a Role Source: https://docs.envzero.com/api-reference/roles/delete-a-role /api-reference/openapi.yml delete /roles/{id} # Get a Role Source: https://docs.envzero.com/api-reference/roles/get-a-role /api-reference/openapi.yml get /roles/{id} # Get All Roles Source: https://docs.envzero.com/api-reference/roles/get-all-roles /api-reference/openapi.yml get /roles # Get Team Role Assignments Source: https://docs.envzero.com/api-reference/roles/get-team-role-assignments /api-reference/openapi.yml get /roles/assignments/teams Specifying `environmentId`, `projectId` or `organizationId` is required. # Get User Role Assignments Source: https://docs.envzero.com/api-reference/roles/get-user-role-assignments /api-reference/openapi.yml get /roles/assignments/users Currently supports environment scope assignments only. # Remove a Role Assignment for a Team Source: https://docs.envzero.com/api-reference/roles/remove-a-role-assignment-for-a-team /api-reference/openapi.yml delete /roles/assignments/teams Specifying `environmentId`, `projectId` or `organizationId` is required. # Remove a Role Assignment for a User Source: https://docs.envzero.com/api-reference/roles/remove-a-role-assignment-for-a-user /api-reference/openapi.yml delete /roles/assignments/users Currently supports environment scope assignments only. # Update a Role Source: https://docs.envzero.com/api-reference/roles/update-a-role /api-reference/openapi.yml put /roles/{id} # Get Drift Detection Environment Scheduling Source: https://docs.envzero.com/api-reference/scheduling/get-drift-detection-environment-scheduling /api-reference/openapi.yml get /scheduling/drift-detection/environments/{id} # Get Environment Scheduling Source: https://docs.envzero.com/api-reference/scheduling/get-environment-scheduling /api-reference/openapi.yml get /scheduling/environments/{id} # Get Project Scheduling Source: https://docs.envzero.com/api-reference/scheduling/get-project-scheduling /api-reference/openapi.yml get /scheduling/projects/{id} # Set Drift Detection Environment Scheduling Source: https://docs.envzero.com/api-reference/scheduling/set-drift-detection-environment-scheduling /api-reference/openapi.yml patch /scheduling/drift-detection/environments/{id} # Set Environment Scheduling Source: https://docs.envzero.com/api-reference/scheduling/set-environment-scheduling /api-reference/openapi.yml put /scheduling/environments/{id} # Create or Update a single Team to Project Assignment Source: https://docs.envzero.com/api-reference/teams/create-or-update-a-single-team-to-project-assignment /api-reference/openapi.yml post /teams/assignments This API is deprecated. Please use "Create or Update a Role Assignment for a Team" instead. # Create Team Source: https://docs.envzero.com/api-reference/teams/create-team /api-reference/openapi.yml post /teams # Delete a single Team to Project Assignment Source: https://docs.envzero.com/api-reference/teams/delete-a-single-team-to-project-assignment /api-reference/openapi.yml delete /teams/assignments/{assignmentId} This API is deprecated. Please use "Remove a Role Assignment for a Team" instead. # Delete Team Source: https://docs.envzero.com/api-reference/teams/delete-team /api-reference/openapi.yml delete /teams/{teamId} # Get Team Source: https://docs.envzero.com/api-reference/teams/get-team /api-reference/openapi.yml get /teams/{teamId} # List Project Teams Permissions Source: https://docs.envzero.com/api-reference/teams/list-project-teams-permissions /api-reference/openapi.yml get /teams/assignments This API is deprecated. Please use "Get Team Role Assignments" instead. # List Teams Source: https://docs.envzero.com/api-reference/teams/list-teams /api-reference/openapi.yml get /teams/organizations/{organizationId} # Update Team Source: https://docs.envzero.com/api-reference/teams/update-team /api-reference/openapi.yml put /teams/{teamId} # Update Teams Assignments Source: https://docs.envzero.com/api-reference/teams/update-teams-assignments /api-reference/openapi.yml put /teams/assignments This API is deprecated. Please use "Create or Update a Role Assignment for a Team" instead. # Add Template to Project Source: https://docs.envzero.com/api-reference/templates/add-template-to-project /api-reference/openapi.yml patch /blueprints/{id}/projects # Create Template Source: https://docs.envzero.com/api-reference/templates/create-template /api-reference/openapi.yml post /blueprints Please note, you can only have 1 ssh key per template # Delete Environment Discovery Configuration for a Project Source: https://docs.envzero.com/api-reference/templates/delete-environment-discovery-configuration-for-a-project /api-reference/openapi.yml delete /environment-discovery/projects/{projectId} # Delete Template Source: https://docs.envzero.com/api-reference/templates/delete-template /api-reference/openapi.yml delete /blueprints/{id} # Download TF module Source: https://docs.envzero.com/api-reference/templates/download-tf-module /api-reference/openapi.yml get /modules/v1/{organizationId}/{moduleName}/{providerName}/{version}/download Gets the URL of the source code for a Tofu/Terraform module. This is an API used by Tofu/Terraform to download the module when running `tofu init`. The URL could be found in the response header under X-Terraform-Get, and its format is "git::REPOSITORY_URL[//PATH_TO_FOLDER][?ref=GIT_REF]" You could use this URL to clone the repository and checkout the specific git ref, and find the source in the specified folder # Enable/Update Environment Discovery Configuration Source: https://docs.envzero.com/api-reference/templates/enableupdate-environment-discovery-configuration /api-reference/openapi.yml put /environment-discovery/projects/{projectId} # Generate Terraform Variables from Repository Source: https://docs.envzero.com/api-reference/templates/generate-terraform-variables-from-repository /api-reference/openapi.yml get /blueprints/variables-from-repository Clones and searches through a Template git repository for any Terraform variable blocks and returns a set of env zero Terraform Configuration Variables that may be added to env zero via the Configuration API # Get Assignable Templates Source: https://docs.envzero.com/api-reference/templates/get-assignable-templates /api-reference/openapi.yml get /blueprints/assignable/{projectId} Returns a list of templates that can be assigned to the specified project, including those from parent projects and the organization. # Get Environment Discovery Configuration for a Project Source: https://docs.envzero.com/api-reference/templates/get-environment-discovery-configuration-for-a-project /api-reference/openapi.yml get /environment-discovery/projects/{projectId} # Get Template by ID Source: https://docs.envzero.com/api-reference/templates/get-template-by-id /api-reference/openapi.yml get /blueprints/{id} # Get Workflow File Source: https://docs.envzero.com/api-reference/templates/get-workflow-file /api-reference/openapi.yml get /workflowFile Retrieve workflow file representation by blueprintId or VCS parameters (repositoryUrl, organizationId, path, etc.) # List git repository revisions Source: https://docs.envzero.com/api-reference/templates/list-git-repository-revisions /api-reference/openapi.yml get /blueprints/vcs-revisions # List Templates Source: https://docs.envzero.com/api-reference/templates/list-templates /api-reference/openapi.yml get /blueprints Returns all Templates associated with either an Organization or Project. At least one of these must be set. # Remove Template from Project Source: https://docs.envzero.com/api-reference/templates/remove-template-from-project /api-reference/openapi.yml delete /blueprints/{id}/projects/{projectId} # Update Template Source: https://docs.envzero.com/api-reference/templates/update-template /api-reference/openapi.yml put /blueprints/{id} Please note, you can only have 1 ssh key per template # Connect a Verified VCS Provider User Mapping Source: https://docs.envzero.com/api-reference/users/connect-a-verified-vcs-provider-user-mapping /api-reference/openapi.yml post /users/me/vcs-provider-user-mappings/verified Sets the user's GitHub, GitLab.com, Azure DevOps or Bitbucket user ID from an authorization the user completed in the browser, and marks the mapping as verified. # Create SCIM Configuration Source: https://docs.envzero.com/api-reference/users/create-scim-configuration /api-reference/openapi.yml post /scim/configuration/{organizationId} Creates a SCIM configuration for the organization and generates a bearer token. The token is only returned once. # Create VCS Provider User Mapping Source: https://docs.envzero.com/api-reference/users/create-vcs-provider-user-mapping /api-reference/openapi.yml post /users/me/vcs-provider-user-mappings # Delete SCIM Configuration Source: https://docs.envzero.com/api-reference/users/delete-scim-configuration /api-reference/openapi.yml delete /scim/configuration/{organizationId} Deletes the SCIM configuration for the organization. # Get JIT SAML Config Source: https://docs.envzero.com/api-reference/users/get-jit-saml-config /api-reference/openapi.yml get /scim/configuration/{organizationId}/jit-saml-config Returns the organization current JIT SAML provisioning config (admin SAML group + teams filter) for the mode-flip pre-flight display. # Get SCIM Configuration Source: https://docs.envzero.com/api-reference/users/get-scim-configuration /api-reference/openapi.yml get /scim/configuration/{organizationId} Returns the SCIM configuration for the organization (without the bearer token). # Get SCIM Group Mappings Source: https://docs.envzero.com/api-reference/users/get-scim-group-mappings /api-reference/openapi.yml get /scim/group-team-mapping/{organizationId} Returns the auto-discovered SCIM group to env zero team mappings for the organization. # Get SCIM Reconcile Job Source: https://docs.envzero.com/api-reference/users/get-scim-reconcile-job /api-reference/openapi.yml get /scim/reconcile/{organizationId}/job Returns the latest SCIM reconcile apply job for the organization, including backfill progress and terminal state. # List Organization's VCS ID Mappings Source: https://docs.envzero.com/api-reference/users/list-organizations-vcs-id-mappings /api-reference/openapi.yml get /vcs-provider-user-mappings Returns the VCS ID mappings of every user in the organization. # List User's VCS ID Mappings Source: https://docs.envzero.com/api-reference/users/list-users-vcs-id-mappings /api-reference/openapi.yml get /users/me/vcs-provider-user-mappings Returns the user's account ids for all mapped vcs-es. # Reconcile SCIM State Source: https://docs.envzero.com/api-reference/users/reconcile-scim-state /api-reference/openapi.yml post /scim/reconcile/{organizationId} Compares env zero org state against the SCIM-managed projection and returns a diff. dryRun=true (default) reports only; dryRun=false with confirm=true backfills SCIM ownership on org members and unlinks stale group mappings. # Rotate SCIM Token Source: https://docs.envzero.com/api-reference/users/rotate-scim-token /api-reference/openapi.yml post /scim/configuration/{organizationId}/rotate-token Issues a new SCIM bearer token. The previous token stays valid for a grace window (default 24h), then is revoked. The new token is only returned once. # Unlink SCIM Group Mapping Source: https://docs.envzero.com/api-reference/users/unlink-scim-group-mapping /api-reference/openapi.yml delete /scim/group-team-mapping/{organizationId}/{mappingId} Removes a single SCIM group to env zero team mapping. The env zero team itself is preserved. # Update a User's VCS ID Mapping Source: https://docs.envzero.com/api-reference/users/update-a-users-vcs-id-mapping /api-reference/openapi.yml put /vcs-provider-user-mappings/{mappingId} Updates a user's VCS ID mapping, and returns the updated value. # Update SCIM Mode Source: https://docs.envzero.com/api-reference/users/update-scim-mode /api-reference/openapi.yml put /scim/configuration/{organizationId}/mode Flips the organization SCIM provisioning mode between jit and scim. # Create VCS Connection Source: https://docs.envzero.com/api-reference/vcs/create-vcs-connection /api-reference/openapi.yml post /vcs/connections Only supported creation of Self-Hosted VCS connections # Delete VCS Connection Source: https://docs.envzero.com/api-reference/vcs/delete-vcs-connection /api-reference/openapi.yml delete /vcs/connections/{id} # Get VCS Connection Source: https://docs.envzero.com/api-reference/vcs/get-vcs-connection /api-reference/openapi.yml get /vcs/connections/{id} # Get VCS Repositories Source: https://docs.envzero.com/api-reference/vcs/get-vcs-repositories /api-reference/openapi.yml get /vcs/connections/repositories # List the entities that use a VCS connection Source: https://docs.envzero.com/api-reference/vcs/list-the-entities-that-use-a-vcs-connection /api-reference/openapi.yml get /vcs/connections/{id}/dependents # List VCS Connections Source: https://docs.envzero.com/api-reference/vcs/list-vcs-connections /api-reference/openapi.yml get /vcs/connections # Update VCS Connection Source: https://docs.envzero.com/api-reference/vcs/update-vcs-connection /api-reference/openapi.yml put /vcs/connections/{id} # Budget exceeded webhook Source: https://docs.envzero.com/api-reference/webhooks/budget-exceeded-webhook /api-reference/openapi.yml webhook com.env0.budget.exceeded This webhook is fired when a "Budget Exceeded" event has been triggered # Deploy failed webhook Source: https://docs.envzero.com/api-reference/webhooks/deploy-failed-webhook /api-reference/openapi.yml webhook com.env0.deploy.failed This webhook is fired when a deploy has failed # Deploy succeeded webhook Source: https://docs.envzero.com/api-reference/webhooks/deploy-succeeded-webhook /api-reference/openapi.yml webhook com.env0.deploy.succeeded This webhook is fired when a deploy has finished successfully # Deployment cancelled webhook Source: https://docs.envzero.com/api-reference/webhooks/deployment-cancelled-webhook /api-reference/openapi.yml webhook com.env0.deployment.cancelled This webhook is fired when a deployment has been cancelled # Deployment resumed webhook Source: https://docs.envzero.com/api-reference/webhooks/deployment-resumed-webhook /api-reference/openapi.yml webhook com.env0.deploy.resumed This webhook is fired when a deployment has been resumed after an approval # Deployment started webhook Source: https://docs.envzero.com/api-reference/webhooks/deployment-started-webhook /api-reference/openapi.yml webhook com.env0.deploy.started This webhook is fired when a deployment has started # Deployment waiting for user webhook Source: https://docs.envzero.com/api-reference/webhooks/deployment-waiting-for-user-webhook /api-reference/openapi.yml webhook com.env0.deployment.waiting_for_user This webhook is fired when a deployment requires an approval # Destroy failed webhook Source: https://docs.envzero.com/api-reference/webhooks/destroy-failed-webhook /api-reference/openapi.yml webhook com.env0.destroy.failed This webhook is fired when a destroy has failed # Destroy resumed webhook Source: https://docs.envzero.com/api-reference/webhooks/destroy-resumed-webhook /api-reference/openapi.yml webhook com.env0.destroy.resumed This webhook is fired when a destroy has been resumed after an approval # Destroy started webhook Source: https://docs.envzero.com/api-reference/webhooks/destroy-started-webhook /api-reference/openapi.yml webhook com.env0.destroy.started This webhook is fired when a destroy has started # Destroy succeeded webhook Source: https://docs.envzero.com/api-reference/webhooks/destroy-succeeded-webhook /api-reference/openapi.yml webhook com.env0.destroy.succeeded This webhook is fired when a destroy has finished successfully # Drift detected webhook Source: https://docs.envzero.com/api-reference/webhooks/drift-detected-webhook /api-reference/openapi.yml webhook com.env0.drift.detected This webhook is fired when env zero detected a drift in an environment # Drift failed webhook Source: https://docs.envzero.com/api-reference/webhooks/drift-failed-webhook /api-reference/openapi.yml webhook com.env0.drift.failed This webhook is fired when an env zero drift detection failed to complete # Drift undetected webhook Source: https://docs.envzero.com/api-reference/webhooks/drift-undetected-webhook /api-reference/openapi.yml webhook com.env0.drift.undetected This webhook is fired when a drift has been reconciled # Environment marked for auto destroy webhook Source: https://docs.envzero.com/api-reference/webhooks/environment-marked-for-auto-destroy-webhook /api-reference/openapi.yml webhook com.env0.environment.marked_for_auto_destroy This webhook is fired when an environment is marked for auto destroy by a TTL Policy # Pr plan failed webhook Source: https://docs.envzero.com/api-reference/webhooks/pr-plan-failed-webhook /api-reference/openapi.yml webhook com.env0.pr_plan.failed This webhook is fired when a PR plan has failed # Changelog Source: https://docs.envzero.com/changelogs Stay up to date with the latest features, improvements, and fixes in env zero. Updates are organized by release month and year. ## 2026 **Allowed IPs for each API key** October 2026 Limit an organization or personal API key to its own list of IP addresses, on top of your organization's IP allowlist. Set the list when you create a key, or change it later from the key list or the API. [Read more](/changelogs/2026/10/api-key-allowed-ips) **Action required: switch Azure DevOps connections to Microsoft Entra ID** October 2026 Switch existing Azure DevOps connections to Microsoft Entra ID before Microsoft removes Azure DevOps OAuth. Connections that need it are marked in Organization Settings > VCS, and templates keep working after the switch. New connections use Microsoft Entra ID by default. [Read more](/changelogs/2026/10/azure-devops-microsoft-entra-id) **Full SCIM provisioning** August 2026 SCIM provisioning is generally available. Pick a provisioning mode for your organization, push Okta or Microsoft Entra ID groups to env zero teams, rotate the SCIM token with a 24 hour overlap, and reconcile your identity provider against env zero users and teams. [Read more](/changelogs/2026/08/scim-full-provisioning) **Search, reworked across env zero** August 2026 The Projects page ranks exact and prefix name matches first. Cmd+K shows environment search errors and no-match results separately. Project environment list filters stay in the URL, and Credentials, Git Tokens, and Teams can be searched. [Read more](/changelogs/2026/08/search-improvements) **August 2026** Key-value tags on environments, with filtering in Explorer and bulk tag editing. ### Tag Your Environments Attach key-value tags to an environment, for example `team=payments`, then filter the Explorer table by tag, search the project environments list by tag, and add or remove tags across many environments from the bulk operations wizard. [Read more](/changelogs/2026/08/environment-tags) **July 2026** V2 OIDC per-cloud audiences reach GA, and a new single-binary env zero CLI. ### V2 OIDC Tokens: Per-Cloud-Provider Audiences OIDC credentials for AWS, Azure, GCP, and Vault can now use a provider-specific token audience instead of a single shared audience across all providers. This prevents a token issued for one provider from being replayed against another. [Read more](/changelogs/2026/07/v2-oidc-tokens) ### Say Hello to the New env zero CLI The env zero CLI has been rebuilt as a single binary, replacing the old npm-based tool. This release adds project management commands and read-only sign-in, and the CLI remains built for AI agents with `env0 skill install` and `env0 context`. [Read more](/changelogs/2026/07/cli-for-ai-agents) **May 2026** Organization-level IP allowlisting for logins, API keys, and the Agent API. ### IP Allowlisting for Logins, API Keys, and the Agent API env zero now supports an organization-level IP allowlist that restricts logins and unattended access to a set of approved source IP addresses, covering UI logins, API keys, and the Agent API. [Read more](/changelogs/2026/05/ip-allowlisting) **March 2026** Self-service agent pool creation and guided Terraform Cloud migration wizard. ### Self-Service Agent: Create and Manage Agent Pools Without Contacting Support Create new self-hosted agent pools directly from Organization Settings. Generate agents and start deploying without opening a support ticket. [Read more](/changelogs/2026/03/self-service-agent) ### Terraform Cloud Migration Wizard Migrate Terraform Cloud (TFC) or Terraform Enterprise (TFE) workspaces to env zero using a guided wizard that handles workspace discovery, variable migration, state transfer, and controlled cutover - all from the env zero UI. [Read more](/changelogs/2026/03/tfc-migration-wizard) **February 2026** SCIM provisioning for automated user lifecycle management. ### SCIM Provisioning: Automate User Lifecycle Management env zero now supports SCIM 2.0, enabling your identity provider to automatically provision and deprovision users. Access is granted or revoked as soon as changes happen in your IdP - no manual user management required. [Read more](/changelogs/2026/02/scim-provisioning) **January 2026** Self-service SSO configuration and a refreshed Projects page. ### Self-Service SSO: Speed Up Authentication and Stay in Control Configure Single Sign-On directly from Organization Settings. Set up Azure AD or SAML 2.0 authentication on your own schedule with full control over your enterprise authentication setup. **Key benefits:** * **Immediate setup** - configure SSO during onboarding or anytime after * **Full control** - manage domain mappings, role assignments, and settings on your schedule * **Enterprise ready** - centralize user access and enforce your org's authentication policies [Read more](/changelogs/2026/01/self-service-sso) ### A Freshly Updated Projects Page: More Useful, More Powerful, and Easier to Navigate We have rolled out a refreshed Projects page with improvements designed to make it easier to understand, organize, and act on your projects at a glance. [Read more](/changelogs/2026/01/projects-page-refresh) ## 2025 **November 2025** Code Optimizer beta helps you improve infrastructure code quality and safety by detecting issues early. ### Now Available (Beta): Code Optimizer Helps You Improve Infrastructure Code Quality and Safety Code Optimizer is a new beta feature in env zero that scans your Infrastructure as Code and helps you catch issues early, before they cause problems in production. It detects risks, flags inconsistencies, and suggests code-level improvements you can review and apply. [Read more](/changelogs/2025/11/code-optimizer-beta) **September 2025** Ready-to-use policies for instant governance and the new env zero MCP Server for fast, interactive infrastructure actions from your IDE or AI agent. ### Introducing Ready-To-Use Policies Ready-to-use policies in env zero make it faster to put guardrails in place across your Infrastructure-as-Code workflows. [Read more](/changelogs/2025/09/ready-to-use-policies-change-log) ### env zero MCP Server: Fast and Safe Infrastructure Actions from IDEs and Agents The env zero MCP Server brings infrastructure deployment directly into your IDE, with support for all major IaC frameworks and GitOps-based workflows. [Read more](/changelogs/2025/09/env-zero-mcp-server-change-log) **June 2025** Cloud Compass GCP support and polish improvements ### Cloud Compass adds support for GCP Cloud Compass now supports Google Cloud Platform (GCP), expanding your infrastructure visibility across AWS, Azure, and GCP. [Read more](/changelogs/2025/06/cloud-compass-adds-support-for-gcp) ### Polish improvements June 2025 We've continued to roll out improvements focused on streamlining workflows, resolving common issues, and refining the experience, driven by user feedback. [Read more](/changelogs/2025/06/polish-improvements-june-2025) **May 2025** Drift remediation automation ### New in drift remediation: automated code updates to keep IaC in sync Say hello to a smarter way to manage drift: now you can instantly capture changes made directly in your cloud environment and update your Infrastructure as Code with just a few clicks. [Read more](/changelogs/2025/05/new-in-drift-remediation-automated-code-updates-to-keep-iac-in-sync) **April 2025** AI-powered insights and drift analysis ### What's new: AI-powered summarization and error insights beta We're bringing the power of AI to your deployments with our new AI-Powered Summarization and Error Insights—now in beta! [Read more](/changelogs/2025/04/whats-new-ai-powered-summarization-and-error-insights-beta) ### Drift cause analysis: understand why drift happened Gain deeper insights into drift events with automated cause analysis that explains why drift occurred and provides actionable recommendations. [Read more](/changelogs/2025/04/drift-cause-analysis-understand-why-drift-happened) **March 2025** Cloud Analyst and polish improvements ### Introducing env0 Cloud Analyst for AI-powered infrastructure intelligence Get AI-powered insights and recommendations for your infrastructure with our new Cloud Analyst feature that helps optimize costs, security, and performance. [Read more](/changelogs/2025/03/introducing-env0-cloud-analyst-for-ai-powered-infrastructure-intelligence) ### Polish improvements January 2025 We're happy to introduce a few recent improvements we've made to enhance the user experience and flexibility across env0. [Read more](/changelogs/2025/03/polish-improvements-january-2025) **February 2025** Drift remediation and Cloud Compass enhancements ### Drift remediation We're excited to introduce Drift Remediation, a new capability that helps reduce the time and effort required to reconcile infrastructure drift and keep your infrastructure consistent with your intended configuration. [Read more](/changelogs/2025/02/drift-remediation) ### Cloud Compass drilldown Enhanced Cloud Compass with drilldown capabilities for deeper infrastructure analysis and resource exploration. [Read more](/changelogs/2025/02/cloud-compass-drilldown) **January 2025** Backstage integration ### New Backstage Plugin: Manage and Deploy IaC from Your Internal Developer Portal The new env0 Backstage Plugin brings IaC management directly into the developer portal, enabling developers to create, deploy, and monitor cloud environments directly from Backstage. [Read more](/changelogs/2025/01/backstage-integration) ## 2024 **December 2024** Drift management and polish improvements ### Introducing drift cause: adding context to drift management We're excited to announce Drift Cause, bringing visibility and accountability to managing infrastructure drift by providing detailed information about who was responsible when it occurred, and how it was triggered. [Read more](/changelogs/2024/12/introducing-drift-cause-adding-context-to-drift-management) ### Polish improvements December 2024 Various UI improvements and bug fixes to enhance the overall user experience. [Read more](/changelogs/2024/12/polish-improvements-december-2024) **November 2024** Cloud Compass Azure support and custom flows ### Cloud Compass supports for Microsoft Azure Cloud Compass now supports Microsoft Azure, expanding its multi-cloud support with AI-assisted logic to analyze your cloud footprint and identify gaps in IaC coverage. [Read more](/changelogs/2024/11/cloud-compass-supports-for-microsoft-azure) ### Custom flows for tasks With this update, you can now configure custom hooks for your tasks, allowing you to define specific setups and teardowns for all ad-hoc tasks. [Read more](/changelogs/2024/11/custom-flows-for-tasks) **September 2024** Agent mixing and environment onboarding ### Mix agents and variables Enhanced flexibility to mix different agent types and variable configurations within the same environment. [Read more](/changelogs/2024/09/mix-agents-and-variables) ### Onboarding: import external environments Streamlined onboarding process that allows you to import existing external environments into env0 for better management and monitoring. [Read more](/changelogs/2024/09/onboarding-import-external-environments) **August 2024** Ansible support ### Ansible support Ansible is an open-source automation tool used for configuration management, application deployment, and task automation. We are excited to announce that Ansible now gets first-class support in env0! [Read more](/changelogs/2024/08/ansible-support) **July 2024** Cloud Compass, GitOps, and environment management ### Cloud Compass We're excited to unveil Cloud Compass, a new feature designed to enhance your visibility and understanding of cloud resource management with IaC coverage trends and resource analysis. [Read more](/changelogs/2024/07/cloud-compass) ### GitOps apply all Enhanced GitOps capabilities with apply all functionality for streamlined multi-environment deployments. [Read more](/changelogs/2024/07/gitops-apply-all) ### Move environments between projects New capability to move environments between projects for better organization and management flexibility. [Read more](/changelogs/2024/07/move-environments-between-projects) **June 2024** Workflow approval flow ### Approval flow for workflows Approval flow for workflows lets you define which environment plans require review, giving you more control over workflow execution. [Read more](/changelogs/2024/06/approval-flow-for-workflows) **May 2024** Docker updates, variable sets, and webhooks ### Docker image Alpine and Node upgrade We are thrilled to announce a significant upgrade to our platform that will enhance your experience and ensure smoother operations! We are upgrading Alpine, Node and pip in the docker image, the image that your deployments run on, meaning better performance and security. [Read more](/changelogs/2024/05/docker-image-alpine-and-node-upgrade) ### Variable sets We are excited to announce the release of Variable Sets! Variable Sets are designed to enhance configuration management within env0 by organizing and managing frequently used or closely related variables with ease, streamlining workflows and promoting consistency across projects. [Read more](/changelogs/2024/05/variable-sets) ### Variables improvements We're excited to introduce several improvements to the Variables Table, designed to streamline your experience and make managing variables a breeze! [Read more](/changelogs/2024/05/variables-improvements) ### Webhook notifications Webhooks are now supported as a notification target in env zero, for secure event-driven reactions. [Read more](/changelogs/2024/05/webhook-notifications) **April 2024** Approval policies, environment outputs, and navigation ### Approval policies and custom flows enhancements Enhanced approval policies and custom flows with improved functionality and user experience. [Read more](/changelogs/2024/04/approval-policies-and-custom-flows-enhancements) ### Environment outputs New capability to capture and use environment outputs for better workflow integration and resource sharing. [Read more](/changelogs/2024/04/environment-outputs) ### Global environment search Enhanced search functionality to quickly find environments across your entire organization. [Read more](/changelogs/2024/04/global-environment-search) ### Navigation improvement Improved navigation interface for better user experience and easier access to features. [Read more](/changelogs/2024/04/navigation-improvement) **March 2024** Environment management and team roles ### Create environment without deploy New capability to create environments without immediately deploying them, providing more flexibility in environment management. [Read more](/changelogs/2024/03/create-environment-without-deploy) ### Organization role assignments for teams Enhanced team management with organization-level role assignments for better access control and permissions. [Read more](/changelogs/2024/03/organization-role-assignments-for-teams) ### VCS environments in workflows Enhanced workflow capabilities with VCS environment integration for better source control management. [Read more](/changelogs/2024/03/vcs-environments-in-workflows) **February 2024** Notifications, environment discovery, and drift status ### Email notifications New email notification system for better communication and alerting about deployment status and events. [Read more](/changelogs/2024/02/email-notifications) ### Environment discovery Automated environment discovery capabilities to help identify and manage existing cloud resources. [Read more](/changelogs/2024/02/environment-discovery) ### Separate environment drift status from the general status Improved status tracking by separating environment drift status from general deployment status for better visibility. [Read more](/changelogs/2024/02/separate-environment-drift-status-from-the-general-status) **January 2024** Module testing, targeted deployments, and workflow enhancements ### New: Modules Continuous Integration Testing New continuous integration testing capabilities for modules to ensure reliability and quality. [Read more](/changelogs/2024/01/new-modules-continuous-integration-testing) ### Targeted deployments Enhanced deployment capabilities with targeted deployment options for more precise control. [Read more](/changelogs/2024/01/targeted-deployments) ### Workflow sub graph deployment Enhanced workflow capabilities with sub graph deployment options for more granular control over complex workflows. [Read more](/changelogs/2024/01/workflow-sub-graph-deployment) ## 2023 **December 2023** Remote apply functionality ### Remote apply New remote apply functionality for executing deployments from external systems and CI/CD pipelines. [Read more](/changelogs/2023/12/remote-apply) **November 2023** Variable behavior, OIDC integration, and monitoring ### Change to project variables behaviour Updated project variables behavior for improved consistency and better variable management across environments. [Read more](/changelogs/2023/11/change-to-project-variables-behaviour) ### Easy OIDC authentication integration Simplified OIDC authentication integration process for easier setup and configuration. [Read more](/changelogs/2023/11/easy-oidc-authentication-integration) ### Improved resiliency Enhanced platform resiliency with improved error handling and recovery mechanisms. [Read more](/changelogs/2023/11/improved-resiliency) ### Self-hosted remote state New capability to use self-hosted remote state backends for enhanced security and control. [Read more](/changelogs/2023/11/self-hosted-remote-state) ### Usage dashboard New usage dashboard providing insights into resource consumption and deployment patterns. [Read more](/changelogs/2023/11/usage-dashboard) **October 2023** Variable persistence and OpenTofu support ### Immediate persistence of variables regardless of deployment outcome Variables are now immediately persisted regardless of deployment outcome, ensuring configuration changes are saved even if deployments fail. [Read more](/changelogs/2023/10/immediate-persistence-of-variables-regardless-of-deployment-outcome) ### Official OpenTofu support Official support for OpenTofu, the open-source fork of Terraform, providing an alternative IaC tool option. [Read more](/changelogs/2023/10/official-opentofu-support) **September 2023** Budget notifications and VS Code extension ### Budget notifications New budget notification system to help monitor and control cloud spending with automated alerts. [Read more](/changelogs/2023/09/budget-notifications) ### VS Code extension New VS Code extension for env0, providing integrated development experience directly in your IDE. [Read more](/changelogs/2023/09/vs-code-extension) **August 2023** Kubernetes support, Docker agents, and organization costs ### Better Kubernetes support Enhanced Kubernetes support with improved functionality and better integration capabilities. [Read more](/changelogs/2023/08/better-kubernetes-support) ### Docker deployment agent New Docker deployment agent for running deployments in containerized environments. [Read more](/changelogs/2023/08/docker-deployment-agent) ### Organization costs New organization-level cost tracking and reporting capabilities for better financial oversight. [Read more](/changelogs/2023/08/organization-costs) **July 2023** Approval policies, encrypted state, and Azure DevOps support ### Approval policies New approval policies system for controlling deployment workflows and ensuring compliance. [Read more](/changelogs/2023/07/approval-policies) ### env0 hosted encrypted state New env0-hosted encrypted state backend option for secure state storage and management. [Read more](/changelogs/2023/07/env0-hosted-encrypted-state) ### Plan and apply from PR comments support for Azure DevOps Extended plan and apply from PR comments functionality to support Azure DevOps repositories. [Read more](/changelogs/2023/07/plan-and-apply-from-pr-comments-support-for-azure-devops) ### Self-hosted agents monitoring Enhanced monitoring capabilities for self-hosted agents with better visibility and diagnostics. [Read more](/changelogs/2023/07/self-hosted-agents-monitoring) ### Update environment variables without deploying New capability to update environment variables without triggering a deployment, providing more flexibility in configuration management. [Read more](/changelogs/2023/07/update-environment-variables-without-deploying) **June 2023** AWS session tags, Helm support, and workflow enhancements ### AWS session tags for OIDC Enhanced OIDC integration with AWS session tags for better security and access control. [Read more](/changelogs/2023/06/aws-session-tags-for-oidc) ### Helm support New Helm support for managing Kubernetes applications and deployments. [Read more](/changelogs/2023/06/helm-support) ### PR plan and remote backend for workflow Enhanced workflow capabilities with PR plan functionality and remote backend support. [Read more](/changelogs/2023/06/pr-plan-and-remote-backend-for-workflow) **May 2023** Bulk operations, environment access, and project management ### Bulk operations New bulk operations capabilities for managing multiple environments and resources efficiently. [Read more](/changelogs/2023/05/bulk-operations) ### Environment role-based access granularity Enhanced role-based access control with more granular permissions for environment management. [Read more](/changelogs/2023/05/environment-role-based-access-granularity) ### Moving projects and sub-projects New capability to move projects and sub-projects for better organization and management. [Read more](/changelogs/2023/05/moving-projects-and-sub-projects) ### Project-level remote backend enforcement New project-level enforcement for remote backend usage to ensure consistent state management. [Read more](/changelogs/2023/05/project-level-remote-backend-enforcement) **April 2023** Private plugins and provider registry ### Private plugins New support for private plugins to enable custom functionality and integrations. [Read more](/changelogs/2023/04/private-plugins) ### Private provider registry New private provider registry support for managing custom Terraform providers. [Read more](/changelogs/2023/04/private-provider-registry) **March 2023** PR comments and remote state access ### PR comments plan and apply role-based access Enhanced PR comments functionality with role-based access control for plan and apply operations. [Read more](/changelogs/2023/03/pr-comments-plan-and-apply-role-based-access) ### Remote state access control New remote state access control features for enhanced security and permissions management. [Read more](/changelogs/2023/03/remote-state-access-control) **February 2023** Custom TTL policies, integrations, and sub-projects ### Custom TTL policy New custom TTL (Time To Live) policy capabilities for automated environment lifecycle management. [Read more](/changelogs/2023/02/custom-ttl-policy) ### New integrations, plugins and Sumo Logic New integrations and plugins including Sumo Logic support for enhanced monitoring and logging capabilities. [Read more](/changelogs/2023/02/new-integrations-plugins-and-sumo-logic) ### Sub-projects New sub-projects capability for better organization and hierarchical project management. [Read more](/changelogs/2023/02/sub-projects) **January 2023** Deployment comments, environment locking, and remote plans ### Deployment comments New deployment comments feature for better collaboration and documentation of deployment changes. [Read more](/changelogs/2023/01/deployment-comments) ### Environment locking New environment locking capability to prevent concurrent modifications and ensure deployment consistency. [Read more](/changelogs/2023/01/environment-locking) ### Remote plans New remote plans functionality for executing Terraform plans in remote environments. [Read more](/changelogs/2023/01/remote-plans) ### Workflow settings enhancement Enhanced workflow settings with improved configuration options and user experience. [Read more](/changelogs/2023/01/workflow-settings-enhancement) ## 2022 **December 2022** Azure DevOps integration, plugins, and module registry ### Azure DevOps integration New Azure DevOps integration for CI/CD workflows and repository management. [Read more](/changelogs/2022/12/azure-devops-integration) ### Log forwarding to Google Cloud Logging New log forwarding capability to Google Cloud Logging for centralized log management. [Read more](/changelogs/2022/12/log-forwarding-to-google-cloud-logging) ### Module registry modules from path Enhanced module registry with support for modules from local file paths. [Read more](/changelogs/2022/12/module-registry-modules-from-path) ### Plugins New plugin system for extending env0 functionality with custom integrations and tools. [Read more](/changelogs/2022/12/plugins) ### Project-level custom flow New project-level custom flow capabilities for defining reusable deployment processes. [Read more](/changelogs/2022/12/project-level-custom-flow) **November 2022** Audit logs, API keys, and project costs ### Audit log New audit logging system for tracking user actions and system changes for compliance and security. [Read more](/changelogs/2022/11/audit-log) ### Personal API keys New personal API keys system for individual user authentication and API access. [Read more](/changelogs/2022/11/personal-api-keys) ### Project costs New project-level cost tracking and reporting capabilities for better financial management. [Read more](/changelogs/2022/11/project-costs) **October 2022** Business tier, custom roles, and integrations ### Business tier now available in AWS Marketplace Business tier subscription now available through AWS Marketplace for easier procurement and billing. [Read more](/changelogs/2022/10/business-tier-now-available-in-aws-marketplace) ### Custom roles New custom roles capability for fine-grained access control and permissions management. [Read more](/changelogs/2022/10/custom-roles) ### env0 game Interactive env0 game for learning platform features and best practices in a fun way. [Read more](/changelogs/2022/10/env0-game) ### env0 mobile support New mobile support for accessing and managing env0 from mobile devices. [Read more](/changelogs/2022/10/env0-mobile-support) ### OIDC additional claims Enhanced OIDC integration with support for additional claims and user attributes. [Read more](/changelogs/2022/10/oidc-additional-claims) ### Remote backend New remote backend support for secure state storage and team collaboration. [Read more](/changelogs/2022/10/remote-backend) ### SAML admin group integration Enhanced SAML integration with admin group support for better user management. [Read more](/changelogs/2022/10/saml-admin-group-integration) **September 2022** Python 2 removal and updates ### Removing Python 2 and other 3rd party updates Removed Python 2 support and updated third-party dependencies for better security and performance. [Read more](/changelogs/2022/09/removing-python-2-and-other-3rd-party-updates) **August 2022** Log forwarding and OIDC support ### Logs forwarding to Coralogix New log forwarding capability to Coralogix for centralized log management and analysis. [Read more](/changelogs/2022/08/log-forwarding-to-coralogix) ### OIDC support New OpenID Connect (OIDC) support for modern authentication and single sign-on capabilities. [Read more](/changelogs/2022/08/oidc-support) **July 2022** CloudFormation, Terragrunt, and Vault support ### CloudFormation support New AWS CloudFormation support for managing infrastructure using CloudFormation templates. [Read more](/changelogs/2022/07/cloudformation-support) ### Terragrunt run-all support Enhanced Terragrunt support with run-all functionality for managing multiple Terraform modules. [Read more](/changelogs/2022/07/terragrunt-run-all-support) ### Vault HashiCorp Vault support New HashiCorp Vault integration for secure secret management and dynamic credentials. [Read more](/changelogs/2022/07/vault-hashicorp-vault-support) **June 2022** Cost monitoring, workflows, and Pulumi version management ### Cost monitoring for Terragrunt New cost monitoring capabilities specifically for Terragrunt deployments and infrastructure. [Read more](/changelogs/2022/06/cost-monitoring-for-terragrunt) ### env0 Workflows New env0 Workflows feature for orchestrating complex multi-environment deployment processes. [Read more](/changelogs/2022/06/env0-workflows) ### Managing Pulumi version Enhanced Pulumi support with version management capabilities for different Pulumi versions. [Read more](/changelogs/2022/06/managing-pulumi-version) ### TTL policy per project New project-level TTL (Time To Live) policy configuration for automated environment lifecycle management. [Read more](/changelogs/2022/06/ttl-policy-per-project) **May 2022** Non-admin API keys ### Non Admin API Keys New non-admin API keys for restricted access and better security controls. [Read more](/changelogs/2022/05/non-admin-api-keys) # Non Admin API Keys Source: https://docs.envzero.com/changelogs/2022/05/non-admin-api-keys Create user-scoped API keys with project-level RBAC in env zero, giving team members API access without granting full organization admin permissions. There are many ways to interact with the env0 platform that requires an API key for authentication and authorization. Our public [API](/api-reference/), env0 [Terraform provider](https://registry.terraform.io/providers/env0/env0/latest), and the env0 [CLI](https://www.npmjs.com/package/@env0/cli). Now, with our new non-admin API key, you can provide members of your team with the ability to use API keys, while maintaining your organization's RBAC. A user API key can be created with specific project permissions, assigned to a team, and basically treated like any other user in the system. ### Creating a Non Admin API Key When creating a new API key from the *Organization Settings* page, you can now choose its role. It can be either an Admin or a User. When choosing a User, the API key will behave exactly like a user in the env0 platform. As a User type, you have control of the RBAC for that API key, specific project, or specific team it belongs to. As part of a team, it will also inherit the team's RBAC. You can [read more here](/guides/admin-guide/user-role-and-team-management/api-keys). ![Screen Shot 2022-05-26 at 10.06.05](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/05/screen_shot_2022-05-26_at_100605.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=d50a9e60168a0ad66c97ccae5b853adc) ![Screen Shot 2022-05-26 at 10.13.48](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/05/screen_shot_2022-05-26_at_101348.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=87153e27288e78a2e6de57734e35be1d) # Cost Monitoring for Terragrunt Source: https://docs.envzero.com/changelogs/2022/06/cost-monitoring-for-terragrunt Track actual cloud costs for Terragrunt environments in env zero, correlating weekly spending with deployments using Terratag-powered cost monitoring. One of the advantages of env0 is the ability to monitor the actual cost of your environments based on your Infrastructure as code resources. This feature is available due to our beloved open source project, [Terratag](https://www.terratag.io/). As of today, it officially supports Terragrunt code, giving our env0 platform the ability to show you cost over time for your Terragrunt based environments and correlate them with your deployment. Together with these cost estimation capabilities, you can have full control of your cloud spending. ### Cost Monitoring Follow [this guide](/guides/cost-monitoring/cost-monitoring) on how to enable the cost monitoring.\ Once you configure it at the project level and deploy your environment, you will be able to see the weekly cost of that environment and also see the cost graph on the environment page and get the correlation to your deployments. ![Screen Shot 2022-06-26 at 20.09.58](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/06/screen_shot_2022-06-26_at_200958.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=2400b773610421aed2a3a904f43553bc) # env zero Workflows Source: https://docs.envzero.com/changelogs/2022/06/env0-workflows Orchestrate multi-environment deployments with dependency ordering using env zero Workflows, defined in a YAML file and visualized as a deployment graph. A production app's infrastructure consists of many different resources. As those resources grow, managing and deploying them requires more thought and effort. We tend to look at managing resources as we do with code - split them into smaller manageable pieces ([env zero Environments](/guides/admin-guide/environments)) where each piece is cohesive and loosely coupled. In theory, this textbook solution sounds great because each environment is independent and can be deployed at any time, *but* in the real world, we have dependencies - deploying all those env zero Environments simultaneously is impractical. > [!NOTE] > > **Basic Dependency Example** > > Environment "**Network and VPC**" manages all necessary network configuration.\\ > > > Environment "**DB**" manages a database that multiple services use. > > Environment "**EKS**" manages the Elastic Kubernetes Service onto which pods of services will be deployed. > > Environments "**Billing Service**", "**Configuration Service**" and "**Notification Service**" all manage the deployments of services on EKS. Those services need access to the database. > > > > For this use case:\ > > Environment "**DB**" depends on the VPC from the "**Network and VPC**" IaC stack. > > Environment "**EKS**" also depends on the VPC from the "**Network and VPC**" IaC stack. > > All service environments depend on **DB**, and **EKS**. > > > > As can be seen, the dependencies make it impossible for all the Environments to be deployed simultaneously. > > > > And of course, as the resources and environments grow the complexity of the dependencies will increase. ### Here come env zero Workflows to the rescue! env zero Workflows allow deploying many env zero Environments with complex dependencies between them as a single unit. > [!TIP] > > > **env zero Workflow benefits** > > > > 1. Manage your entire infrastructure with complex dependencies between Environments > > 2. Visual presentation of the complex deployment > > 3. Each environment can use a different IaC tool - one environment can be managed by Terraform while another is managed by Kubernetes > > 4. Enhanced experience from all surrounding env zero features such as [Policies](/guides/policies-governance/policies), [Custom flows](/guides/admin-guide/custom-flows), [Drift Detection](/guides/admin-guide/environments/drift-detection) and [Continuous Deployment](/guides/admin-guide/environments/continuous-deployment) To set up an env zero Workflow follow this simple guide: env zero relies on a file named **env0.workflow\.yml** which describes the dependencies and configuration of the sub environments in your workflow, create this file with your specific definitions, each environment should define: 1. *name*: Will be displayed in the workflow graph 2. *templateName*: A name of a pre-defined [Template](/guides/admin-guide/templates) to deploy 3. *needs* (optional): An array of sub environments which all must be successfully deployed before this sub environment can start deploying ```yaml theme={null} environments: vpc: name: 'VPC and Network' templateName: 'VPC' db: name: DB templateName: 'DB' needs: - vpc eks: name: EKS templateName: 'EKS' needs: - vpc service1: name: 'Billing Service' templateName: 'Billing Service' needs: - db - eks service2: name: 'Configuration Service' templateName: 'Configuration Service' needs: - db - eks service3: name: 'Notification Service' templateName: 'Notification Service' needs: - db - eks ``` 2. Create a [new Template](/guides/admin-guide/templates) and select **env zero Workflow** as the Template Type ![Screen Shot 2022-06-08 at 16.19.14](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/06/screen_shot_2022-06-08_at_161914.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=e9ec85de098fe7e4ca8c3d2e1485b8e9) In the VCS step fill in your VCS details and fill in the directory that contains your **env0.workflow\.yml** file. ![Screen Shot 2022-06-08 at 16.24.35](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/06/screen_shot_2022-06-08_at_162435.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=079c472660444d8bb5bf2849d36be047) 3. Create an [Environment](/guides/admin-guide/environments/setting-up-a-new-environment) based on the Workflow template 4. Deploy ![Screen Shot 2022-06-20 at 16.50.22](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/06/screen_shot_2022-06-20_at_165022.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=ed5d1ebd963080eb3ac423a8407d36cd) You can view your Workflow progress in the **GRAPH** tab. # Managing Pulumi Version Source: https://docs.envzero.com/changelogs/2022/06/managing-pulumi-version Pin Pulumi templates to a specific CLI version in env zero using the ENV0_PULUMI_VERSION variable or the template wizard, avoiding unexpected version upgrades. Managing software versions of your Infrastructure as code framework is one of the basic aspects when managing your deployment and code. Now you can specify the exact Pulumi CLI version you want your IaC to run with and avoid version incompatibility issues and have full control over what versions update and backward compatibilities issues. ### Setting Pulumi Version The version defined for Pulumi templates until recently defaulted to being the latest stable Pulumi CLI build,\ Now you can choose exactly what version you want your CLI to run with. You can define your version by: * Defining the environment variable `ENV0_PULUMI_VERSION` * Choosing your version in our template wizard ![Pulumi version management interface showing version selection and configuration options](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/06/pulumi_version.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=2977f73a0e6d982f2e17c200575855c4) You can read more about defining an IaC version for you templates [here](/guides/admin-guide/templates) # TTL Policy Per Project Source: https://docs.envzero.com/changelogs/2022/06/ttl-policy-per-project Override organization-level TTL policies at the project level in env zero, giving project admins control over environment time-to-live defaults and maximums. env zero lets you create a managed self-service inside your organization, empower your developers and R\&D teams to spin up, update and destroy an environment with one click, and track environment status or deployment history. To manage those environments and make sure no resources are wasted, env zero lets you create [TTL policies](/guides/policies-governance/policy-ttl). The Organization administrator can limit the environment's time-to-live, but often, the same settings don't fit the needs of different projects in the organization. Now we allow overriding organization TTL policy on a project basis. ### TTL Policy Settings When users create or redeploy an environment, they can set the environment's time-to-live. TTL Policies define the default and maximum time-to-live values for the environment either at the organization level or at the project level. ### Organization Level Policy Administrators can set the policies at the Organization level under the Policies tabs. ![](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/06/organization_settings_-_policies_-_ttl.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=53212fcb4d6adc7c732ce8b517449a3d) ### Project Level Project Admins can find the new settings in Project Settings > Policies tab. ![](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/06/project_settings_-_policies_-_ttl.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=1901942dab3d7065f275624ef755aa7f) The defaults are to use the settings from the Organization policy, but you can override it for each project. You can read more about TTL policies [here](/guides/policies-governance/policy-ttl). # CloudFormation Support Source: https://docs.envzero.com/changelogs/2022/07/cloudformation-support Manage AWS CloudFormation stacks in env zero with continuous deployment, RBAC policies, custom flows, and workflow orchestration alongside other IaC tools. We're happy to announce that from today, CloudFormation joins Terraform, Terragrunt, Pulumi, and Kubernetes as a core IaC tool supported in env zero! [AWS CloudFormation](https://aws.amazon.com/cloudformation/) lets you model, provision, and manage AWS and third-party resources by treating infrastructure as code. With CloudFormation, you declare all your resources and dependencies in a template file. The template defines a collection of resources as a single unit called a stack. CloudFormation creates and deletes all member resources of the stack together and manages all dependencies between the resources for you. Manage your CloudFormation stack within env zero, to enjoy [features](/guides/getting-started/getting-started), such as [Continuous Deployment](/guides/admin-guide/environments/continuous-deployment), [Policies](/guides/policies-governance/policies) and [RBAC](/guides/admin-guide/user-role-and-team-management/rbac). You can also use [Custom Flows](/guides/admin-guide/custom-flows) to alter the deployment by running commands, or [Workflows](/guides/admin-guide/workflows) to orchestrate multiple IaC stacks and dependencies between them. ### Get Started CloudFormation uses either YAML or JSON template file to describe the resources that are managed by it. To manage your CloudFormation stack using env zero, you will need to create a new CloudFormation template, or run an [environment without template](/guides/admin-guide/environments/setting-up-a-new-environment#based-on-a-direct-vcs-integration) and choose type CloudFormation. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/07/cc8099b-cf-type.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=2ceaa1d5afd0339f627b27d4f75e0c83) Learn more about [CloudFormation support](/guides/admin-guide/templates) in env0. # Terragrunt run-all support Source: https://docs.envzero.com/changelogs/2022/07/terragrunt-run-all-support Run multiple Terragrunt modules in one deployment with run-all in env zero, enabling CI/CD, drift detection, and cost estimation across all modules at once. env zero supports a wide variety of IaC platforms, including [Terragrunt](https://terragrunt.gruntwork.io/), but up until now it lacked the support for running multiple modules at the same deployment, a feature that is supported by Terragrunt's [run-all command](https://terragrunt.gruntwork.io/docs/features/execute-terraform-commands-on-multiple-modules-at-once/#the-run-all-command). Another advantage is the ability to define dependencies between Terraform modules in code. Today we are proud to deliver this support out of the box with env zero! ### Terragrunt run-all support env zero now supports the `run-all` command, which will allow you to utilize all of its features for multiple modules in the same environment: CI/CD, drift detection, cost estimation, and more. Within Terragrunt template configuration, under `Advanced` settings - check `Execute run-all commands on multiple modules` ![Screen Shot 2022-07-04 at 9.12.13](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/07/screen_shot_2022-07-04_at_91213.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=42f64b49aeffbfe3be1d0e1741663d7a) **Version Support** The minimum supported Terragrunt version for run-all is **0.28.1**. When you use a template with `Execute run-all commands on multiple modules` configuration, env0 runs the `terragrunt run-all` command for you, and every module in your templates project is deployed simultaneously. # HashiCorp Vault Support For Self-Hosted Agent Source: https://docs.envzero.com/changelogs/2022/07/vault-hashicorp-vault-support Resolve HashiCorp Vault secrets automatically on each deployment using the env zero self-hosted agent, keeping credentials within your private network. Self-hosted agents allow you to run your env0 deployment workloads on your own infrastructure. This gives you the ability to isolate your infrastructure as code deployments in a more secure way, within your private network. This also allows you to manage your secrets in your preferred secret manager. Today you can also store those secrets natively inside Hashicorp Vault, and give your agent the ability to resolve those secrets for each deployment automatically. ### Configure Vault > [!WARNING] > > **Vault Integration** > > As mentioned above, this feature is only available with Self-Hosted agents. However, with the SaaS, this can also be achieved manually using our [custom flow](/guides/admin-guide/custom-flows). > > In order to integrate your self-hosted agent to read your Vault secrets, you will need to configure the Vault URL and token for authentication, and env0 will take care of the rest. > Read all about it in our [docs](/guides/admin-guide/variables) and also how to configure it [here](/guides/admin-guide/self-hosted-kubernetes-agent) # Logs forwarding to Coralogix Source: https://docs.envzero.com/changelogs/2022/08/log-forwarding-to-coralogix Forward IaC deployment logs from env zero to Coralogix for centralized monitoring, metrics, traces, and analytics alongside your other observability data. Splunk, Datadog, and Logz.io are not enough? Add [Coralogix](https://coralogix.com/) to that list! Centralized log systems have been around for a long time, and in today's world, they are more than just log aggregators. Metrics, traces, analytics, and other valuable tools are all rolled up into logging systems. Today we've added integration between env zero and Coralogix - to forward all of your infrastructure deployments from env zero, giving you the ability to monitor, track and analyze logs with the power of a great tool like Coralogix. ### Setup up the integration in the env zero platform Follow Setting up Coralogix is really simple - just follow [this short guide](/guides/integrations/logs-forwarding/coralogix) # OpenID Connect (OIDC) Support Source: https://docs.envzero.com/changelogs/2022/08/oidc-support Authenticate to cloud providers using short-lived OIDC JWT tokens generated per deployment in env zero, removing the need to store long-lived credentials. OpenID Connect (OIDC) is a simple identity layer on top of the OAuth 2.0 protocol. It allows clients to verify the identity of a user or an application based on the authentication performed by an Authorization Server. This will enable you to securely interact with 3rd party applications like your cloud provider. Now with env zero, each deployment can have an integration with OIDC and provides an OIDC short-lived token (JWT) for you to authenticate to any other 3rd party application. ## Setup Up OIDC A JWT token could be available during deployment as an environment variable called `ENV0_OIDC_TOKEN`. Organization admins can enable this feature by toggling the related checkbox which exists in the organization's policies tab. ![Screen Shot 2022-08-07 at 17.15.44.png](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/08/screen_shot_2022-08-07_at_171544png.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=e510955bbd45c186215dafd45f3b1b9b) To learn more [read more here about this integration](/guides/integrations/oidc-integrations) > For Self-Hosted Agents > > If you'd like to enable this feature on your self-hosted agent, please update to the latest version. # Removing Python 2, and other 3rd party updates. Source: https://docs.envzero.com/changelogs/2022/09/removing-python-2-and-other-3rd-party-updates Breaking changes in the env zero deployment container: Python 2 removed, Alpine updated to 3.16, and Node, AWS CLI, and Azure CLI versions upgraded. To improve the security of our system we periodically update 3rd party software we are using. On **2022 Oct 30** we are going to release a massive update to the env0 [deployment container](/guides/admin-guide/custom-flows#the-deployment-container), but unfortunately, this will introduce breaking changes and we want to give you a heads up, so you can prepare in advance. > If you are not using [custom flows](/guides/admin-guide/custom-flows) you shouldn't notice any difference. ### Alpine Linux update We are updating our container's base image from `alpine:3.11` to `alpine:3.16`. ### Python 2 has been removed Our container will not have `python2` anymore, `python` and `pip` will pointing to `python3` and `pip3` respectively. ### Other updates | | Old version | New version | | :- | :- | :- | | Alpine Linux | 3.11.12 | 3.16.2 | | bash | 5.0.11(1)-release | 5.1.16(1)-release | | NodeJS | 16.10.0 | 16.17.0 | | npm | 7.24.0 | 8.19.2 | | yarn | 1.22.5 | 1.22.19 | | git | 2.24.4 | 2.36.2 | | python2 | 2.7.18 | **Removed** | | pip2 | 18.1 | **Removed** | | python3 | 3.8.2 | 3.10.5 | | pip3 | 20.2 | 22.1.1 | | aws (AWS CLI v1) | 1.18.115 | 1.22.77 | | az (Azure CLI) | 2.28.1 | 2.40.0 | | pwsh (PowerShell) | 7.0.3 | 7.2.6 | | jq | jq-master-v20191114-85-g260888d269 | jq-master-v20220328-1108-g836ca403de | | OpenSSL | 1.1.1g | 1.1.1q | | OpenSSH | 8.1p1 | 9.0p1 | # Business Tier now available in AWS Marketplace Source: https://docs.envzero.com/changelogs/2022/10/business-tier-now-available-in-aws-marketplace Subscribe to env zero directly through AWS Marketplace, consolidating billing and procurement for all env zero subscription tiers within your AWS account. It's now possible to use [all env0 subscriptions](https://aws.amazon.com/marketplace/seller-profile?id=55540b66-733b-4d1f-b4fd-84a376407155) directly from the AWS Marketplace! AWS Marketplace makes it easy for customers to find, buy, deploy and manage software solutions. If you're already using AWS, subscribing to env0 is simple through the Marketplace. # Custom Roles Source: https://docs.envzero.com/changelogs/2022/10/custom-roles Define custom RBAC roles in env zero with fine-grained permission sets, assignable to individual users or teams at the organization or project level. Custom Roles have arrived - now you can have fine-grained control over what users can and can't do. env zero's Custom Role allows you to restrict access based on predefined roles of individual users and teams within your organization. It helps ensure users access only information they need to do their jobs and prevents them from accessing information that doesn't pertain to them. ### Role Creation & Management First, create a role with your desired permissions. This can be done in the organization settings page -> roles tab -> add role button. You can also edit or delete roles from that page. > More On Role Deletion > > When roles are deleted while being assigned the users \ team will update according to the role assignment level: > If the role assignment level is by organization, the user will receive the default "User" role. > If the role assignment level is by project the user will lose his access to that project and have no role in it. ### Role Assignment Roles can be assigned to users or to teams on a project or organization level. "Organization Roles" - can be assigned on the organization settings page in either the users or teams tab. "Project Roles" - can be assigned on the project setting page in either the users or teams tab. > More On Role Assignment > > env zero's RBAC is cascading, meaning that if a user has a permission on an organization (via the role) he has that permission on every project in that organization. (but not the other way around, project permissions apply for their particular projects only) # env zero - The Game Source: https://docs.envzero.com/changelogs/2022/10/env0-game An easter egg from env zero's hackathon: double-click an active deployment status to launch a browser game while you wait for the deployment to complete. Tired of staring at the monitor while your deployments are in progress? Introducing: **env zero - The Game** As part of env zero's 2nd Hackathon, one of the amazing teams came up with a solution to make your deployments a bit more enjoyable. While your environment is deploying, you can double click its status to reveal this easter egg. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/10/7a0a9cb-env0-game-3.gif?s=87d38534c336a80f22b5fc338762b216) Now go and set the office's high score # Mobile support Source: https://docs.envzero.com/changelogs/2022/10/env0-mobile-support Manage env zero environments from mobile browsers at any resolution, with a streamlined view showing key environment status and cloud insights on the go. Now you have a full view of your cloud environment on the go - managing your environments just got simpler. It's now possible to access the env zero app using a mobile device. We're happy to announce that the env zero app is now available on mobile browsers in any resolution. The mobile view is slimmed down, giving you visibility of the important things and insights into your cloud environments. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/10/602232a-untitled_google-pixel4xl-ohsoorange-portrait.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=86a968706087c3ac36bfa8b31083fbb4) # OIDC Additional Claims Source: https://docs.envzero.com/changelogs/2022/10/oidc-additional-claims env zero OIDC tokens now include projectId, templateId, environmentId, and deployerEmail claims for fine-grained authorization in AWS IAM and other systems. env0 enables easy OIDC integration by passing an environment variable named `ENV0_OIDC_TOKEN` to your deployments - its value contains a short lived OIDC token (JWT) for authentication via a third party application. ## Improved Authorization Your authorization server can use our newly added claims for more secure and fine-grained authorization, for example, here are a few possible verifications: * Only a specific team can deploy to a specific environment * A specific template can only be deployed to your `dev` / `staging` projects and not to the `production` project * Enforce a workspace name pattern in your organization We added the following claims to the OIDC token: * `organizationId` * `projectId` * `templateId` * `templateName` * `environmentId` * `environmentName` * `workspaceName` * `deploymentLogId` * `deployerEmail` Learn more about [OIDC integration](/guides/integrations/oidc-integrations). # Remote Backend Source: https://docs.envzero.com/changelogs/2022/10/remote-backend Store Terraform state in env zero's Remote Backend with automatic configuration, state locking, version history, and support for authenticated local runs. Terraform uses persisted state data to keep track of the resources it manages. Most non-trivial Terraform configurations use a [backend](https://www.terraform.io/language/settings/backends/configuration) to store the state remotely. This lets multiple people access the state data and work together on that collection of infrastructure resources. Terraform offers several state storage options, of which env zero supports [Remote Backend](https://www.terraform.io/language/settings/backends/remote), which has some great benefits such as: * **No underlying infrastructure setup and management** - env zero takes care of the setup as opposed to other approaches, where you need to do all the setup and management yourself (for example, [S3 Backend](https://www.terraform.io/language/settings/backends/s3) requires you to create an S3 Bucket and an optional DynamoDB Table for locking beforehand) * **Security** - env zero stores the state securely for you and assures only you can access it * **State consistency** - Remote Backends assure that users won't overwrite each other's state with a locking mechanism and that they receive the most recent state on every Terraform operation * **Local runs** - By providing the Remote Backend configuration and a successful [login](/guides/admin-guide/remote-backend/login), users can run Terraform operations locally while still working on a shared state. Using env zero's Remote Backend has additional advantages: * **No Terraform Backend configuration when running inside env zero** - you don't have to provide any type of configuration; you just deploy your code as is, and env zero will automatically configure it to use the Remote Backend * **States UI** - view the current version of your state as well as all of the previous versions * **Correlation of Deployment to State** - figure out which deployment is responsible for a specific change to your state After successfully deploying an environment with a remote backend, you would have access to the **"States"** tab in the environment page, in which you could view all state versions of a specific environment & downloading them. ## Use Remote Backend In Your Environments You can configure your Environment to use Remote Backend by following this [simple guide](/guides/admin-guide/remote-backend#use-remote-backend-in-a-new-environment) ## Suggested Blog Content [Terraform Modules Guide](https://www.envzero.com/blog/terraform-modules) [Terraform Plan Examples](https://www.envzero.com/blog/terraform-plan) [Managing Terraform Variable Hierarchy](https://www.envzero.com/blog/managing-terraform-variable-hierarchy) [ Manage Terraform Remote State with a Remote Backend](https://www.envzero.com/blog/terraform-remote-state-using-a-remote-backend) # SAML Admin Group Integration Source: https://docs.envzero.com/changelogs/2022/10/saml-admin-group-integration Map SAML IdP groups to org-admin roles in env zero using a naming convention, automatically granting admin permissions to all users within matching IdP groups. env0 already offers to keep your env0 teams in sync with your SAML IdP groups, and Today we're announcing an extension of that - allowing you to set up a Group or Groups in your IdP that follows a specific convention of your choice, and env0 will automatically grant users in those groups Organizational Admin permissions. This advanced new feature can come in handy if you have (or planning to have) such groups which contain all users that should be Organization Admins on env0. More about how to use and enable it can be found [here](/guides/sso-integrations/importing-roles-or-groups-from-your-identity-provider). # Audit Log Source: https://docs.envzero.com/changelogs/2022/11/audit-log Track organization activity in env zero audit logs, showing who performed each action, when it occurred, and detailed metadata, accessible via the UI or API. The audit log lets you view recent activities across your organization. The audit log contains information about who performed the activity, when the action was performed, the activity's description, and additional data. You can access the audit log from the UI or programmatically through the env0 API. ## Accessing the audit logs ### Through the env0 UI 1. Go to the Organization's **Settings** page. 2. Click the **Audit Logs** tab. 3. The audit details are listed in a table. 4. Click the row's **+** sign to reveal additional activity details. 5. Click the **Show more** button at the bottom of the page to see more rows. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/11/b351565-screen_shot_2022-11-08_at_13.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=74d6fd310afba37e6fb64d91865e5937) ### Through the env0 API Use the ["Fetch Audit Logs" API](/api-reference/audit-events/fetch-audit-logs) to retrieve your organization's audit logs programmatically. Learn more about the audit log in our [documentation](/guides/admin-guide/audit-logs). # Personal API Keys Source: https://docs.envzero.com/changelogs/2022/11/personal-api-keys Generate personal API keys tied to your user account in env zero for the Terraform Provider, REST API, or Remote Backend, inheriting your RBAC permissions. In addition to our web app, you can deploy and interact with env0 using any of these three major options - Terraform Provider, Directly invoking the API, and our Remote Backend. All of the mentioned options require an `API Key` to be passed so we can authenticate, authorize and audit all your actions in env0. The most convenient approach to generating an API Key is to generate a `Personal API Key`. A `Personal API Key` is an API Key linked to your actual user. It is directly linked to your user account, and therefore it will have the same permissions your user has and will share all of your user's details (such as your avatar and email address). ## Generating a Personal API Key Generating a `Personal API Key` is fairly simple: 1. Click on your avatar in the top right corner 2. Click on `Personal Settings` ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/11/0aee9ff-screen_shot_2022-11-13_at_18.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=a31704b3d6c25094f37afedffd8e98cb) 3. Click on the `Personal API Keys` tab 4. Click on `Add Personal API Key` and insert a name for your key ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/11/1620c68-screen_shot_2022-11-17_at_15.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=4fb3b2e7719a2c4269830a1402f26bb5) 5. Copy the values you need (either for the `API` / `Remote Backend` / `Terraform Provider`) ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/11/866a969-screen_shot_2022-11-20_at_11.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=8b7512e5686ea812b36098019cd945d6) > Personal API Key Permissions > > The generated `Personal API Key` will be coupled with your user. It will have the exact same permissions as the user that generated it (not only at the time of creation, it will keep updating as your permissions change). # Project Costs Source: https://docs.envzero.com/changelogs/2022/11/project-costs View aggregated cloud costs for entire projects in env zero, with cost graphs providing organization-level spending visibility beyond per-environment estimates. Env zero has long provided cost estimations for your environments. Now, we also provide the actual cost of your projects, giving you a better overview of an aggregate cost of a specific project within your organization, and can control and monitor your cloud spending. ### Viewing your Project cost To see the project's cost data, you must have the "Edit Project Settings" permission. Once you have that permission, you will see the following item in the project's menu: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/11/8e4c385-projectcostsmenuitem.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=9c22b354bcb66f5b7f32db90e4b000f5) Clicking it will display the project cost graph: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/11/81bc5b9-project_hourly_costs.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=8bc7e35cd09f16e67dcfbc41f74f28d4) # Azure DevOps Integration Source: https://docs.envzero.com/changelogs/2022/12/azure-devops-integration Connect Azure DevOps repositories to env zero to create templates, manage private modules, and enable continuous deployment from your Azure DevOps projects. env0 is all about making IaC management easier. One of the most enabling capabilities we have for achieving this goal is VCS integration. Until recently, we had full support only for GitHub, GitLab, and Bitbucket, along with their on-premise products. And now, env0 is proud to present Azure DevOps integration - create templates, and private modules and enable continuous deployment features for repositories from Azure DevOps. Read more about it in our [docs](/guides/admin-guide/templates/azure-devops-integration) ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/12/2dcf6f7-image.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=05ae0a56797461b63ab95513bc23c099) ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/12/9c57825-image.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=6a86b9da797ed5be1712d1538cea5473) # Log Forwarding to Google Cloud Logging Source: https://docs.envzero.com/changelogs/2022/12/log-forwarding-to-google-cloud-logging Forward IaC deployment logs from env zero to Google Cloud Logging, centralizing infrastructure data alongside other GCP observability and monitoring sources. Centralized log systems have been around for a long time, and in today's world, they are more than just log aggregators. Metrics, traces, analytics, and other valuable tools are all rolled up into logging systems. Today we've added integration between env0 and Google Cloud Logging. env0 can now forward your infrastructure deployment logs, giving you the ability to monitor, track and analyze logs. This integration is an addition to the [existing integrations](changelog:logs-forwarding-to-datadog-splunk-and-logzio)l. ## Google Cloud Logging setup Follow Setting up Google Cloud Logging is simple - just follow [This guide](/guides/integrations/logs-forwarding/gcp-logging) ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/12/5d62842-google-logs.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=4bfffdcc020efef4529957b6b02c5922) # Private Module Registry - Folder Based Modules Source: https://docs.envzero.com/changelogs/2022/12/module-registry-modules-from-path Store multiple Terraform modules in a single repository using the env zero Private Module Registry's folder-based module support, reducing repository sprawl. The env0 Module Registry is a private registry for Terraform modules, allowing you to share and reuse Terraform modules within your organization privately. Now you can manage multiple modules in the same repo by creating folders inside the same repo for each module, which gives you the ability to manage all of your modules in one repo. ## Usage When [adding a module to the registry](/guides/admin-guide/private-registry/modules#adding-a-module-to-the-registry) add the folder where module files are stored (Defaults to the root folder of the repository). ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/12/a152ad4-module_vcs_selection_with_folder.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=cf5ec02a7a77fac2531aae887f168936) > Self-Hosted Agents > > If you'd like to enable this feature on your self-hosted agent, please update to the latest version. ### What is a Private Module Registry? You can read more about it : 1. in this [blog post](https://www.envzero.com/blog/module-registry-and-terraform-provider-updates) 2. env0 docs - [Module Registry](/guides/admin-guide/private-registry/modules) 3. Video: [YouTube embed](https://www.youtube.com/embed/kxbuAE-4ARg?feature=oembed) ## Suggested Blog Content [Terraform Modules Guide](https://www.envzero.com/blog/terraform-modules) [Terraform Plan Examples](https://www.envzero.com/blog/terraform-plan) [Managing Terraform Variable Hierarchy](https://www.envzero.com/blog/managing-terraform-variable-hierarchy) [ Manage Terraform Remote State with a Remote Backend](https://www.envzero.com/blog/terraform-remote-state-using-a-remote-backend) # Plugins Source: https://docs.envzero.com/changelogs/2022/12/plugins Add security scanners, policy enforcement, and notification integrations to IaC deployments using env zero Plugins defined in your env0.yaml configuration file. With env zero, you can keep your development organization's best practices for managing and executing Infrastructure as Code. Today we are happy to announce that we developed Plugins to make software development lifecycle tools and processes easier to integrate. ## Usage > This is an opt-in feature > > To use a plugin in your env0.yaml file, you need to set its version to 2. If you wish to change an existing env0.yaml file to version 2, please follow the [migration guide](/guides/admin-guide/custom-flows/version-2-schema) Using env zero plugins is done via your env0.yaml file. This is an example of how to use the [OPA plugin](https://github.com/env0/env0-opa-plugin): ```yaml theme={null} version: 2 deploy: steps: terraformPlan: after: - name: OPA use: https://github.com/env0/env0-opa-plugin input: path: bundle-file-path flags: --fail --format=raw query: data.example.violation[x] ``` [Check out env0's supported plugins and integrations](/guides/integrations/plugins). ## Custom Plugins You can also quickly create an env0 plugin of your own. To get started: 1. Open a new public Git repository. 2. Create an *env0.plugin.yaml* file that describes and configures your plugin's execution runtime and required inputs. 3. Use it in your *env0.yaml* file. [Read more about how to create a custom env0 plugin file](/guides/integrations/plugins). > Self-Hosted Agents > > If you'd like to enable this feature on your self-hosted agent, please update to the latest version. ## Suggested Blog Content [What is tfsec: Benefits, Key Features, and Examples](https://www.envzero.com/blog/best-iac-scan-tool-what-is-tfsec) [What is Checkov: Benefits, Key Features, and Examples](https://www.envzero.com/blog/best-iac-scan-tool-what-is-checkov) [What is Terrascan: Benefits, Key Features, and Examples](https://www.envzero.com/blog/best-iac-scan-tools-what-is-terrascan) [Best IaC Scanning Tools](https://www.envzero.com/blog/best-iac-scan-tool) # Project Level Custom Flow Source: https://docs.envzero.com/changelogs/2022/12/project-level-custom-flow Apply one shared custom flow YAML to all project environments in env zero, sourced from a separate repository to separate IaC code from deployment policies. Project-level Custom Flows enable you to move a custom flow out of the main repository. Now you can configure a single custom flow file for all environments within a project by pointing to a different custom-flow yaml file. Because this custom flow file can be located in a separate repository, it is possible to separate the actual infrastructure code from your deployment policies and scripts that you would like to run on every deployment. ### Enabling Project Level Custom Flow This new setting is available in **Project Policies** section. Here is an example of defining a common OPA policy within a project: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/12/5d13e05-image.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=1fb04906ff519d516c36d9283c6e40b9) After enabling, any environment deployment within the project will use this custom flow file. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2022/12/bd0c9a1-image.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=598aa04adcf6c308e8cb8e1493749929) Learn more about `Project-level custom flow` in our [documentation](/guides/admin-guide/custom-flows/project-level-custom-flow). # Deployment Comments Source: https://docs.envzero.com/changelogs/2023/01/deployment-comments Add markdown comments to deployments, environment creation, destruction, and tasks in env zero to record context and improve team communication around changes. Effective communication is crucial for any team, and this is especially true when it comes to deployments. It can be difficult to understand the reasoning behind a deployment and how it fits into the bigger picture. That's where the Deployment Comments come in - you can add a comment to various actions, such as deployments, environment creation and destruction, running tasks, and more. Adding a comment lets you provide context and explanations for why the action was taken, and better understand the reasoning behind changes, and make it easier to track and communicate about those changes within a team. ## Adding a Comment Adding a comment is simple as it sounds - write whatever you want in the "Comment" input. Markdown syntax is supported, providing more formatting options for users to convey their message better. ![Deployment comment input interface showing comment field with markdown support](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2023/01/37dca1e-screenshot_2023-01-19_at_14.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=0634707e22992e6eefb94ec942ef04eb) Any comment would be visible in the deployment details section. ![Deployment details section showing displayed comment with formatting](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2023/01/f36fb9f-screenshot_2023-01-19_at_15.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=300656114f7d6d0594f48e90d1d1d717) Additionally, as long as a comment is provided - it will be displayed in any sent [notifications](/guides/integrations/notifications). # Environment Locking Source: https://docs.envzero.com/changelogs/2023/01/environment-locking Lock environments in env zero to block deployments and changes, with a visible banner showing which admin locked it, when, and the reason provided. Many teams have critical infrastructure that needs to be protected from unplanned or accidental changes. Now, with env0 Environment Locking, project or organization administrators are able to lock an environment to prevent users from making changes. ## Locking an Environment Locking an environment in env0 to protect it from changes, additional deployment, or accidental destruction is done from the environment's advanced context menu, click on "Lock Environment". ![Environment context menu showing Lock Environment option in advanced settings](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2023/01/8b9982d-image.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=22e4d66e2fb71865ce92e78e4a0d9794) Locked environments display a banner explaining who locked it when they locked it, and a reason why the admin locked it. If you have permission, you will also see a button to release the lock. ![Locked environment banner showing lock details, admin information, and unlock button](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2023/01/a0b9885-image.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=7ca178e3ca1364c1fffa9f255622feb8) Check our documentation to [learn more](/guides/admin-guide/environments/environment-locking). # Remote Plans Source: https://docs.envzero.com/changelogs/2023/01/remote-plans Run terraform plan locally with uncommitted code while executing inside env zero, enforcing your organization's governance policies and audit requirements. Centralizing Terraform execution is a great way to make sure you have effective IaC governance. While it's preferred that teams directly use env zero to run IaC, sometimes you just need to run a terraform plan locally. Now, with env zero Remote Plans, you can run `terraform plan` locally - even with uncommitted code - and the run will be executed inside the env zero Platform, keeping with your organization policies, governance, and auditing requirements. ## Running a Remote Plan ![Remote Plan execution interface showing terraform plan command execution in env zero platform](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2023/01/3b838b3-image_5.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=0c5bdd5e569424dffb4552e20492a378) To run a remote plan your env zero environment needs to be using the env zero [Remote Backend](/guides/admin-guide/remote-backend). Once you create a [personal API key](/guides/admin-guide/user-role-and-team-management/api-keys#personal-api-key) and use the [login](/guides/admin-guide/remote-backend/login#local-login-to-env0-remote-backend) command, every time you will run a `terraform plan` command, env zero will handle the execution. For more information, please visit our [docs](/guides/admin-guide/remote-backend/remote-plan). ## Suggested Blog Content [Terraform Modules Guide](https://www.envzero.com/blog/terraform-modules) [Terraform Plan Examples](https://www.envzero.com/blog/terraform-plan) [Managing Terraform Variable Hierarchy](https://www.envzero.com/blog/managing-terraform-variable-hierarchy) [ Manage Terraform Remote State with a Remote Backend](https://www.envzero.com/blog/terraform-remote-state-using-a-remote-backend) # Workflow Enhancement Source: https://docs.envzero.com/changelogs/2023/01/workflow-settings-enhancement Configure per-environment variables, revisions, and workspace names when creating or deploying env zero Workflows, customizing each sub-environment separately. Creating a workflow is a great way to have a deployment of your infrastructure and create dependencies between different parts of your infrastructure, allowing you to manage your infrastructure as you scale. However, you may want to have different variables and settings for each part, so today you can do it when creating or deploying a new Workflow. ## Workflow Settings A [Workflow](/guides/admin-guide/workflows) is an Environment that instead of managing a single IaC, manages multiple and their respective dependencies. When creating or deploying a new Workflow you can choose each environment inside the Workflow and set different variables, revisions, and workspace names for each environment. ![Workflow settings interface showing individual environment configuration options for variables, revisions, and workspace names](https://mintcdn.com/envzero-b61043c8/4i75qYgyhlssLgkA/images/changelogs/2023/01/c905b77-image.png?fit=max\&auto=format\&n=4i75qYgyhlssLgkA\&q=85\&s=8d457e8abbcec40215573bb8cafac8ea) You can read more about this feature [here](/guides/admin-guide/workflows/create-a-new-workflow). # Custom TTL Policy Source: https://docs.envzero.com/changelogs/2023/02/custom-ttl-policy Set any TTL duration in months, weeks, days, or hours for env zero environments at the org or project level to prevent resources running indefinitely. One potential side affect of empowering development teams with self-service access to cloud resources is that systems and services may be left running, and unused for long periods. This is wasteful, and potentially dangerous. env0 has already had the ability to define a Time-To-Live (TTL) for an environment, but you can now set custom TTL policies per project to ensure that no resources are left behind. ## Setting Custom TTL Policies Many customers wanted to be able to set the Max and Default TTL policies to a custom value of their choice and not to be limited (pun intended) to the predefined set of durations. We added the ability to choose any TTL duration you want (Months, Weeks, Days, Hours). Those policies can be set at the Organization level or inside a specific Project. ![Organization settings new TTLs](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/02/organization_settings_new_ttls.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=a014d52b16835dceb8189bdb17233ce0) Organization settings new TTLs ![Project settings new TTLs](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/02/project_settings_new_ttls.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=171e15393f39ee45445faff76e8f96da) Project settings new TTLs # New Integrations - Plugins and Sumo Logic Source: https://docs.envzero.com/changelogs/2023/02/new-integrations-plugins-and-sumo-logic New env zero plugins include TFLint, TFSec, Trivy, and Lightlytics, plus a new Sumo Logic log forwarding integration configurable from Organization Settings. env0 Plugins make it easier to integrate a variety of software development lifecycle tooling with infrastructure as code, including notifications, security, policy enforcement, log forwarding, and more. Today we've added more. ## New Plugins env0 platform offers out-of-the-box plugins that offer integrations with 3rd party tools that give you more capability on top of your infrastructure as code deployments. Here are the new plugins that we've added recently: 1. [TFLint](https://github.com/terraform-linters/tflint) 2. [TFSec](https://github.com/aquasecurity/tfsec) 3. [Trivy](https://github.com/aquasecurity/trivy) 4. [Lightlytics](https://www.lightlytics.com/) 5. [Import Variable Plugin](/guides/integrations/plugins/import-variable-plugin) If you'd like to see the complete list of the plugins, [read more here](/guides/integrations/plugins), or learn how to create your [own plugin](/guides/integrations/plugins#how-to-create-a-new-env0-plugin) ## New Log Forwarder Sumo Logic provides cloud monitoring, log management, Cloud SIEM tools, and real-time insights for web and SaaS-based apps. env0 can send all of your deployment logs directly to your Sumo Logic account - [read more here](/guides/integrations/logs-forwarding/sumologic) ## Integrations Page All of those integrations can be located in the application, under the `Organization settings` in the `Integrations` tab. ![Plugins integration overview showing available plugin options and configuration](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/02/plugins.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=73879e568a29f65b5a9c400811284fb4) Plugins ![Log forwarding integrations overview showing supported platforms and configuration options](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/02/log_forwarding.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=6f0c7571751be910b9a8d9d77c59bb95) Log Forwarding # Sub Projects Source: https://docs.envzero.com/changelogs/2023/02/sub-projects Nest projects within projects in env zero using Sub Projects, with RBAC permissions cascading from parent to all child sub-projects in the hierarchy. As your organization's IaC use grows, it is increasingly challenging to organize all resources. With the addition of env0 Sub Projects, you can now access additional layers of granularity to model even the most complex of deployment structures, and effectively manage your resources and configurations across different teams. ## Sub Projects *Sub Projects* allow you to create a hierarchy of projects to manage, helping create a hierarchy for your environments and configurations. *Sub Projects* have similar configurations to *Projects* but are nested within other *Projects*. Each *Sub Project* may have unique *Environments*, *Templates*, *Variables*, and so on. Once you've set up your *Sub Projects*, you can view the entire project structure with ease. In the Projects menu, hover over Projects with an arrow next to them. This will allow you to see the *Project*'s *Sub Projects*. Clicking on the *Project* will let you see its environments or configurations. ![Projects menu showing project hierarchy with expandable arrows for sub-projects](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/02/projects_menu_showing_project_hierarchy_with_expandable_arrows_for_sub-projects.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=4e4d1485d2f855804ef9b9f3d16f0517) When choosing a *Project*, you may navigate to its *Sub Projects* page from the menu. ![Project navigation menu with sub-projects page option highlighted](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/02/projects_menu_showing_project_hierarchy_with_expandable_arrows_for_sub-projects.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=4e4d1485d2f855804ef9b9f3d16f0517) ## Creating a Sub Project In the *Sub Projects* page, clicking on *Create New Sub Project* will open a modal for creating a standard *Projects*, but the created *Project* will be associated with the current *Project* as its parent. ![Create New Sub Project modal dialog with project configuration form](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/02/create_new_sub_project_modal_dialog_with_project_configuration_form.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=66510cb902dea53c91670c7a612f23c2) ## RBAC for Sub Projects Each *Sub Project* inherits the *Roles* from its parent *Project* down to the root *Project*. So for example, if a team was granted the *"View Project"* permission, every person in the team would be able to view environment from the *Project*, its *Sub Projects*, its *Sub Projects'* *Sub Projects*, and so forth. This allows you to give users and teams permissions for multiple *Projects*, but also allows for granular permissions for specific *Sub Projects*. For more information, please visit our [docs](/guides/admin-guide/projects/sub-projects) # PR Comments With Role Based Access Source: https://docs.envzero.com/changelogs/2023/03/pr-comments-plan-and-apply-role-based-access Map VCS users to env zero custom roles so PR comment-triggered plan and apply enforce env zero RBAC, not just VCS repository commenter permissions. With env0, you can restrict the permissions of your organization's users through role-based access controls. You also have the ability to trigger Plan and Apply directly from your PR, however, one drawback is that the VCS provider sets your user's permissions. By default, anyone with comment permission on your repository can run a Plan or an Apply on your environments. Using our new Role Based Access feature for PR comment plan and apply, you can map your VCS provider user to your env0's custom roles, and enforce their permissions while using the PR comment flow. That way, having comment permission on your VCS provider won't be enough to deploy an env0 environment. ## Enforce PR Commenter Permissions To apply your env0 permissions to your VCS users you can navigate to Organization Settings > Policies and check the`Enforce PR commenter permissions on env0` option. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/03/68aa314-screen_shot_2023-02-28_at_10.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=daa7bc9b592c521977b6afa18cb63043) ## Setting Your VCS User Id on env0 Now that the feature is turned on, it is mandatory for every user across the organization who would like to use the PR comments flow, to set up a mapping of their VCS provider user. click on the avatar image in the top right corner, and click on `Personal Settings` to enter your profile page. In the `Profile` tab, enter your VCS Provider Id (see [our docs](/guides/admin-guide/environments/plan-and-apply-from-pr-comments#map-vcs-provider-user) to learn how to find it)`VSC Provider User ID` textbox and click on the `Save` button. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/03/896236b-screen_shot_2023-02-23_at_14.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=9e2d5082d480991d40063a3955f22bef) # Remote State Access Control Source: https://docs.envzero.com/changelogs/2023/03/remote-state-access-control Restrict access to Terraform remote state in env zero by specifying which projects and sub-projects are authorized to read that environment's state data. When working with Terraform, it's common to need access to the state of a remote backend environment. However, since this state can contain sensitive information, it's crucial to restrict access to prevent misuse. That's where env0's new remote state access control feature comes in. With it, you can specify who is authorized to access your environment's state. ## Setting Your Environment State Access To set up access control, go to the Environment -> Settings tab and select which projects are allowed to access the environment's state. You have the option to limit access to specific projects or their subprojects or allow access to all environments in your organization. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/03/d3bf3db-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=0cd894b81858f46937fdd6ccd9fcf327) By using this feature, you can ensure that only the right people have access to the sensitive information in your Terraform state. This helps you maintain the security of your infrastructure while enabling your team to work efficiently. After saving these settings only environments in the selected projects or their subprojects will be allowed to fetch that environment's state. See [our docs](/guides/admin-guide/remote-backend/state-access-control) for more information. ## Suggested Blog Content [Terraform Modules Guide](https://www.envzero.com/blog/terraform-modules) [Terraform Plan Examples](https://www.envzero.com/blog/terraform-plan) [Managing Terraform Variable Hierarchy](https://www.envzero.com/blog/managing-terraform-variable-hierarchy) [ Manage Terraform Remote State with a Remote Backend](https://www.envzero.com/blog/terraform-remote-state-using-a-remote-backend) # Private Plugins Source: https://docs.envzero.com/changelogs/2023/04/private-plugins Store env zero plugins in private Git repositories to integrate internal tooling, reuse org-specific code in custom flows, and keep proprietary logic private. [Plugins](/guides/integrations/plugins) are a great way to integrate 3rd party tools with env0. We encourage you to build your public plugin hosted on a public repo and also submit your plugin to our, ever-growing public, community-maintained plugins list. But now, with support for **private plugins**, you may now compose env0 plugins to integrate with internal tooling, reuse organization-specific code in your custom flow, and keep those tucked away in your own ***private*** git repository. See [our docs](/guides/integrations/plugins#storing-plugins-in-private-repositories) to learn more. # Private Provider Registry Source: https://docs.envzero.com/changelogs/2023/04/private-provider-registry Manage proprietary Terraform providers in env zero's Private Provider Registry, keeping custom provider binaries secure and accessible across your organization. As more and more organizations adopt Infrastructure as Code, managing third-party providers has become a critical challenge. While the open-source community has created an enormous variety of providers, many enterprises have unique requirements that require custom-built providers or specialized third-party solutions. That's where env zero's new **Private Provider Registry** feature comes in. With it, you can manage your Terraform providers privately across your organization. ## Creating A Provider As an env zero admin, you should have permission to create a provider. Navigate to `Registry` on the navigation bar, and click the `Providers` tab. There you will see the `Create New Provider` button. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/04/9e89b44-providers-list.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=af18657f4a7dbffb1a909181c73b7fc0) ## Managing Provider's Versions You can see instructions on how to use a provider, and a list of its supported versions and platforms by clicking its card and opening the provider page. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/04/06005d9-provider-versions.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=50182f6eac612fb96a3afbee33d4d20c) To learn how to set up the provider's versions fully, check out our [Provider Registry docs](/guides/admin-guide/private-registry/providers). By using env0's Private Provider Registry, you can ensure that your providers remain secure and proprietary, while still enabling your team to manage and share them across your organization. # Bulk Operations Source: https://docs.envzero.com/changelogs/2023/05/bulk-operations Deploy, destroy, lock, or run tasks on multiple env zero environments at once, selecting environments within a project or across projects from the dashboard. env zero's bulk operations feature is designed to simplify your workflow as your organization grows and your projects expand to multiple environments. With bulk operations, you can perform actions simultaneously on numerous environments, saving time and effort. ## Running a Bulk Operation ### Running a bulk operation in a specific project: 1. Go to your `Project Environments` page. 2. Click the kebab menu button at the top right of the list and select `Toggle selection mode`. 3. Choose the environments you want to include in the operation and click `Perform Action`. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/05/31d358a-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=ea6cc11951a6709d69a8d8f0ac5eae42) 4. The bulk operations wizard will appear, allowing you to select the operation you wish to execute. Supported operations include deploy and destroy, approval flow management, environment locking and unlocking, canceling queued deployments, running ad-hoc tasks, and marking as inactive. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/05/ce6ac9b-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=c639068cb1d9189f544beb5950654484) 5. For certain operations like `Deploy`, you can customize request settings on the `Details` step. If there's nothing to edit, you'll proceed directly to the `Summary` step. 6. In the `Summary` step, review, and approve your operation. Click `Done` to initiate the bulk operation. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/05/c0ed28c-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=54bdfff16a2c06441c927405c7ce5065) Your first bulk operation is in progress. ### Cross-Project Bulk Operations: To run a cross-project bulk operation: 1. Go to your `Dashboards` page 2. Choose the environments you want to include in the operation in the `Environments` widget, and click `Perform Action` in the top right corner: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/05/ee30668-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=086acd09ca1239a5c92f4e621d3835a5) 3. Follow instructions 4-6 at "To run a bulk operation in a specific project". Want to learn more? Check [our docs](/guides/admin-guide/environments/bulk-operations). # Environment RBAC Granularity Source: https://docs.envzero.com/changelogs/2023/05/environment-role-based-access-granularity Assign custom roles at the environment level in env zero, granting users or teams access to one environment without raising permissions across the project. With env0's current [RBAC granularity](/guides/admin-guide/user-role-and-team-management/user-management#manage-users-of-a-project), you could manage users or teams, and structure their permissions by associating roles on a given project. Now you will be able to assign those roles to a specific environment, without giving extra permissions to a whole project. This enhancement could give you a better way to depict your organization's needs allowing you to have better permissions granularity. ## Environment Role Assignments env0 allows you to create [Custom Roles](/guides/admin-guide/user-role-and-team-management/rbac) and assign them to a specific user (or team), on the global **Organization** scope, specific **Project**, and now also [in a specific **Environment**](/guides/admin-guide/environments/access). On the Environment page, you can now find the **Access** tab. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/05/dfe63ee-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=218355d39bfe497c287497e617a26d5a) There you can assign access to either **Users** or **Teams** to this specific environment. You can read more about it [here](/guides/admin-guide/user-role-and-team-management/rbac) # Moving Projects and Sub Projects Source: https://docs.envzero.com/changelogs/2023/05/moving-projects-and-sub-projects Move projects and sub-projects to different parent projects in env zero to reorganize your hierarchy without losing associated environments or configurations. With env0's [Sub Projects](/guides/admin-guide/projects/sub-projects) feature you could structure your projects in a way that better depicts your organization's needs allowing you to have better granularity. Now you will be able to edit this hierarchy and granularity with the ability to move projects to a different project or a sub-project. ## Moving Projects env0 now allows moving projects and sub-projects to re-structure your project's hierarchy in a way that suits your needs. In the Project Settings page, you can now find a **Move** button. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/05/eb87739-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=f29ff4eaa312b89dbd06bf5d5913a272) Using that button will open a popup allowing you to select which project you want the project to move into. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/05/eb87739-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=f29ff4eaa312b89dbd06bf5d5913a272) You can read more about this [here](/guides/admin-guide/projects/sub-projects#moving-sub-projects) # Project-Level Remote Backend Enforcement Source: https://docs.envzero.com/changelogs/2023/05/project-level-remote-backend-enforcement Enforce the env zero Remote Backend for all new Terraform environments in a project using the Force Remote Backend policy in project settings. Have you taken the env0 Remote Backend Terraform for a spin? You would probably want all of your project's Terraform environments to be created with the env0 remote backend. Now you can! Introducing our brand new project-level `Force env0 Remote Backend` policy that lets you enforce the use of the env0 remote backend throughout your project. ## Setting The Policy Go over to your project's settings -> policies: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/05/fccc06a-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=3672e31f9cc82894883efe38fee1408d) Tick the `Force env0 Remote Backend` checkbox & save: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/05/c3ab018-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=0c179618c2719c1acfe2aae187915d69) Now, every *new* Terraform environment, in this project, will be forced to have a remote state. See the ticked & blocked `Use env0 Remote Backend` checkbox in the environment creation view below: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/05/f3e1faa-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=aaa81472db9894e70435e713c2a80e30) For more information see [this](/guides/policies-governance/force-remote-backend) # AWS Session Tags for OIDC Source: https://docs.envzero.com/changelogs/2023/06/aws-session-tags-for-oidc env zero OIDC tokens now include AWS session tags via principal_tags claims, enabling IAM trust policies to enforce per-deployment access rules in AWS. With OpenID Connect (OIDC), clients can authenticate users or applications through an Authorization Server, ensuring secure interaction with third-party apps such as cloud providers. Though env0 supports OIDC and has special claims for authentication control, there were some limitations in using it with AWS. We have now integrated AWS with additional claims, allowing you to grant deployment-specific access to your AWS account. ## AWS Session Tags The OIDC token, with each env0 deployment, included [additional claims](/guides/integrations/oidc-integrations#format-of-the-openid-connect-id-token) like the organization id, project id, and deployer email, to give you more control over who can access your cloud account and with which role. However, with AWS you couldn't use the custom claims in your JWT token as other vendors allow. Instead, AWS supports session tags. Using your (AWS IAM Role) trust policy, you can verify those tags, and add rules on top of them as you please. Now, we added new claims to the JWT token that includes a new claim called `https://aws.amazon.com/tags` which will include a `principal_tags` section with the following claims: 1. `organizationId` - The env0 Organization ID 2. `projectId` - The env0 Project ID 3. `templateId` - The env0 Template ID 4. `environmentId` - The env0 Environment ID 5. `deployerEmail` - The email address of the user who created this deployment You can read more about how to [set it up with env0 here](/guides/integrations/oidc-integrations/oidc-with-aws) and more about [AWS Session tags here](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) > Breaking Change > > This introduces a breaking change! You will need to add the `sts:TagSession` permission to the role for any existing AWS Role authenticating with OIDC, whether you're using session tags or not. This feature will be released on the **19th of June**. ## Related Content [OIDC Integration](/guides/integrations/oidc-integrations) [OIDC With AWS](/guides/integrations/oidc-integrations/oidc-with-aws) [OIDC With AWS With Custom Claims](/guides/integrations/oidc-integrations/oidc-with-aws#custom-claims-with-aws-session-tags-optional) [AWS Session Tags](https://docs.aws.amazon.com/IAM/latest/UserGuide/id_session-tags.html) # Helm Support Source: https://docs.envzero.com/changelogs/2023/06/helm-support Deploy Helm charts as env zero environments with native approval flows, PR plan triggers, drift detection, TTL policies, and scheduling alongside IaC tools. [Helm](https://helm.sh/) is a popular package manager for Kubernetes, an open-source container orchestration platform. It simplifies the deployment and management of applications in Kubernetes clusters by providing a templating system and a standardized way to package, distribute, and deploy software. Helm is now a first-class framework in env zero alongside Terraform, Terragrunt, Pulumi, and Kubernetes. ## Helm - How does it work You can use Helm with all its advantages while enjoying all of the benefits env zero has to offer out of the box such as Approval flow, Plan on Pull Request, Drift Detection, TTL, Scheduling, and more! To manage your Helm deployments in env zero, you will need to create a new Helm template, or run an environment directly from a VCS and choose the type Helm: ![Helm template creation interface showing Helm as a deployment type option](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/06/9ac9703-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=8614530fafab8421db9f547e6c37fc5a) Other than that all the rest of the features are available for Helm as well. You can learn more about Helm templates [here](/guides/admin-guide/templates/helm). # 2 PR Plan and Remote Backend for Workflow Source: https://docs.envzero.com/changelogs/2023/06/pr-plan-and-remote-backend-for-workflow Enable remote backend storage for all sub-environments in a workflow and trigger PR plan executions across deployed workflow environments from a pull request. Creating a workflow is a great way to have a deployment of your infrastructure and create dependencies between different parts of your infrastructure, allowing you to manage your infrastructure as you scale. However, you may want to have different variables and settings for each part, so today you can do it when creating or deploying a new Workflow. Now we have two new enhancements when working with Workflow environments. ## Remote Backend In Your Sub Environments When creating a workflow you are now able to set it to use env zero's remote backend. That will make all its terraform sub environment use env zero's remote backend as well. All the rules regarding workspace names for templates and remote backend within env zero organizations still apply. ![Workflow configuration interface showing remote backend settings for sub environments](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/06/88b9dfd-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=5207415d95c579133d9b0ead7e4eff90) ## PR Plans for Workflow Environments By creating a Pull Request that targets your workflow environment, you can execute Plan on changes to your branch! It will trigger the Plan for all deployed environments that contain your workflow environment. Any change to the workflow file won't take effect. env zero will comment and set a commit check for each environment separately so you can keep track of the changes you made! ![Pull Request plan execution interface showing workflow environment plan triggers](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/06/095670d-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=46d0f13194b4bdd5fb61a92ec0d8e3ce) ![Pull Request comments and commit checks interface showing separate environment tracking](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/06/7897550-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=500d189bc1ef9c56137c5f986f13998a) ## Related Content [Workflow Creation](/guides/admin-guide/workflows/create-a-new-workflow) [Remote Backend](/guides/admin-guide/remote-backend) [Plan On Pull Request](/guides/admin-guide/environments/plan-on-pull-request) # Approval Policies Source: https://docs.envzero.com/changelogs/2023/07/approval-policies Apply OPA-based approval policies in env zero to cancel, pause for review, or approve deployments based on plan output, enforcing infrastructure guardrails. Guardrails are essential for managing infrastructure. While popular IaC tools make provisioning of resources easy, they often lack the capability to prevent changes when their outcome is not desired. Role-based access grants separation of concerns regarding different actions in the system, but is not flexible enough to prevent more granular changes that might happen to the infrastructure. ## Configuring Approval Policies env zero enables applying approval policies for the environments managed using the app. env zero leverages the power of the [Open Policy Agent](https://www.openpolicyagent.org/) engine to allow users to define custom policies for their deployed environments. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/07/267f119-project_policy_arrow.jpg?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=9bc26243e9794a98e313741c49f8d03f) ### Examples There are many cases where approval policies may come useful: * Requiring more than a certain threshold of approvers * Deny any change that its expected cost cross a predefined limit * Prevent removing critical resources from an environment * Allowing only a sub-set of users to change specific resources within an environment And the list can go on and on. Examples may be found in our [GitHub repository](https://github.com/env0/approval-policies) Read all about it in [our docs - Approval Policies](/guides/policies-governance/approval-policies) # env zero-Hosted Encrypted State Source: https://docs.envzero.com/changelogs/2023/07/env0-hosted-encrypted-state Use env zero-hosted encrypted state as a PVC alternative for self-hosted agents, encrypting the working directory with a customer-provided key in env zero. You can now use env zero-hosted encrypted state as an alternative to setting up [PersistentVolumeClaims](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) (PVCs) when using env zero's Self-Hosted Agents. env zero will encrypt (with a customer provided encryption key) the working directory and persist it in env zero's secure cloud native file system. Add a `"env0StateEncryptionKey"` key-value pair to your agent's `_values.yaml` to enable this. Find out more at [env zero-Hosted Encrypted State](/guides/admin-guide/self-hosted-kubernetes-agent/env-zero-hosted-encrypted-state). # Plan and Apply from PR comments support for Azure DevOps Source: https://docs.envzero.com/changelogs/2023/07/plan-and-apply-from-pr-comments-support-for-azure-devops Trigger env zero plan and apply operations for Azure DevOps pull requests using PR comments, without logging into the env zero platform directly. If you are not familiar with our Plan and Apply from PR comments feature, env0 lets you manage your Infrastructure as Code (IaC) deployments directly from your VCS provider. By commenting with env0 commands on a pull request, it is possible to interact with your env0 environments without the need to log in to the env0 platform. We now support Plan and Apply from PR comments for Azure DevOps. ## Invoking deployments from PR comments For full details about this feature follow the [env0 documentation](/guides/admin-guide/environments/plan-and-apply-from-pr-comments). Here are the main commands you can use: ### env0 plan command: `env0 plan -e {environments aliases}` - runs a plan on the env0 environments aliases. Aliases can be comma-separated if you like to run more than one environment. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/07/cfc6207-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=afd63a581964ccdef70bfae405e26455) ### env0 apply command: `env0 apply -e {environments aliases}` - runs apply on the env0 environments aliases. Aliases can be comma-separated if you like to run more than one environment. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/07/f79d0d4-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=094b049d87f9a5569e63aa8d527f049f) # Self Hosted Agents Monitoring Source: https://docs.envzero.com/changelogs/2023/07/self-hosted-agents-monitoring View the current state of all self-hosted agents from the Organization Settings Agents page in env zero, with a full overview of each agent's status. env zero now includes self-hosted agent monitoring, available directly within the env zero app. ## Monitoring Your Agent States With our new release, accessing critical information about your agents has never been easier. Navigate to the *Organization Settings > Agents* page, and you'll find a comprehensive overview of all your agents and their respective states. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/07/e9e1955-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=140f166596115c182f5d9fdca2ccf6a4) On the Agents tab, you can now quickly identify the status of each agent, which falls into one of the following categories: * `Active`: Indicates that the agent is functioning properly and is ready to execute deployment jobs. * Active agents are waiting for jobs to be assigned. * `Inactive`: No agent has been detected. The agent might not have been installed or not been able to reach env0. * 5 minutes of inactivity will mark the agent as Inactive. * `Degraded`: An agent that is able to poll env0 but not apply to start jobs. The degraded state indicates that the jobs are queueing up with no runners to execute them. * 5 minutes of a job waiting in queue will trigger the degraded state. > Supported Agent Version > > To take advantage of this enhanced monitoring functionality, make sure to update your agent to the latest version that supports agent version monitoring ([3.0.458 release](https://github.com/env0/self-hosted/releases/tag/v3.0.458)). Once your agent is up to date, you'll be able to view your agent versions in the env0 app. Stay on top of your self-hosted agents' performance and gain valuable insights into their states effortlessly, thanks to our latest monitoring feature. You can read more in [our docs](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-agents-monitoring) # Update Environment Variables without Deploying Source: https://docs.envzero.com/changelogs/2023/07/update-environment-variables-without-deploying Save changes to environment variables in env zero without triggering a deployment, so updates are staged and applied on the next redeploy. Using an infrastructure-as-code model, variables are used to customize certain aspects of a configuration for a specific deployment, without having to change the code. In this way, a single configuration can be used in different contexts to create different deployments. Now for an environment that already exists, you can also edit the variables settings under the environment *Variables* tab **without the need to trigger** a deployment. ## Saving Variables To change a variable, go to the environment page, and under the `Variables` tab change the relevant variables and click on the `Save` button. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/07/0648384-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=97c40fe59f3be47fadc8aa3ee43a2505) > Limits > > Changes to variables for an existing environment will not take effect until the environment is redeployed. When env0 runs a deployment, it stores the variable names to be used in undeploy so changes for an *Active* environment will not affect the undeploy process. # Native Kubernetes Authentication Source: https://docs.envzero.com/changelogs/2023/08/better-kubernetes-support Set up Kubernetes authentication natively in env zero using kubeconfig, AWS EKS, Azure AKS, or GCP GKE credentials with per-project cluster access control. As env0 supports various Infrastructures as code frameworks, each one has its own way of handling authentication in different ways. For Kubernetes, the authentication requires specific configuration. env zero adds native support to set up Kubernetes configuration via `kubeconfig`, `AWS EKS`, `Azure AKS` and `GCP GKE` credentials! This also means that you can control the authentication to a specific cluster based on the project settings. ## Set Up Kubernetes Credentials Navigate into `Organization Settings > Credentials`. Under `Deployment Credentials`, click the `+ Add Credential` button. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/08/c8ec425-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=2b399d63d402c6d218738e639f7a77c0) Inside the opened modal, select the desired Kubernetes Cluster authentication method you like. Select the `Kubernetes - ` credential from the `Type` dropdown: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/08/d0965d0-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=4639b010bae3270d46cda98c70a56094) Next, You'll need to associate the created credential with your project. In your `Project Settings`, click `Credentials`. Then, check the `Kubernetes` checkbox and select your created credential from the dropdown. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/08/05779aa-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=827fad77a8de9d0f1f239794ada27e2a) Lean more by reading our [docs](/guides/getting-started/connect-your-cloud-account#kubernetes) # Docker Deployment Agent Source: https://docs.envzero.com/changelogs/2023/08/docker-deployment-agent Run env zero self-hosted agents as Docker containers by pulling the Docker image and starting it, without needing a Kubernetes cluster or persistent storage. env zero now supports a Docker deployment agent. Deploy self-hosted agents by pulling the Docker image and starting it. With the docker approach, there's no longer a need to handle a Kubernetes cluster or worry about storage allocation. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/08/5c99b2c-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=22ff07c10e912013e894c0eda954126c) If you're curious to learn more, feel free to dive into our [documentation](/guides/admin-guide/self-hosted-kubernetes-agent/standalone-docker-agent) # Organization Costs Source: https://docs.envzero.com/changelogs/2023/08/organization-costs View cloud costs across all projects from the Organization Dashboard Cost tab in env zero, giving a complete picture of multi-project spending over time. One of env zero's most useful features is projects and environment cost monitoring, which gives you an accurate detail of your costs - over time. However - sometimes a higher level is needed, to see where several projects or your entire organization stands. Now - with Organization Costs, you can have the whole picture. You can view how much all of your projects cost together, and view several projects' costs. To do so - go to `Organization Dashboards`, and see your cost across the organization under `Cost` tab. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/08/0f8311d-screenshot_2023-07-26_at_17.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=4ac0b7854678a86b488cdd678a736c4d) Read more about costs in our [env zero documentation](/guides/cost-monitoring/cost-monitoring) # Budget Notifications Source: https://docs.envzero.com/changelogs/2023/09/budget-notifications Set project-level spending budgets in env zero and receive alerts when cloud costs cross weekly, monthly, or yearly thresholds via notification channels. With the env zero platform, you can automatically tag all your resources and monitor your cloud spending in various ways. You can now set up a budget per project to track spending and get notified when the cost surpasses your chosen thresholds. Configure your budget limit per week, month, or year, and the thresholds you want to receive notifications. ## Configure Your Budget If you enable [cost monitoring](/guides/cost-monitoring/cost-monitoring) in your project, you will also be able to set up a budget for your project. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/09/ebf0349-bdget.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=44f22bedf6e5fa84c6cdd42393d220f4) env zero will monitor your cloud spending directly from your cloud provider, and based on the configured budget will alert you once you reach that threshold. You can learn more about this feature and how to set it up [here](/guides/cost-monitoring/budget-notifications). # VS-Code Extension Source: https://docs.envzero.com/changelogs/2023/09/vs-code-extension Deploy and monitor env zero environments from VS Code, viewing environments by git branch, triggering deployments, approving changes, and tailing live logs. An idea that started in one of our hackathons, has just been published. VS-Code & env0 users can deploy their environments from their IDE! The env0 extension will display all environments associated with the current git branch. You can perform several tasks like deploy, destroy, approve deployment, watch live logs, and visit the environment's page if needed. At first, you should create an organization API key and perform authentication. Then, you'll able to see all of the active environments associated with your active git branch. Once you push changes to remote and hit "Redeploy" button, you'll get notified about the status change. The deployment logs are available in the OUTPUT tab, "env0 logs" item in the dropdown menu. It will be auto-focused when a deployment is active. The [extension](https://marketplace.visualstudio.com/items?itemName=env0.vscode-env0) is now available in the marketplace. Please follow the [README](https://github.com/env0/vscode-env0) for usage instructions. ![env0 vs code extension](https://github.com/env0/vscode-env0/blob/main/assets/demo2.gif?raw=true) # Immediate Persistence of Variables Regardless of Deployment Outcome Source: https://docs.envzero.com/changelogs/2023/10/immediate-persistence-of-variables-regardless-of-deployment-outcome env zero now saves environment variables at deployment time rather than only on success, so variable changes are retained even when a deployment fails. ### Immediate Variable Persistence: New Feature Rolling Out on 11/01/2023 Starting on 11/01/2023, env zero is changing how it handles the persistence of environment variables. ### What's Changing? Previously, your environment variables were only saved following a successful deployment. We designed this feature believing it would help revert to stable configurations if a deployment failed. However, we heard your frustrations. That's why we're changing. With the update, env0 will save your variables immediately at the time of deployment, regardless of the outcome. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/10/2b55df3-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=257e1e636f1455607b18ef2cee697948) ### Why This Matters * **Smoother Process:** No need to re-enter variables after an unsuccessful deployment. Debug and iterate faster! * **Friendly for Beginners:** Those new to Terraform will enjoy a more forgiving experience, reducing the initial friction and frustration. ### Action Required This change is coming fast, rolling out on November 1st 2023. If your workflows rely on the old behavior, it's important to adjust them. Prepare now to embrace the new approach for a smoother, more efficient experience. ### Need Help? We understand that change, while positive, can be challenging. Our team is ready to assist with any questions or support needed during this transition. Your ease of operation is our priority, and your feedback is the catalyst for these improvements. Connect with us through our support channels. Contact our support team with any questions. Together, we continue to evolve env0 into the most user-friendly, efficient environment management platform available. Here's to making your deployment processes easier than ever! # Official OpenTofu Support Source: https://docs.envzero.com/changelogs/2023/10/official-opentofu-support OpenTofu, the Linux Foundation-managed Terraform fork, is now a natively supported IaC framework in env zero and is backward compatible with Terraform. OpenTofu is now natively supported by env zero. Previously named OpenTF, OpenTofu is a fork of Terraform that is open-source, community-driven, and managed by the Linux Foundation. OpenTofu is backward compatible with Terraform. This means you can start using OpenTofu today with your existing code. Head to the templates page and create a new OpenTofu template. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/U9rcMIDzc38oPcXx/images/changelogs/2023/10/8820352-image.png?fit=max\&auto=format\&n=U9rcMIDzc38oPcXx\&q=85\&s=8dae73e726a24ab2a8e418a159e0ae6c) # Breaking Change to Parent and Sub Projects Variables Behaviour Source: https://docs.envzero.com/changelogs/2023/11/change-to-project-variables-behaviour Breaking change in env zero: project variables cascade to sub-projects, enabling unified management and consistent configuration across the project hierarchy. We're happy to announce that starting Dec 10th, variables defined in projects would cascade down to their sub projects. Environments would not receive only the variables of the project they're defined in, but also the variables of any ancestor project. By incorporating these changes, we aim to fulfill user requests, achieve a more uniform configuration, enhance security, and streamline the overall variable management process. ## How could this affect you? For the purpose of explanation, consider a hierarchical structure comprising a Parent project and a sub-project, Sub Project, with an associated environment in the Sub project. The impending modification may influence the environment in the following ways: 1. ***Variable Overwriting***: Scenario: Global variable "A" initialized to "global". Project variable "A" in the Parent project set to "project". 2. Prior to this change, the environment contains the variable "A" with the value "global." 3. After to the change, the environment will host a variable "A" with the value "project," potentially resulting in the overwrite of the previous value. 4. ***Introduction of New Variables***: Scenario: Project variable "X" and Parent project, and Project Variable "Y" on Sub Proejct. 5. Prior to this change, the environment lacks variable "X" but includes variable "Y." 6. After to the change, both variables "X" and "Y" will exist in the environment. ## Why the change? * ***User Requests***: This modification responds to numerous user requests for a streamlined process in defining variables across multiple projects within a hierarchical structure. * ***Uniform Configuration***: The proposed change addresses the recurring need for users to define variables across projects and their children. This ensures a consistent configuration across all projects beneath a parent project. * ***Enhanced Security***: Especially beneficial when sensitive variables are involved, the modification allows for centralized management without exposing sensitive information to users who do not require access to higher-level projects. * ***Streamlining Configuration***: The adjustment significantly reduces redundancy in variable definition, simplifying the configuration process for users and administrators alike. # Easy OIDC Authentication Integration Source: https://docs.envzero.com/changelogs/2023/11/easy-oidc-authentication-integration Configure OIDC credentials in env zero without storing sensitive data, then assign them to projects to generate short-lived tokens automatically per deployment. Usually to authorize yourself in a deployment in env0 you will need to create a deployment credential and assign that credential to the relevant project. That requires keeping long lived credentials in env0. To avoid that you can use OIDC credentials which are being generated per deployment so you can use short lived credentials. Now you can use OIDC credentials directly by creating an OIDC credential (which requires no sensitive data) and assign that credential to a project and all the setup for the deployment will be done. You will still need to configure the OIDC provider (AWS, Azure, GCP, Vault etc). Read more about it [here](/guides/integrations/oidc-integrations) # BREAKING CHANGE - incoming traffic from env0 extended IP list Source: https://docs.envzero.com/changelogs/2023/11/improved-resiliency env zero expanded its infrastructure across additional AWS regions and AZs. Update your IP allowlists to include the new addresses by December 4, 2023. The env0 engineering team is dedicated to enhancing the system for increased stability and resilience. As part of our ongoing efforts, we have expanded our resources across more Availability Zones (AZs) and regions, ensuring rapid recovery in the event of a complete AZ or region failure. Clients who previously allowlisted our static IP addresses should add the new IP addresses to their allow-list. You can find a comprehensive list of all the IP addresses in our [documentation](/guides/admin-guide/custom-flows#faq) and at the bottom of this message. Rest assured, the previous IP addresses will continue to be in use. Commencing Dec. 4, 2023, the new addresses will be active, and clients can anticipate incoming traffic from any address within the provided list. These changes may impact the [Terraform Provider](https://github.com/env0/terraform-provider-env0) associated with env0. Customers using Terraform to manage their projects may need to validate and update their Terraform configurations to align with the new IP addresses. Full list of addresses: 3.209.36.240 3.222.51.117 3.226.24.146 18.214.49.142 18.214.210.123 35.81.146.242 35.85.88.233 44.195.170.230 44.205.134.220 44.212.144.113 44.227.16.37 44.228.227.2 44.240.181.100 52.73.227.111 54.68.137.240 54.88.50.2 54.149.16.114 54.165.19.49 # Self Hosted Remote State Source: https://docs.envzero.com/changelogs/2023/11/self-hosted-remote-state Store Terraform remote state in your own cloud bucket using env zero's self-hosted remote state, keeping state data within your account and chosen region. When orchestrating your infrastructure with Terraform, accessing the state of a remote backend environment securely is a common need. There are instances where safeguarding this sensitive information in house or in a specific region is needed. Now with our Self-Hosted Remote State you have the power to take control of your environment's state storing it on your chosen bucket and configurations. ## Setting Up Your Remote State To start storing your state in your account all you need to do is deploy our [remote-state-bucket](https://github.com/env0/remote-state-bucket-module) module to create the necessary resources for env0 to be able to access the stored state object. Once the module is deployed please contact our support team with the module outputs we will configure your organization to use your configured newly configured remote state bucket for your env0 remote state environments. ## Recommended Blog Reads * [Self Hosted Remote State](/guides/admin-guide/remote-backend/self-hosted-remote-state) - more details in our docs * [ Manage Terraform Remote State with a Remote Backend](https://www.envzero.com/blog/terraform-remote-state-using-a-remote-backend) # Usage Dashboard Source: https://docs.envzero.com/changelogs/2023/11/usage-dashboard Track users, monthly deployments, and deployment limits in the env zero Usage Dashboard, available under Organization Settings > Billing. The **Usage Dashboard** is available under **Organization Settings > Billing**. ## What to Expect You can stay on top of things by viewing your total **users**, all your **monthly deployments**, and their **deployment limits**. You can also view usage going as far back as the past 12 months: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2023/11/b446cf3-usage-tab.gif?s=d247b9a886067e184c20a72fd71ac2d7) # Remote Apply Source: https://docs.envzero.com/changelogs/2023/12/remote-apply Run terraform apply locally with uncommitted code while execution happens inside env zero, keeping organization policies, governance, and audit logging active. Centralizing Terraform execution is a great way to make sure you have effective IaC governance. While it's preferred that teams directly use env zero to run IaC, sometimes you just need to run a terraform apply locally. Now, with env zero Remote Apply, you can run `terraform apply` locally - even with uncommitted code - and the run will be executed inside the env zero Platform, keeping with your organization policies, governance, and auditing requirements. ## Running a Remote Apply First, you will have to turn it on for the specific environment you'd like to remote apply. ![Remote Apply configuration interface showing how to enable remote apply for a specific environment](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2023/12/b70bb3e-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=db8483a292f267708b8889d274628ffc) To use remote apply, your env zero environment must be configured with env zero's [Remote Backend](/guides/admin-guide/remote-backend). After creating a [personal API key](/guides/admin-guide/user-role-and-team-management/api-keys#personal-api-key) and executing the [login](/guides/admin-guide/remote-backend/login#local-login-to-env0-remote-backend) command, every time you will run a `terraform apply -auto-approve` command, env zero will handle the execution. For more information, please visit our [docs](/guides/admin-guide/remote-backend/remote-apply). # New: Modules Continuous Integration Testing Source: https://docs.envzero.com/changelogs/2024/01/new-modules-continuous-integration-testing Run automated tests against Terraform modules in the env zero Private Module Registry using OpenTofu test files, triggered on merges and pull requests. env zero now offers beta support for continuous integration testing for modules. Built on the OpenTofu testing feature, you can set up testing and integrate it into your private module registry. ## Run module CI with OpenTofu tests Start by creating your [tftest files](https://opentofu.org/docs/cli/commands/test/#testing-modules) and storing them within your module directory. You'll be able to run common tests on a real infrastructure that is created, tested and destroyed in a single flow. ```hcl theme={null} Run "test" { Assert { Condition = file(local_file.test.filename) == "Hello world!" Error_message = "Incorrect content in ${local_file.test.filename}." } } ``` You can write multiple runs in each file, and create multiple test files. env0 will execute all of the tests in all of the files. ## Trigger and manage module tests in your module registry With your test files in place, enable Testing in your module settings and env0 will trigger test runs on every merge to your default branch (and optionally on every PR targeting the main branch). env0 will then present the test results and a full history of all test runs. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/01/e9633a6-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=34ea8ec6d0c369e241e1f6d7fbaa3ef4) Status checks will be presented in your VCS to give you all the information directly in your flow. Learn more about module testing in our [docs](/guides/admin-guide/private-registry/modules/modules-continuous-integration-testing), and read more about OpenTofu GA on our [blog](https://www.envzero.com/blog/celebrating-opentofu-ga-with-our-new-ci-testing-feature). # Introducing: Targeted Deployments Source: https://docs.envzero.com/changelogs/2024/01/targeted-deployments Deploy specific Terraform resources or modules in env zero using Targeted Deployments, scoping a run to only the resources that need updating via UI or API. Targeting resources and modules allows us to pinpoint exactly what needs to be changed instead of deploying a whole environment. Such selective deployments minimize risks associated with broader changes, ensuring that updates are precise and efficient. Introducing **Targeted Deployments**! The new 'Targeted Resources' section in our re/deploy flow makes selecting which resources to deploy a breeze. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/01/2d03d71-screenshot_2023-12-25_at_15.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=c69c1c39a8bfeb7c5452df79e496cf4f) Avid env0 users may know the `ENV0_TERRAFORM_TARGET` [control variable](/guides/admin-guide/additional-controls), but now targeting gets 1st class support - with easy selection via the UI, and supporting the `targets` field in the API upon creating a deployment. Contrary to `ENV0_TERRAFORM_TARGET`, targeting resources with the new feature affects only the current deployment. Read more about it [here](/guides/admin-guide/environments/targeted-deployments). # Partial Workflow Deployment Source: https://docs.envzero.com/changelogs/2024/01/workflow-sub-graph-deployment Run or destroy a subset of a workflow in env zero with Partial Workflow Deployment, choosing to start from a specific node or redeploy a single sub-environment. env zero now supports Partial Workflow Deployment. Partial Workflow Deployment lets you redeploy or destroy a subset of your workflow's graph as needed, rather than running a full top-to-bottom deployment. Partial Workflow Deployment can be triggered either from the three-dot menu in graph nodes: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/01/750e699-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=acbf960613536821af35b97780883c60) Or directly from the sub-environment page: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/01/ae3fb5c-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=ed13195652bcc3c36696ae2ec1f07c97) There are three deployment options: 1. [Run From Here](/guides/admin-guide/workflows/workflow-partial-deployment#deploying-a-subset-of-the-workflow) - Deploy the workflow according to the latest workflow file used, starting from the selected sub-environment 2. [Single Sub-Environment Redeploy.](/guides/admin-guide/workflows/workflow-partial-deployment#deploying-a-single-sub-environment) 3. [Single Sub-Environment Destroy.](/guides/admin-guide/workflows/workflow-partial-deployment#destroying-a-single-environment) Read more about it [here](/guides/admin-guide/workflows/workflow-partial-deployment) # Email Notifications Source: https://docs.envzero.com/changelogs/2024/02/email-notifications Configure custom email recipients and event triggers per project in env zero, sending notifications for failed deployments, budget alerts, and completions. This update revamps email notifications in env zero. Until now, users would receive email notifications which were not configurable. Now we are allowing users to define custom email recipients and configure different events to go out to each email, such as failed deployments or maxed out budgets. These can be configured separately for different projects so you can stay on top of critical updates sent directly to your inbox! > Legacy Email Notifications > > Current legacy email notifications will be disabled in 2 weeks time. ## Add Email Notification To enable email notifications, visit your organization settings and under notifications we have added email support. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/02/f9a12fb-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=70d9ee3c4739eebb3df6dce5accafb9a) ## Configure your project to send notifications Configure the events you would like to be notified about, as described in our [docs](/guides/integrations/notifications#configure-your-project-to-send-notifications): 1. Navigate to your Project Settings, and open the Notifications tab. 2. Find the Notification Target you've previously added and click on the edit icon () next to it. 3. Select the events you'd like to get notified of, from this project to this notification target. 4. Click Save. ## Receive Email Notifications ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/02/e94e1c7-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=a283fde391ad0965b49a1f2391d3eaeb) # Environment Discovery Source: https://docs.envzero.com/changelogs/2024/02/environment-discovery Automatically create, plan, deploy and destroy Environments in env zero by creating pull requests within a preconfigured directory structure Managing your IaC through env zero provides many advantages, but manual environment creation and deployment can be tedious and error-prone at scale. env zero now seamlessly syncs your Git folder structure with projects and environments. Manage and maintain the structure your team thrives on without breaking a sweat. With **Environment Discovery** you can create, plan, deploy and destroy env zero environments automatically, just by managing your Pull Requests on your favorite Git provider. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/02/8011246-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=54abbc3ec2eaa7174914bda0e30596f9) ## Here's How 1. Configure an **Environment Discovery** under Project Settings. 2. Open a **Pull Request** with the infrastructure you'd like to deploy, under the directory structure you configured. 3. In env zero, the environment will be created but won't be deployed. Instead, you'll see a **PR Plan** for the code you pushed. 4. **Review and Merge** the changes you pushed. 5. The environment will be deployed in env zero. Want to learn more? visit [our docs](/guides/admin-guide/environment-discovery) # BREAKING CHANGE - Separate environment "Drift Status" from the Deployment status Source: https://docs.envzero.com/changelogs/2024/02/separate-environment-drift-status-from-the-general-status Breaking change: drift status moves to a separate driftStats field in env zero. The DRIFTED deployment status is deprecated starting February 29, 2024. Starting Feb 29th, we will enhance user experience by separating Drift Detection and Deployment status into distinct values. This improvement is part of our ongoing efforts to provide users with a consistent experience. Users will now find it easier to monitor both the latest deployment queue action and any drift detection without the need for extensive deployment log reviews. ## Why the change? In env0, an environment's status, determined by the last action in its deployment queue, can be overshadowed by drift status. For example, an environment marked as `DRIFTED` may obscure the result of its latest deployment, and performing a deployment after drift detection can alter the `DRIFTED` status, potentially masking detected drift. ## What will break? The environment status `DRIFTED` **will be deprecated**. Instead, a new property, `driftStats`, will be added to the environment modal, indicating drift status with the following values: * `DISABLED`- DD is disabled * `OK`-The last Drift deployment detects no drift. * `DRIFTED` - The last Drift deployment detects a drift. * `ERROR`- The last Drift deployment had an error. * `NEVER_RUN`- Drift deployment never run since DD was enabled. # Create Environment Without Deploy Source: https://docs.envzero.com/changelogs/2024/03/create-environment-without-deploy Use the preventAutoDeploy flag in env zero's Create Environment API or Terraform Provider to create environments without triggering an immediate deployment run. The default behavior of env0 immediately deploying environments upon creation might not suit all users' workflows. Some pipelines require additional configuration before deployment. Streamline your CI/CD workflow in env0 with `preventAutoDeploy`. This new [Create Environment API](/api-reference/) capability enables you to create environments prepared for continuous deployment (CD) while preventing immediate execution, giving you more control over your pipeline. This new capability is available to both API users and those using [env0 Terraform Provider](https://registry.terraform.io/providers/env0/env0/latest/docs/resources/environment). # Organization Role Assignments for Teams Source: https://docs.envzero.com/changelogs/2024/03/organization-role-assignments-for-teams Assign custom roles to teams at the organization level in env zero, adding org-wide access control alongside existing project and environment-level assignments. From now on you can assign roles to your teams directly at the organization level! This update complements our existing capabilities to assign roles at the project and environment levels, offering you unparalleled control over access and permissions throughout your entire organization. This enhancement not only simplifies the management of permissions but also makes your workflow smoother and more efficient. Additionally, the ability to create custom roles ensures that you can tailor access perfectly to meet every team's specific needs. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/03/bbc5deb-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=89f3f9b61e22c70c4e11cd91f417b85b) Want to dive deeper? Visit [our docs](/guides/admin-guide/user-role-and-team-management/teams) for more information. # VCS environments in workflows Source: https://docs.envzero.com/changelogs/2024/03/vcs-environments-in-workflows Define workflow sub-environments inline using the vcs field in workflow YAML, specifying repository, path, and IaC type without pre-creating env zero templates. env zero now supports a new workflow environment format that eliminates the need to create templates as prerequisites. All fields can be defined directly within the workflow, similar to VCS environments. ## New vcs format The new format adds`vcs` (which conflict with the existing `templateName`) which allows the customer fewer prerequisites work by inserting all the required information directly in the workflow file itself. ```yaml Example theme={null} Environments: Vpc: Name: 'VPC and Network' TemplateName: 'VPC' Db: Name: DB TemplateName: 'DB' Needs: - vpc Eks: Name: EKS Vcs: Type: 'terraform' TerraformVersion: 'latest' Repository: 'https://github.com/env0/templates' Path: 'aws/hello-world' GithubInstallationId: 123456789.00 Needs: - vpc ``` Read in depth in our [docs](/guides/admin-guide/workflows/create-a-new-workflow) # Approval Policies and Custom Flows Enhancements Source: https://docs.envzero.com/changelogs/2024/04/approval-policies-and-custom-flows-enhancements Assign multiple approval policies and custom flows per env zero project, with template-level enforcement and combined project and environment-level execution. Running your Infrastructure as code might be a complicated task that may include running custom scripts and have specific policies to make sure your guardrails are in place. With env0 Custom flows, you can run extra logic (bash, python, gcloud, Ansible, etc.), whenever you want in the deployment process (before or after Terraform init/plan/apply, and even destroy/error). With approval policies, you can run your custom policies to make sure everything is meeting your standards, and according to the output we will cancel, wait for approval from a team member, or continue the deployment. ## What's new Now we have enhanced the way our approval policies and custom flows work. Here are some of the new features available: * A single project can use multiple approval policies, allowing different policies to be organized in separate files. Each can be maintained by a different team or stored at a different location while still applying all of these to the same project. * Approval policies can now be assigned to a template, this allows enforcing certain policies on the created environments regardless of their location (the project it belongs to). * It is now possible to execute both project and environment-level custom flows, this allows project admin to use custom flows to run validations and security checks while allowing environments to customize their hooks. Also, project-level custom flows apply on environments that sit under sub-projects, this allows utilizing the project / sub-projects hierarchy to configure custom flows. * A single project can also use multiple custom flows now allowing different checks/ validations to be organized in separate custom flow files each can be maintained by a different team or stored at a different location while still applying all of these to the same project. You can also reorder the custom flows in the table to decide their execution order. If you are using a self hosted agent with a version earlier than `v3.0.731` you won't have access to the new approval policies enhancements until you upgrade it. ## Configuration To configure multiple approval policies/custom flows for a project you can go to the project's policies settings page and click the `+Add Custom Flow / Approval Policy` button: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/04/3e647ac-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=65b309c701664fc5c64465265b6699c5) ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/04/bfce0f9-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=f74ed6b4f05814a04fd9e73bdf46ffff) To configure approval policies for a template you can go to the template's settings page and under the advanced section click the `+Add Approval Policy`button: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/04/041f35c-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=823f259ad48b4acbc1388bfc1fca9c02) # Environment Outputs Source: https://docs.envzero.com/changelogs/2024/04/environment-outputs Export Terraform, OpenTofu, or Terragrunt outputs and pass them as inputs to other environments in the same env zero project, linking data across deployments. Environment Outputs are now available, enabling outputs from one environment to be passed as inputs to another. Environment Outputs export and share data generated by **OpenTofu/Terraform/Terragrunt** environments. Use them to pass configurations between environments within your env0 project. If you'd like to enable this feature on your self-hosted agent, please ensure that you update to the latest version. To begin, please refer to [env0's documentation](/guides/admin-guide/variables/environment-outputs) for detailed guidance! # Global Environment Search Source: https://docs.envzero.com/changelogs/2024/04/global-environment-search Search all environments across your organization in env zero using the top navigation search icon or CMD+K, with results scoped to your accessible environments. Searching for environments is now easier than ever with env zero's new Global environment search. ## Searching the environment Finding environments is now a breeze by accessing our search bar from the icon in the top right or by using our CMD+K shortcut. Now starting to type in the search bar will search within your environments enabling you to and quickly access the environments you are searching for. # Navigation Improvement Source: https://docs.envzero.com/changelogs/2024/04/navigation-improvement Refreshed env zero navigation bar with a modern design, separated org and project settings, a nested sub-project tree, and enhanced cross-project search. The navigation bar has been redesigned with a modern look, improved settings separation, and enhanced cross-project navigation. Here's what you can expect to experience with this new upgrade: * Modernized Look - Say hello to a sleek and contemporary design that elevates your browsing experience. Our updated Navigation Bar boasts a modern aesthetic that's not only visually appealing but also enhances the overall look and feel of our platform * Separation of Organization and Project Settings - We've implemented a clear separation between project and organization configuration, ensuring that you can manage and customize each aspect of your workspace without confusion ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/04/13c7235-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=cdf28e0746872b60feb382c10bb20968) * Streamlined Project Maneuverability - From now on you can view the full hierarchy of every sub-project with our nested tree design and also create sub-projects inside parent projects at ease ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/04/51b8b03-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=86bab7aef83bd34ff4152ee59d5399b1) * Enhanced Searching Capabilities - Need to find something fast? Our new navigation bar comes equipped with enhanced searching that will search around your entire project tree and will show you the results based on score with integrated text match highlighting ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/04/dc54654-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=6636e321744f65ebf0002e8af3881b17) Experience the power of our new Navigation Bar! Your feedback is invaluable as we continue to innovate and enhance our platform. Happy navigating! # Docker image Alpine and Node upgrade Source: https://docs.envzero.com/changelogs/2024/05/docker-image-alpine-and-node-upgrade env zero deployment container updated: Alpine upgraded to 3.19, Node to 20.12.2, and pip to 24.0, improving performance and security for tasks and custom flows. We are thrilled to announce a significant upgrade to our platform, that will enhance your experience and ensure smoother operations! As part of our commitment to providing you with top-notch service, we are upgrading Alpine from 3.17 to 3.19, Node from 16.20.2 to 20.12.2 and pip from 23.1.2 to 24.0 in our docker image. This is the image your deployments will run on, meaning tasks and custom flows you will run, will run with that image and have those versions available. Here's what you can expect from this upgrade: 1. Enhanced Performance: The new versions of Alpine and Node bring optimizations and performance enhancements, ensuring faster and more efficient operations. 2. Improved Security: Security is paramount in today's digital landscape. By upgrading to newer versions, we are bolstering our platform's security measures, providing you with a safer environment to work in. 3. Access to Latest Features: With each upgrade comes a host of new features and functionalities. By staying up-to-date, you gain access to the latest tools and capabilities, empowering you to do more with our platform. # Variable Sets Source: https://docs.envzero.com/changelogs/2024/05/variable-sets Create reusable Variable Sets in env zero and assign them to organizations, projects, templates, or environments to eliminate duplicated variable configuration. The release of Variable Sets! Variable Sets let you organize and manage frequently used variables, promoting consistency across projects. For example, you might have multiple environments across different projects that spin up an RDS instance, you can create a Variable Set with all of the necessarily shared configurations (such as the "instance type", "engine" and so on) and use that Set in every environment that requires those variables. Create once and reuse wherever needed. Variable Sets can be defined at the Organization level, making them accessible to all entities within env zero, or at the Project level, allowing for more granular control within specific projects and their sub-entities. Creating a new Variable Set is intuitive. Navigate to the Organization/Project Variables page, switch to the `SETS` tab and click on the `CREATE NEW SET` button, fill in the Set's name and variables, and you're ready to go. ![Variable Sets creation interface showing the SETS tab with CREATE NEW SET button](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/05/213e63a-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=d4f451bd1defb56458e884bb95a6175e) Variable Sets can be assigned to Organizations, Projects, Templates, Workflows, or Environments, integrating into your existing workflows. Use the selector within the variables table to mark the sets you wish to use. ![Variable Sets assignment interface showing selector checkboxes for Organizations, Projects, Templates, Workflows, and Environments](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/05/57a5d67-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=5e2ceb716a521773e3a7c6d937adc6bb) Like any other variable in env zero, you can override variables within a Variable Set. Navigate to the Variable Set's group in the variables table and edit the variable's value as needed. ![Variable Set override interface showing how to edit variable values within a Variable Set group](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/05/5bd71dd-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=6262bf6db59a7355ec6f26e3b77f6348) For more info, read about [Variable Sets](/guides/admin-guide/variables/variable-sets). # Variables Improvements Source: https://docs.envzero.com/changelogs/2024/05/variables-improvements Scope-based filtering, priority sorting for required variables, and collapsible grouping for sensitive variables in the env zero Variables Table. The Variables Table now includes three improvements: 1. **Scope-Based Filtering:** Filter variables by scope. 2) **Priority Sorting** When you redeploy an environment and review/change attached variables, essential variables marked as "required" will automatically rise to the top of the list. This prioritization ensures you never miss critical variables, smoothing your deployment process. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/05/8e73b5c-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=716822c1b4f53829dc4fe81d94dae43d) 3. **Variable Grouping** When deploying an environment or managing its variables, *Sensitive* and *Read Only* variables will now be grouped under a collapsible UI section. This organization reduces visual clutter and allows Deployers to focus on what matters to them most. These changes reduce visual clutter and keep critical variables visible during deployment. # Webhook Notification Target Source: https://docs.envzero.com/changelogs/2024/05/webhook-notifications Set up webhook notification targets in env zero to send HTTP callbacks on deployment events, enabling automated responses in external systems and CI pipelines. We are happy to announce that webhook is now supported as a notification target! Webhooks provide a secure way to react to events in your env zero account. To set up a new webhook notification target, go to the Notifications menu under the organization settings. Next, create a new notification, and under Type choose Webhook: ![](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/05/6d49247-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=54025888adfd9868abe10015817129b3) Enter your webhook details. An HTTPS connection is required for the URL. If you're experimenting or need a temporary solution, services like [webhook.site](https://webhook.site) can be useful. See [our doc](/guides/integrations/notifications/webhooks) for more details. Once created, you can send a test event to your webhook URL by clicking 'Test endpoint' to ensure everything is working smoothly. ![](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/05/da1ca66-16e0452-screenshot_2024-05-15_at_16.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=6415a2ad84e273988393be2f88a6b12f) For further details, [check out our detailed documentation](/guides/integrations/notifications/webhooks). We hope you find this new feature valuable and are sure that it will enhance your experience. If you have any questions or need further assistance, feel free to reach out! # Approval Flow for Workflows Source: https://docs.envzero.com/changelogs/2024/06/approval-flow-for-workflows Gate workflow progression in env zero by requiring approval on sub-environments via the requiresApproval YAML field, UI checkboxes, or OPA approval policies. Managing your team's dependencies between environments is now easier and more controlled. With the newly available approval flow for workflows, you can now define what environments' plans you would like to review and have more refined control over your workflows. ## Defining your environments to require approval Defining the environments in your workflow to require approval can be done in a couple of ways: 1. By defining the new `requiresApproval` field in the workflow file in the environments definition. 2. By using the UI now available approval checkbox after selecting your desired environment to have approval for. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/06/7b7f30d-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=62086fc0c8317717d23f901446bd5053) 3. By using OPA approval policies for the project/templates applying them to the environments in the workflow. Once you've defined your workflow to require approvals and it's been run you will be able to go over the pending deployments and have control over continuing/canceling the downstream environments. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/06/fbce52c-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=48a70fd44fed44acf2304e518daa188d) # Cloud Compass Source: https://docs.envzero.com/changelogs/2024/07/cloud-compass Cloud Compass in env zero visualizes IaC coverage trends, resource management distribution, and per-resource severity scores to identify unmanaged resources. Cloud Compass is a new feature for tracking and analyzing cloud resource management. With Cloud Compass, you can analyze and visualize your IaC coverage trends over time, ensuring alignment with your organization's guidelines. Curious about your resource management types? Our intuitive pie charts provide a clear snapshot of your current distribution, allowing you to understand and strategize better. Explore a detailed breakdown of your resources and the types of actions performed on them, helping you gain a comprehensive view of your cloud activities. Each resource comes with a severity score, allowing you to prioritize tasks for optimal management practices. Ready to take control and enhance your cloud management practices? Cloud Compass is here to guide you every step of the way! This is a beta feature and we welcome your feedback to make it even better, with each organization currently limited to connecting a single cloud account. Dive in and start exploring today! # GitOps Apply All Source: https://docs.envzero.com/changelogs/2024/07/gitops-apply-all Apply all environments affected by a pull request in env zero using env0 apply --all, with individual and aggregate commit status checks reported to your VCS. env zero now gives you more control over deploying your environments directly from the VCS with the new **GitOps Apply All** feature. To enable this feature, go to environment settings and click Continuous Deployment. You can also enable this feature on the project level, by going to Project Settings, clicking Policies and selecting Continuous Deployment. Your changes will be applied to every new environment created in that project. See [Configuration docs](/guides/admin-guide/environments/plan-and-apply-from-pr-comments#configuration) for more details. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/07/bcdfca3-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=461f5fe84198e1c626f8e4bcc3f4593b) Once it is enabled, every PR commit will have a comment listing the affected environments by the latest commit to the PR: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/07/4129ed4-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=62062aefa5a9622ad55e29046c32eef7) The affected environments can be applied (or planned) by running one of the following PR comments: * `env0 apply --all` * `env0 apply --path ""` Read more about the different commands in [our docs](/guides/admin-guide/environments/plan-and-apply-from-pr-comments#supported-env0-commands) Finally, upon first deployment, a new `env0/Apply` commit check will be added (on top of the individual deployment commit checks). The commit check will be `in progress`and will be in `success` status once all affected environments have been deployed successfully, or `failure` status if one of the deployments failed. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/07/5f2e948-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=7cca068d2aa1bbeaf9e8c2cac9082643) # Move Environments between Projects Source: https://docs.envzero.com/changelogs/2024/07/move-environments-between-projects Move environments between projects in env zero from the environment menu, then redeploy to apply the target project's credentials and variable configuration. env zero now supports moving environments between projects. This feature adds flexibility to project management and control over env zero resources. Move environments when reorganizing projects or shifting resources. ## Get Started 1. Navigate to Environment page of the environment you would like to move 2. Open the menu at the top of the card 3. Click `Move Environment` ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/07/c963361-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=e55a7c55af814b34b709772fec99f3d7) 3. Select your target project from the list and click `Move` ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/07/b870ffa-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=58a8d52ba27f5107964f205a287579e2) 4. You'll be redirected to the redeploy page to deploy the environment in the target project. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/07/5f3f0b8-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=69460731213930ae2c08381243c5f751) To learn more about the feature, read our [docs](/guides/admin-guide/environments/move-environment) # Ansible Support Source: https://docs.envzero.com/changelogs/2024/08/ansible-support Run Ansible playbooks as env zero environments with native approval flows, PR plan triggers, drift detection, TTL policies, and scheduling alongside IaC tools. [Ansible](https://www.ansible.com/) is an open-source automation tool used for configuration management, application deployment, and task automation. It allows users to define their systems and infrastructure as code using simple, human-readable YAML files. Ansible now has first-class support in env zero. ## Ansible - How does it work Deploy your playbooks as env zero environments, with all the benefits you know and love, like Approval Flow, Plan on Pull Request, Drift Detection, TTL, Scheduling, and a whole lot more! To manage your Ansible deployments in env zero, you will need to create a new Ansible template, or run an environment directly from a VCS and choose the Ansible type: ![](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/08/8d1f97c-screenshot_2024-08-04_at_12.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=3f00c0c6b52322436a7777fc1f664693) Read more [here](/guides/admin-guide/templates/ansible). # Introducing Hybrid Agents and Secured Variables for Self-Hosted Agents Source: https://docs.envzero.com/changelogs/2024/09/mix-agents-and-variables Mix SaaS and self-hosted agents within the same env zero organization, and share encrypted SaaS-stored variables securely with self-hosted agent deployments. Our latest updates enhance flexibility in hybrid agent configurations and improve sensitive variable management. Together, these improvements give you greater control over agent setup and secure data handling, simplifying the management of complex environments with increased flexibility and confidence. ## Hybrid Agent Support for Flexible Workflows Projects using self-hosted agents can now operate alongside those using SaaS agents within the same organization, allowing transitions between different agent types. This hybrid setup option lets you choose the best agent configuration for each project, improving workflow efficiency and optimizing scalability and resource management. [Read more](/guides/admin-guide/self-hosted-kubernetes-agent/multiple-self-hosted-agents) ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/09/26d5d436b166754a67434847ac3a2be343f3de3d268a3e167b1aa6a7c7bb6324-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=66e455aba9baaabe7417e946d66ca030) ## Secured Variables for Self-Hosted Agents With this update, sensitive variables securely stored in env0 SaaS are now accessible to both SaaS and self-hosted agents. Fully encrypted and protected, these variables ensure secure operations across all agent types, enabling secure transitions while maintaining the highest levels of security. [Read more](/guides/policies-governance/allow-env0-secrets) ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/09/e665a04b50aebc55f63f54b45c7c0d00ed9c5ef3a9d546dde811fa28e63cf9c2-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=ec2a86bfe32286c14ebc878715abde67) Upgrade your agent to the latest version to use these new capabilities. # Streamline Onboarding With Automated Environment Import Source: https://docs.envzero.com/changelogs/2024/09/onboarding-import-external-environments Import Terraform workspaces into env zero in bulk via Environment Discovery, scanning Git repositories and placing environments into projects automatically. The latest upgrade to our [Environment Discovery](/guides/admin-guide/environment-discovery) feature makes onboarding your existing environments to env zero faster and more efficient than ever before. With this capability, you can add your existing environments in bulk without needing to rebuild them from scratch, reducing manual work and minimizing the risk of errors. Here is how it works: 1. Activate Environment Discovery and scan your Git repository for existing environments. 2. After the scan is finished you'll get a list of all discovered environments. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/09/8e22b7c8b6ed8441e2a1ee4ee318f28c5e7b69e44591d5dd5fa356e126024a6e-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=1d2e65a01deecaeeca909d7b4b45aa08) For each environment you also see the name of the project where the environment will be placed (as defined by your [Environment Placement](/guides/admin-guide/environment-discovery/onboarding-import-external-environments-into-env-zero) configuration). 3. If needed, configure project credentials and Terraform/OpenTofu variables and click 'Import'. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/09/c221ac4b7a774b89e34a4d9da8be6e708eecade991bae927ef598fa299a5c74b-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=97b96306d4c5aea4ea5582ca369c9b93) And that's it. Once the import process is complete, your environments will be fully managed by env zero, subject to all your governance policies, and benefit from platform features like automation, auditability, and more. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/09/54b3981c13b40eb3872cb3be1ed0a3240308c6a3ea86dc92ccf3ff5ab82edc8d-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=706b9d0d14b642b1e6cae6b1fa4daf8e) # Cloud Compass Adds Support for Microsoft Azure Source: https://docs.envzero.com/changelogs/2024/11/cloud-compass-supports-for-microsoft-azure Cloud Compass now supports Microsoft Azure for IaC coverage tracking, risk assessment, and GenAI-assisted resource import alongside AWS support in env zero. [Cloud Compass](/guides/cloud-compass/cloud-compass) now supports Microsoft Azure, expanding its multi-cloud support. With this update, Azure users can now: * **Track IaC Coverage:** Use AI-assisted logic to analyze your cloud footprint and identify gaps in IaC coverage. * **Assess Risks**: Continuously monitor activity across your cloud accounts to identify high-risk assets. * **Streamline Importing:** Securely and quickly codify your resources, using GenAI to create custom import blocks. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/11/514ba5d927f89fd8b58df5614aa2adc38b8b8cdc9b7d1d8620768043b7b026a0-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=8837f6775dfbd13461bedd917c9a66df) Read more [here](/guides/cloud-compass/cloud-compass/configure-an-azure-cloud-account) # Custom Flows For Tasks Source: https://docs.envzero.com/changelogs/2024/11/custom-flows-for-tasks With this update, you can now configure custom hooks for your tasks, allowing you to define specific setups and teardowns for all ad-hoc tasks. [Tasks](/guides/admin-guide/environments/ad-hoc-tasks) now support [custom flows](/guides/admin-guide/custom-flows)! With this update, you can now configure custom hooks for your tasks, allowing you to define specific setups and teardowns for all ad-hoc tasks. For example, if you want to set up specific credentials for all running tasks, you can create an additional step called "Setup Credentials" using custom hooks and configure the credentials as needed. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/11/8bd913eee21ce546f5e77bcd8edc61e0c7c66f475da35ea6b1ed0e94779f3db3-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=4122af96028f9844ca7113f13e54970c) You can learn more about the available hook options [here](/guides/admin-guide/custom-flows#hook-stages). Your custom flows could be set up individually, by creating an \*\*env0.yml \*\*file with the rest of your configuration, or by using a global policy that will be set on every environment in your project. Visit [here](/guides/admin-guide/custom-flows/project-level-custom-flow) to learn more about setting up project-level custom flows. # Introducing Drift Cause: Adding Context to Drift Management Source: https://docs.envzero.com/changelogs/2024/12/introducing-drift-cause-adding-context-to-drift-management Drift Cause in env zero identifies who caused drift, how it was triggered, and when it occurred by correlating IaC state with out-of-band cloud audit logs. [Drift Cause](/guides/admin-guide/environments/drift-detection/drift-cause) is now available, adding visibility to infrastructure drift management. When detecting a drift, have you ever wondered what caused it, who made the change, and why? Drift Cause helps answer these questions by providing detailed information about who was responsible when it occurred, and how it was triggered - whether through a CLI command, a manual UI update, or another action. By linking codified infrastructure with out-of-code audit logs, Drift Cause gives teams the context they need to efficiently investigate, resolve, and prevent future drifts. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2024/12/f93203624a68d31bad97f735fa113058297e6ad6c3513990674e694f13442fec-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=10e922317f942f5da0922a294fa77c9d) Drift Cause connects codified infrastructure with real-world changes, offering a clear view of the user responsible for a change, the method used (e.g., UI, CLI, API), and the exact time the change occurred. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2024/12/dcd6a87879c97c1afffe7160712f2e469d1e93994c596db099b3ea6f4ad53adf-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=99c92e4f178158d1711a8b9672f9d4db) You can also drill down into event metadata, such as IP addresses or JSON logs, directly in the cloud provider's console. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2024/12/61c2ba54ef853530a1f30757023ce12cf6c29403d598a385a48d94b1e0b2d783-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=c1c2e53d057fcd302408bc66a8a531af) To learn more about how to use Drift Cause, visit [here](/guides/admin-guide/environments/drift-detection/drift-cause). # Polish & Improvements - December 2024 Source: https://docs.envzero.com/changelogs/2024/12/polish-improvements-december-2024 December 2024: multiple VCS agents, GitLab access token auth, Terragrunt cost estimation, Vault certificate auth, and deployment filtering by user and status. This month, we've rolled out several updates and improvements to enhance workflows, address common challenges, and bring new capabilities based on user feedback. Here's a quick look at what's new. ## Improved Self-Hosted VCS Management With the latest update to managing self-hosted VCS, we've introduced two key improvements: ### Support for Multiple VCS Agents Manage multiple VCS Agents (Proxies) within the same organization. This enhancement allows routing requests to different servers, providing greater flexibility for distributed systems and workload-specific setups. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2024/12/41417cde12a3868dcf1c3dcef88b2a24b3535921b86ed60aa62a37cbc456d697-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=234a6b6beb44ad4cd4f2395f59c1b8c7) ### Centralized Configuration in the UI Use the Agents tab in Organization Settings to configure a self-hosted VCS connection once, assign a VCS agent key, and reuse it across templates and environments. This streamlines management and eliminates redundant configurations. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2024/12/bbd94d272c39891f68173e8591ed17c99ea203383fce2a6cf0dd7db555d647af-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=01ea5d981d71c8f82ffb0f631ddb08d9) When creating a new template or VCS environment, the repository URL selection is now available as a dropdown list instead of a free-text field, allowing you to select a repository defined in the VCS Connections list, or add a new one. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2024/12/4559d27b6570dcaffbe106ad096621a809a402b731357fa4d31acb0a2f553b35-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=090e4bdb949f5e7360d5d8e55f8b9030) These updates make it easier to scale and manage VCS connections efficiently. For more information, visit the updated [Documentation on Managing Self-Hosted VCS](/guides/admin-guide/templates/self-hosted-vcs). ## Vault Authentication via Certificates We've added support for Vault authentication via certificates in env zero's [Secrets](/guides/admin-guide/variables#secrets) in Self-Hosted Agent. This enhancement ensures secure, secure access to Vault-managed secrets using certificate-based authentication for improved security and easier integration with your existing PKI infrastructure. [Learn more](/guides/admin-guide/self-hosted-kubernetes-agent#customoptional-configuration) ## GitLab Personal & Group Access Token Support We now support GitLab integration using [Personal](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html) or [Group](https://docs.gitlab.com/ee/user/group/settings/group_access_tokens.html) Access Tokens, making permission management more flexible and efficient. When setting up a new Environment or Template, you'll see GitLab Access Token as an authentication option alongside OAuth. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2024/12/9e33eb926ecb4a1cd878230a75261500985bdcd037b2b25a0287094a4f2f7dbb-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=32734693f5b64205994f50aa98738eca) [Learn more](/guides/admin-guide/templates/gitlab-integration) ## Cost Estimation for Terragrunt Run-All You can now set up cost estimation for Terragrunt run-all executions. env zero uses Infracost to perform cost evaluation on each of the generated plans and combine them together. [Learn more](/guides/policies-governance/cost-estimation) ## Filter Deployments by User and Status You can now filter deployments by status or by user that started the deployment. ![](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2024/12/2ffec0b92af664a842b216087a134b60478d2836ff52952fffbb611984e9c447-265a3e02fed2196dc77b07dfe81789cd06210b863d7f0d1df0617cffb8ae59fe-image_1.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=02095ea6f0f3d3929cd3c673123db13a) ## Filter Environments from the Summary Chart Clicking any part of the Environments donut chart in the Summary Dashboard will now filter the Environment table below according to the selected Environment Status, making it easier to drill down into relevant data. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/12/125107003237caee9441a35b02a555b9897a1d1f3c4f3c77e0148d6b84b35cd4-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=283d13cc198af15655fdc789e4200843) ## Global Search by Environment ID Our Global Search (CMD/CTRL + K) now supports searching by Environment ID, making it easier to immediately navigate to a specific environment you'd like to take a look at. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2024/12/713b6e9d3ffa5c18dbcaa72945878db61343f617ffd6ebe65f152d5964e6dbcf-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=675ba95484ecc0d5ef08a2f08b5faf0d) # New Backstage Plugin: Manage and Deploy IaC from Your Internal Developer Portal Source: https://docs.envzero.com/changelogs/2025/01/backstage-integration Use the env zero Backstage Plugin to create, deploy, and monitor cloud environments from Backstage, with deployment history, live logs, and redeploy support. The new env zero Backstage Plugin brings IaC management directly into the developer portal, enabling developers to create, deploy, and monitor cloud environments directly from Backstage. ## **Key Capabilities:** **For teams responsible for platform operations** * Configure Backstage templates aligned with organizational policies and workflows * Enable developers to create and manage environments through env zero **For engineers deploying in a self-service model** * Select templates and deploy environments directly within Backstage ![](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/01/2289265a35c1859b464817553300db735df1c4ac055e4cf54ca4226e2933250e-image2_1.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=6c2405af438df750c1d2baa96aaa21df) * Search, filter, and manage environments in the Backstage catalog ![](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/01/ef062e9b1f365994ff672688a5ce088ef7d75f951b3c8a08946b8eca811d39e1-image3.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=3ecae234182210f6a42ed21846b5c576) * Access deployment history, logs, and resource changes with options to redeploy updated configurations ![](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/01/ee55311f8d30a713fd196f04d1b3cf46d8e0374c4112585cf987da259f1338af-backstage-3.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=7ed68c5d9f73eaa626a33b383b9128d8) * When adjustments are needed, redeploy environments with modified configurations ![](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/01/e0c94188a73b0e0bebacb860900fc5ee38faa81b5962d6057f02673c91f21e08-image3.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=422020a108422f00a2b11830ee32795b) For more details, read [here](/guides/integrations/internal-developer-platforms/backstage). # New: Spot Drift in Minutes With Cloud Compass - Even Before Fully Onboarding Source: https://docs.envzero.com/changelogs/2025/02/cloud-compass-drilldown Cloud Compass detects drift and drift risk for all cloud resources, including unmanaged ones, with event-level details on what changed, who made it, and when. Cloud Compass now enables you to detect and analyze drift across your entire infrastructure within minutes of connecting your cloud account - even for resources not managed in env zero.\ This expanded visibility helps you track changes, assess drift risks, and prioritize remediation as quickly as possible. ### How It Works Upon activation, Cloud Compass will assign a drift status to all resources in the connected cloud account.\ For resources managed outside env zero, Cloud Compass identifies the likelihood of drift based on data from past operational events, and other nuanced relevant information in cloud logs. Based on the combination of these signals, likely discrepancies will be flagged as 'Drift Risk'. For env zero-managed resources, Cloud Compass uses env zero's deterministic understanding of deviation between the infrastructure's actual state and the desired state, as defined by IaC configuration. These resources will be flagged as 'Drifted'. Importantly, for every resource managed by env zero, the system now provides direct links to its corresponding env zero environment, offering easy access to valuable context such as ownership details and deployment history. With drifted resources, this information can be especially useful for root cause investigation and driving effective reconciliation efforts. The drift information is displayed in the newly added 'Drift' column in the Resources table, inside the Cloud Compass screen. Clicking 'Details' on a flagged resource now provides full visibility into the events that led to drift. This capability, [Drift Cause](/guides/admin-guide/environments/drift-detection/drift-cause#/), is now available for all resources, showing what changed, who made the change, and when - helping you take action with confidence. [Visit here](/guides/cloud-compass/cloud-compass/linking-environments-to-cloud-compass-resources#/) to learn more about Cloud Compass and its other capabilities. # Drift Remediation Keep Your Infrastructure Aligned with Your Code Source: https://docs.envzero.com/changelogs/2025/02/drift-remediation Reconcile infrastructure drift in env zero automatically or manually, reapplying IaC at the project or environment level while respecting all approval policies. Drift Remediation is a capability that reduces the time required to reconcile infrastructure drift and keep your infrastructure consistent with its intended configuration. Automatic Drift Remediation can be configured to either reapply the IaC configuration or accept changes made outside of IaC management (the latter option will be available soon). The automation can be set at both the project and environment levels and will adhere to all approval processes, security policies, and compliance requirements already configured within your env zero account. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/02/ed1613488c4b718336e8f6d2797507de46a656090354cb88de6fe20cb9390be7-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=e456171c51f9991f63258e6230de45a2) To enhance control, you can also opt to manually reconcile drift using the newly added 'Remediate Drift' button. There you can choose between the same two reconciliation options; 'Code to Cloud' and 'Cloud to Code', as shown below: ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/02/6bdd8cff11a32b25ca5569a015b0bda8eb20748724457042c14e9f247ea73b63-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=e6e88995cb0e2dca1e3489638311ec1a) Visit [here](/guides/admin-guide/environments/drift-detection/automatic-drift-remediation) to learn more about Drift Remediation. # Introducing env zero Cloud Analyst: AI-Powered Infrastructure Intelligence Source: https://docs.envzero.com/changelogs/2025/03/introducing-env0-cloud-analyst-for-ai-powered-infrastructure-intelligence Cloud Analyst in env zero answers plain-language questions about deployments, drift, and IaC usage, returning structured data and supporting custom dashboards. **Cloud Analyst** is a capability in env zero that provides access to infrastructure and operations data, including insights into deployments, drift, IaC usage, and key DevOps metrics. Built directly into env zero, Cloud Analyst lets you explore that data by asking plain-language questions, without needing to build reports or learn the data model. Type a question and get a structured answer. ![Cloud Analyst interface showing AI-powered infrastructure intelligence dashboard](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/03/cloud_analyst_interface_showing_ai-powered_infrastructure_intelligence_dashboard.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=e79e24124a292bbec26fcb3258db747a) From there, you can drill down, filter, and pin insights to a custom dashboard for ongoing visibility - whether you're building your own or starting with one of our predefined dashboards. ![Custom dashboard creation interface with filtering and pinning capabilities](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/03/custom_dashboard_creation_interface_with_filtering_and_pinning_capabilities.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=e64522871ec64df7e0a7b8de49003bc4) What you can do with Cloud Analyst: * **Ask questions** in natural language and get structured answers in seconds * **Track trends** across projects, environments, deployments, and more * **Create, save, and share customized dashboards** that update with your latest data To enable Cloud Analyst, contact your env zero Customer Success team. To learn more, visit our [docs](/guides/cloud-analyst/cloud-analyst). # Polish & Improvements: January-February 2025 Source: https://docs.envzero.com/changelogs/2025/03/polish-improvements-january-2025 Jan-Feb 2025: dark mode, redesigned homepage, Oracle Cloud credentials, Cloud Compass all-accounts view, multi-org GitHub Enterprise, Dynatrace log forwarding. We're happy to introduce a few recent improvements we've made to enhance the user experience and flexibility across env zero. ## Dark Mode is Here The wait is over: Dark Mode has arrived! For those who prefer a darker aesthetic, you can now switch to a sleek, modern interface designed for comfort in low-light settings. **Highlights**: * A dark-themed interface for a fresh new look. * One-click switch between Light and Dark Modes to match your preference. Enable Dark Mode in the top-right of the application and let us know what you think. ## Introducing the New env zero Homepage We're happy to unveil our new Homepage, designed to provide a high-level overview of your organization while making it easier to find what matters most. ![New env zero homepage showing Needs Review, Recently Updated Projects, and Insights sections](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/03/new_env0_homepage_showing_needs_review_recently_updated_projects_and_insights_sections.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=a03dadaaac8e51cf72fff0294f4040f9) The Homepage includes three key sections: * **Needs Review** - A list of Environments that are Failed, Drifted, or Waiting for Approval, with filtering options to focus on what's important to you. * **Recently Updated Projects** - Quick access to the projects you've worked on most recently. * **Insights** - A snapshot of key Environments and Cloud Compass stats. We always appreciate your feedback. Please use the feedback button on the Homepage to share thoughts and ideas for how it can be improved. [Learn more](/guides/admin-guide/homepage) about the Homepage. ## Oracle Cloud Credentials Support You can now connect your OCI credentials to env zero, using the credentials tab in the Organization Settings. Once connected, the credentials can be assigned to any project. Learn more [here](/guides/getting-started/connect-your-cloud-account#oracle-cloud-infrastructure-oci). ![Oracle Cloud Infrastructure credentials configuration interface in Organization Settings](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/03/oracle_cloud_infrastructure_credentials_configuration_interface_in_organization_settings.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=25cc021a2e8160894dfd2090b54ff6c9) ## Cloud Compass: See All Your Cloud Accounts in a Single View Cloud Compass now features an "All Accounts" view for AWS and Azure, allowing you to view your Cloud Management breakdown, IaC Resources Trend, and the resources table in a single view. [Learn more](/guides/cloud-compass/cloud-compass) about Cloud Compass. ![Cloud Compass All Accounts view showing AWS and Azure cloud management breakdown and IaC resources trend](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/03/cloud_compass_all_accounts_view_showing_aws_and_azure_cloud_management_breakdown_and_iac_resources_trend.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=92c36bffe64c92a20e3d745e0aba478f) ## Support Multiple GitHub Enterprise Organizations We now support multiple GitHub Enterprise organizations in a single VCS integration. [Learn more](/guides/admin-guide/templates/github-enterprise-integration) about GitHub Enterprise Integrations. ## Dynatrace Integration You can now forward your deployment logs to Dynatrace. [Learn more](/guides/integrations/logs-forwarding/dynatrace). ![Dynatrace integration configuration interface for deployment log forwarding](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/03/dynatrace_integration_configuration_interface_for_deployment_log_forwarding.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=57aaec4536d3dfc66e003176258d3aa8) # Drift Cause Analysis: Understand Why Drift Happened Source: https://docs.envzero.com/changelogs/2025/04/drift-cause-analysis-understand-why-drift-happened Drift Cause Analysis uses AI in env zero to explain why resources drifted, tracing manual changes, unapplied commits, variable updates, and version mismatches. Drift Cause Analysis helps you move beyond detection by explaining what most likely caused each drifted resource. env zero uses AI to analyze context from your environment, code, and history to identify causes like manual changes, unapplied commits, variable updates, and version mismatches. You'll see a clear explanation next to each drifted resource, along with links to related commits or cloud events, when available. ![Drift Cause Analysis interface showing AI-powered explanations for drifted resources with remediation actions](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/04/drift_cause_analysis_interface_showing_ai-powered_explanations_for_drifted_resources_with_remediation_actions.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=9b948629ea877075cc401e237ae6823e) When remediation is needed, you can trigger it directly using the available actions under What's Next section to restore your intended configuration. Now available for all Terraform, Terragrunt, and OpenTofu environments. To learn more, read Drift Cause [docs](/guides/admin-guide/environments/drift-detection/drift-cause) # Whats New: AI-Powered Summarization and Error Insights (Beta) Source: https://docs.envzero.com/changelogs/2025/04/whats-new-ai-powered-summarization-and-error-insights-beta Use AI in env zero to get plain-language error explanations and plan summaries during deployments, with sensitive data redacted and no model training on data. We're bringing the power of AI to your deployments with our new AI-Powered Summarization and Error Insights - now in beta! ## Understand Errors Faster Debugging just got easier. When a deployment error occurs, click the new "Ask AI" button next to the error message to get a clear explanation of what went wrong, why, and how you might fix it. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/04/99ea503fa335cf129ffc8701de88003328a8923a6b179b8ada3869402519551d-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=e6d979a0c5ca00380fc821fd06bb11cb) ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/04/5eb0f795df37bb2cc197b659c1a2b25cb005b4138e6611cf99d17739dba32a8b-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=d118b0c12a4d717f4e9c32016b7098fc) Whether you're new to IaC or deep in the weeds, this can save valuable time when things go sideways. ## Smarter Summaries for Plan & Apply Reviewing plans may be cumbersome and confusing - you can now make sense of the changes with a quick click of the "Summarize" button. AI-generated summaries highlight key modifications, flag sensitive updates, and offer insights - so you don't have to dig through logs. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/04/6abfc950ed31ebeb4043037fdf182cb49a836f824ae0a0e24ad11aa9be8bafcf-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=ec6fab3ff452536f66ee9e53ca24c750) ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/04/74826f277c87ee85f50364a0886472c9f4329e0784721db3dc70b1d07521b94d-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=f33c9f3ebed33c012c92a276686f56a4) ## Privacy-First by Design env zero only analyzes relevant data (with sensitive info redacted) and never shares it or uses it to train AI models. **This beta feature is available now as an add-on feature, please contact Support for more details on enabling it.** # New in Drift Remediation: Automated Code Updates to Keep IaC in Sync Source: https://docs.envzero.com/changelogs/2025/05/new-in-drift-remediation-automated-code-updates-to-keep-iac-in-sync env zero can generate a pull request to update IaC to match detected cloud changes, adding code-to-cloud alongside the existing cloud-to-code remediation. Say hello to a smarter way to manage drift: now you can instantly capture changes made directly in your cloud environment and update your Infrastructure as Code with just a few clicks. Drift remediation has typically involved aligning cloud resources back to match your code. Now, because different situations call for different approaches, env zero gives you an additional option: When a change is detected in the cloud, whether it's a manual fix, a security hotfix, or an optimization tool adjustment, env zero enables you to generate a pull request that captures the detected changes in your Infrastructure as Code. You can then choose to update your code automatically or manually based on the situation. When drift is detected, env zero presents the details and lets you choose whether to: * Align the cloud with your code * Update your code with the detected cloud-side change ![Drift detection interface showing options to align cloud with code or update code with cloud changes](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/05/drift_detection_interface_showing_options_to_align_cloud_with_code_or_update_code_with_cloud_changes.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=effc7817d5df2f8e113bce4f373802cb) If you choose to update your code, env zero will automatically generate a pull request through your Version Control System (VCS). ![Automated pull request generation interface showing VCS integration for code updates](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/05/automated_pull_request_generation_interface_showing_vcs_integration_for_code_updates.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=1afb654a298bc99261c39bd67c22b7aa) You can also configure env zero to take action automatically based on your policies. ![Policy configuration interface for automated drift remediation settings](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/05/policy_configuration_interface_for_automated_drift_remediation_settings.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=3d0c5f00ff266e0bd4b47f25d711f8f9) This enhancement gives you full flexibility to decide how to manage changes while keeping your environments consistent, secure, and reliable. Learn more about [drift remediation](/guides/admin-guide/environments/drift-detection/automatic-drift-remediation) and [how to automate it](/guides/policies-governance/drift-detection-policy#configuring-automatic-drift-remediation). # Cloud Compass Adds Support for GCP Source: https://docs.envzero.com/changelogs/2025/06/cloud-compass-adds-support-for-gcp Cloud Compass now supports GCP, completing multi-cloud coverage across AWS, Azure, and Google Cloud for IaC gap analysis, risk assessment, and resource import. [Cloud Compass](/guides/cloud-compass/cloud-compass) now supports GCP, expanding its multi-cloud support. With this update, GCP users can now: * **Track IaC Coverage:** Use AI-assisted logic to analyze your cloud footprint and identify gaps in IaC coverage. * **Assess Risk and Drift Exposure**: Identify risky resources and those susceptible to unmanaged changes outside IaC. * **Streamline Importing:** Securely and quickly codify your resources, using GenAI to create custom import blocks. ![Feature demonstration screenshot showing new functionality](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/06/760e9f10cdc246b8c76dd6445ef919bbc6271fa0bbb29935f95a65ef963e89fd-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=23d1597a266442c031a35d401d2d8c85) Read more [here](/guides/cloud-compass/cloud-compass/configure-a-gcp-cloud-account) # Polish & Improvements: June 2025 Source: https://docs.envzero.com/changelogs/2025/06/polish-improvements-june-2025 June 2025: workflow output variables, audit log forwarding, self-hosted agent plugin caching, project-level credentials, dry run support, and VCS user mappings. We've continued to roll out improvements focused on streamlining workflows, resolving common issues, and refining the experience, driven by user feedback. Here's a brief overview of the latest updates. ## Environment Output Variables in Workflow Templates You can now more effectively define variable dependencies within Workflows using **Environment Outputs** and **Workflow Templates**. This enhancement lets you use outputs as inputs within the same workflow, making it easier to configure reusable Workflows across different environments. To learn more visit our docs: [Workflow Variables](/guides/admin-guide/variables/workflow-variables) and [Environment Outputs](/guides/admin-guide/variables/environment-outputs). ![Workflow template configuration showing environment output variables and dependencies](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/06/workflow_template_configuration_showing_environment_output_variables_and_dependencies.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=d637bf83b73743f66607d051bba8e785) ## Audit Log Forwarding You can now forward env zero Audit Logs to supported observability tools. This update introduces a new configuration interface under the **Integrations** page, allowing you to connect both Deployment Logs and Audit Logs to any of the available integrations. [Learn more](/guides/integrations/logs-forwarding) ![Integrations page showing audit log forwarding configuration options](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/06/integrations_page_showing_audit_log_forwarding_configuration_options.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=b6f34c1850fb414a6b243f244328ec39) ## Plugin Caching for Self-Hosted Agents Customers using the Self-Hosted Agent can now boost deployment performance with our new plugin cache. This feature stores previously downloaded provider plugins on a persistent volume, enabling reuse across runs within the same environment. [Learn more](/guides/admin-guide/self-hosted-kubernetes-agent/cache-with-pvc) ## Project Level Credentials Credentials management is now more flexible with the introduction of **Project-level credentials**. You can add credentials directly in a Project's settings, and they will be scoped *exclusively* to that project and its child projects. ![Project-level credentials configuration interface in project settings](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/06/project-level_credentials_configuration_interface_in_project_settings.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=fd3edbd63aa7f8cd9a8b21a2a6c6fae0) In the Organization Credentials page, Admins can view all credentials across the organization - including project-level ones - clearly marked in the Scope column. [Learn more](/guides/getting-started/connect-your-cloud-account#credentials-management) ![Organization credentials page showing project-level credentials with scope column](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/06/organization_credentials_page_showing_project-level_credentials_with_scope_column.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=bd2e287def565b393547ba9244717327) ## Dry Run support for safe planning You can now trigger Dry Runs - plan executions that skip the apply step. Dry Runs allow you to preview changes without affecting the environment status or modifying any related configurations. ![Dry run execution interface showing plan-only mode for safe environment testing](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/06/dry_run_execution_interface_showing_plan-only_mode_for_safe_environment_testing.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=7782a507123c786a217cbc4a7aa145b7) ## Manually release a remote state lock You can now manually release a stuck remote state lock. The release option is available to users with appropriate permissions when a state lock is detected. ![Remote state unlock interface showing manual unlock option for locked state](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/06/remote_state_unlock_interface_showing_manual_unlock_option_for_locked_state.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=ff32b4bc4b0e68abb97c3608e71d7640) ## Multiple VCS User Mappings Organizations using more than one VCS provider can now map multiple VCS user accounts to a single env zero user. This makes it easier to manage identity and permissions across providers. ![VCS user mapping interface showing multiple provider account connections to single env zero user](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/06/vcs_user_mapping_interface_showing_multiple_provider_account_connections_to_single_env0_user.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=45a206b89bbbe7c097b9a1780045ca48) # env zero MCP Server: Fast and Safe Infrastructure Actions from IDEs and Agents Source: https://docs.envzero.com/changelogs/2025/09/env-zero-mcp-server-change-log Use the env zero MCP Server to plan, approve, and deploy infrastructure from your IDE or AI agent, with all env zero governance policies enforced on every run. The env zero MCP Server brings infrastructure deployment directly into your IDE, with full support for GitOps and IDE-based workflows. The MCP Server brings faster, more interactive infrastructure deployment straight into your IDE. With support for all major IaC frameworks, you can now: * **Generate and test infrastructure** code right from your editor * **Pull plan logs and AI-powered suggestions** to debug failed runs quickly * **Approve, cancel, or rerun deployments** without switching tools * **Codify cloud resources** into Infrastructure as Code snippets The MCP Server keeps all your existing governance and policy enforcement intact, with faster iterations and tighter feedback loops. * Same guardrails * Much faster inner loop * Works with your AI agent or editor The env zero MCP Server is available now as an open source project. Run it with Docker, then connect it with your env zero API key ID and secret to start interacting with your environments directly from your editor. > [!TIP] > > For setup instructions and the list of tools, see [env zero MCP server](/guides/community-and-resources/support-and-help/mcp-server). # Introducing Ready-To-Use Policies Source: https://docs.envzero.com/changelogs/2025/09/ready-to-use-policies-change-log Apply pre-built security, compliance, and cost policies in env zero at the organization, project, or environment level from a catalog without writing any code. env zero now includes ready-to-use policies, making it faster to add guardrails across your Infrastructure-as-Code (IaC) workflows. Instead of starting from scratch, you can now activate a growing library of pre-configured policies that cover common challenges in security, compliance, and cost management. ![Approval policy configuration interface showing policy setup and validation options](https://mintcdn.com/envzero-b61043c8/rxuvpp4wRqrrS0PC/images/guides/policies-governance/ready-to-use-policies/policies-catalog.png?fit=max\&auto=format\&n=rxuvpp4wRqrrS0PC\&q=85\&s=ef3e62b9e5cacce940f08990698d837f) Approval policy configuration interface ## How it works Policies are organized into categories such as security, IAM, cost, and compliance. You can browse and filter policies by category or cloud provider, review the details, and apply them at the organisation, project, or environment level. Once activated, they're automatically enforced during deployments to ensure your infrastructure always meets your governance standards. ## Key benefits With ready-to-use policies you can: * Save time by applying policies instantly without writing code * Strengthen security, compliance, and cost governance with built-in guardrails * Maintain flexibility by applying policies at the organisation, project, or environment level Ready-to-use policies are available now in the Policies section of your organisation menu. > [!TIP] > > Learn more in the [policies documentation](/guides/policies-governance/policies) or get the details on the [blog](https://www.envzero.com/resources). # Now Available (Beta): Code Optimizer Helps You Improve Infrastructure Code Quality and Safety Source: https://docs.envzero.com/changelogs/2025/11/code-optimizer-beta Code Optimizer scans IaC in env zero using Checkov and TFLint, flags issues with environment context, and generates pull requests with suggested fixes. **Code Optimizer** is a new beta feature in env zero that scans your Infrastructure as Code and helps you catch issues early, before they cause problems in production. It detects risks, flags inconsistencies, and suggests code-level improvements you can review and apply. Instead of relying on manual reviews or post-incident cleanup, Code Optimizer offers a faster, more proactive path to better infrastructure code. ![Code Optimizer provides detailed analysis and lists all detected issues with severity levels](https://mintcdn.com/envzero-b61043c8/r1hfz_udZgUmpFfC/images/changelogs/2025/11/code-optimizer-issues.png?fit=max\&auto=format\&n=r1hfz_udZgUmpFfC\&q=85\&s=5ccad0589b410b47f779b7c4c83929c9) Code Optimizer dashboard showing detected issues ## What's included in the beta * Run scans manually from development environments * Detect potential issues like hardcoded values, overly permissive access, or weak defaults * View which environments may be affected by an issue * Generate pull requests with suggested code fixes * Track, ignore, or resolve issues with built-in controls ![Detailed view of an issue showing the resource, file, repository, severity, and relevant environments](https://mintcdn.com/envzero-b61043c8/r1hfz_udZgUmpFfC/images/changelogs/2025/11/code-optimizer-issue-details.png?fit=max\&auto=format\&n=r1hfz_udZgUmpFfC\&q=85\&s=7e2e604b4a0a40a243fe83a54e4118a4) Issue details and affected environments ## Powered by familiar tools, enriched with context Code Optimizer runs scanning tools like Checkov and TFLint under the hood, but with full awareness of your environments, modules, and infrastructure history. That context makes findings more relevant and fixes easier to trust. ## Beta limitations * Scanning and detection: GitHub, GitHub Enterprise, GitLab Enterprise, and Bitbucket Server are supported * Code fix creation: GitHub and GitHub Enterprise are supported * Environment mapping is based on code paths (not yet plan or state aware) ## What's coming next * More VCS provider integrations * Expanded scan coverage * Future features like runtime insights and state validation > [!TIP] > > Learn more in the [Code Optimizer documentation](/guides/policies-governance/code-optimizer/overview) or get the details on the [blog](https://www.envzero.com/resources). # Projects Page Refresh: Clearer Overview, Tags, and Improved UI Source: https://docs.envzero.com/changelogs/2026/01/projects-page-refresh The refreshed Projects page in env zero shows richer metadata, environment status, sub-project hierarchy, and tag-based filtering to manage projects at scale. We have rolled out a refreshed **Projects** page with improvements designed to make it easier to understand, organize, and act on your projects at a glance. ## What's new ### Get a clearer project overview * See richer project metadata at a glance * View project details, environment status, and creation and update dates * Understand project state without opening each project * Follow project hierarchies more with sub projects shown directly in the list ### Organize projects with tags * Group related projects using tags * Reuse tags across projects * Filter projects by tags to focus on what matters ### Work more efficiently with a clearer UI * Scan projects more with an improved layout * Move faster with more consistent interactions These updates are part of an ongoing effort to make project management in env zero more scalable and friendly, especially as your number of projects grows. As always, we would love your feedback. # Self-Service SSO: Speed Up Authentication and Stay in Control Source: https://docs.envzero.com/changelogs/2026/01/self-service-sso Configure Azure AD or SAML 2.0 SSO in env zero from Organization Settings, manage domain mappings and role assignments on your schedule without support tickets. **Self-Service SSO** lets you configure Single Sign-On directly from Organization Settings. Set up Azure AD or SAML 2.0 authentication on your own schedule and manage your enterprise authentication setup with full control. ## What's new ### Configure SSO directly from the UI * Set up SSO during onboarding or anytime after * Update settings, domain mappings, and role configurations on your schedule * Full control over your authentication setup ### Supported authentication methods * **Azure Active Directory (Microsoft Entra ID)** - OAuth-based authentication for organizations using Microsoft identity services * **SAML 2.0** - Standard protocol compatible with any SAML identity provider (Okta, OneLogin, JumpCloud, Google Workspace, and others) ### Why SSO matters * **Centralized access control** - Manage user access through your identity provider * **Enforce security policies** - Apply your organization's authentication policies, including MFA * **Automated provisioning** - Users are created and assigned roles automatically on first login * **Compliance and auditability** - Authentication events are logged in your identity provider ## How to get started 1. Navigate to **Organization Settings** 2. Click the **SSO** tab 3. Select **Azure AD** or **SAML** to create a new connection 4. Complete the self-service configuration form As always, we would love your feedback. > [!TIP] > > Learn more in the [Self-Service SSO Integration](/guides/sso-integrations/self-service-sso) documentation, or jump directly to the setup guides for [Azure Active Directory](/guides/sso-integrations/self-service-azure-ad) or [SAML](/guides/sso-integrations/self-service-saml). # SCIM Provisioning: Automate User Lifecycle Management Source: https://docs.envzero.com/changelogs/2026/02/scim-provisioning Use SCIM 2.0 with Okta or Microsoft Entra ID to auto-provision and deprovision env zero users, keeping access in sync with your identity provider continuously. env zero now supports SCIM 2.0 (System for Cross-domain Identity Management), enabling your Identity Provider (IdP) to automatically provision and deprovision users. Instead of relying on login-time syncing, SCIM keeps your user directory in sync continuously - access is granted or revoked as soon as changes happen in your IdP. ## What's new ### Automatic user provisioning and deprovisioning * Users are created in env zero as soon as they are assigned in your IdP * When a user is removed or deactivated in your IdP, their access to env zero is revoked immediately * No manual user management required - your IdP is the single source of truth ### Self-service setup from the UI * Configure SCIM directly from **Organization Settings > SSO** after setting up an SSO connection * Generate a SCIM bearer token and endpoint URL with a single click * Works alongside your existing SAML or Azure AD SSO configuration ### Supported identity providers * **Okta** - native SCIM 2.0 integration * **Microsoft Entra ID (Azure AD)** - native SCIM 2.0 integration * Any identity provider that supports the SCIM 2.0 standard ## Why this matters * **Security and compliance** - user access is revoked the moment they leave the organization, with no manual cleanup needed * **Operational efficiency** - eliminate manual user provisioning across your infrastructure platform * **Auditability** - deprovisioning events are logged in the audit trail ## How to get started 1. Ensure you have an [SSO connection](/guides/sso-integrations/self-service-sso) configured (SAML or Azure AD) 2. Navigate to **Organization Settings > SSO** 3. In the **SCIM Provisioning** section, click **Generate SCIM Token** 4. Copy the endpoint URL and bearer token into your identity provider's SCIM configuration > [!TIP] > > Learn more in the [SCIM Provisioning](/guides/sso-integrations/scim-provisioning) documentation. # Self-Service Agent: Create and Manage Agent Pools Without Contacting Support Source: https://docs.envzero.com/changelogs/2026/03/self-service-agent Manage self-hosted agent pools in env zero from Organization Settings, generate authentication secrets, and assign agent pools to projects on your own schedule. Organization admins can now create and manage self-hosted agent pools directly from the env zero UI, without contacting support. Navigate to **Organization Settings -> Agents** to create pools, generate authentication secrets, and start deploying. ![Agents page showing agent pools and project assignments](https://mintcdn.com/envzero-b61043c8/G6uQW-C5k8CwAvji/images/guides/admin-guide/self-hosted-kubernetes-agent/agents-list-page.png?fit=max\&auto=format\&n=G6uQW-C5k8CwAvji\&q=85\&s=156e622a7ace5eeb7e2d0eb78b4b54fe) Create and manage agent pools from Organization Settings ## What's included * Create agent pools on demand * Generate authentication secrets with one-click install commands * Support for two concurrent secrets per pool for zero-downtime rotation * Assign agents to specific projects from the Agents tab > [!TIP] > > Learn more in the [Self-Hosted Agents Overview](/guides/admin-guide/self-hosted-kubernetes-agent/overview) documentation or see [Running Multiple Self-Hosted Agents](/guides/admin-guide/self-hosted-kubernetes-agent/multiple-self-hosted-agents) for multi-agent setups. # Simplify Terraform Cloud Migration With the env zero Migration Wizard Source: https://docs.envzero.com/changelogs/2026/03/tfc-migration-wizard Migrate TFC or TFE workspaces to env zero using a guided wizard that discovers workspaces, transfers variables and state, and handles a controlled cutover. You can now migrate Terraform Cloud (TFC) or Terraform Enterprise (TFE) workspaces to env zero using a guided migration wizard. The wizard discovers your existing workspaces, transfers configuration and state, and prepares environments in env zero so you can complete the migration with a controlled cutover. ## Connect and scan Connect your Terraform Cloud organization and automatically discover workspaces, variables, and variable sets. You can migrate a subset of workspaces and return later to migrate additional ones. ## Resolve issues If required information is missing, the wizard highlights what needs attention so you can provide secrets or configure VCS connections before migration. ## Review and migrate Review the discovered workspaces and create the corresponding environments in env zero while preserving the existing project structure. ## Go live When you are ready to switch, the wizard locks Terraform Cloud workspaces and activates the matching environments in env zero, enabling a controlled cutover. ## What gets migrated The wizard recreates the core configuration required to run your infrastructure in env zero. * Workspaces recreated as environments * Workspace variables migrated to environment variables * Variable sets migrated to configuration sets * Project structure preserved * Terraform state transferred to the env zero remote backend Terraform Cloud workspaces remain operational until you complete the Go Live step, and they are never modified or deleted during the migration. > [!TIP] > > Learn more in the [Migrate from Terraform Cloud](/guides/admin-guide/tfc-migration) guide. # Centralized VCS Connections for All Providers Source: https://docs.envzero.com/changelogs/2026/04/vcs-connections-alignment GitLab, Azure DevOps, and Bitbucket cloud VCS connections can now be managed centrally in Organization Settings alongside GitHub and self-hosted providers. All cloud VCS providers, including **GitLab**, **Azure DevOps**, and **Bitbucket**, now support centralized VCS connection management through **Organization Settings > VCS**. Previously, centralized connection management was limited to self-hosted VCS and GitHub Code Write connections. GitLab, Azure DevOps, and Bitbucket required per-template authentication setup. With this update, you can configure and manage **Deployment** connections for all providers in one place. ## What's new * **Centralized management** for GitLab, Azure DevOps, and Bitbucket cloud connections in Organization Settings * **VCS connection selector** in template creation, replacing per-template OAuth and token setup * **Deployment connection type** now available for all supported VCS providers ## How it works 1. Go to **Organization Settings > VCS** and create a new connection for your VCS provider 2. When creating a template, select your pre-configured VCS connection from the dropdown 3. Pick your repository and continue with template setup Learn more: [Managing VCS](/guides/admin-guide/manage-vcs) # IP Allowlisting for Logins, API Keys, and the Agent API Source: https://docs.envzero.com/changelogs/2026/05/ip-allowlisting Restrict access to your organization to a set of approved source IP addresses, covering UI logins, API keys, and the Agent API. env zero now supports an organization-level IP allowlist that restricts logins and unattended access to a set of approved source IP addresses or ranges. This closes a gap where a compromised API key or service token could be used from any location. ## What's new * **IP allowlisting for UI logins**, including multi-org SSO * **IP allowlisting for API keys and service tokens**, so a compromised key can't be used to reach env zero from an untrusted network * **IP allowlisting for the Agent API**, adding defense in depth on top of token-based authentication for self-hosted agents ## How it works * The allowlist is configured per organization, supporting both IPv4 and IPv6 addresses and subnets. * If no allowlist is configured, all IPs are allowed. There's no change in behavior for organizations that don't opt in. * Once configured, logins and API/Agent requests are only permitted from an approved IP or subnet. Allowlist updates take effect immediately. > [!NOTE] > > IP allowlisting is configured at the organization level. Contact your env zero account team or [support](mailto:support@env0.com) to enable and configure it for your organization. Learn more: [IP allowlisting](/guides/overview/security-overview/ip-allowlisting) # Saved Cloud Plans on the Remote Backend Source: https://docs.envzero.com/changelogs/2026/05/saved-cloud-plans-remote-backend Save, inspect, and apply plan files end to end against the env zero remote backend with tofu plan -out, tofu show, and tofu apply. When you use env zero's remote backend, you can now work with saved plan files end to end: run `tofu plan -out` to save a plan, `tofu show` to inspect it, and `tofu apply` to apply exactly that saved plan. This gives you a reliable plan-then-apply workflow against the remote backend without re-running the plan. > [!TIP] > > Learn more in the [Remote Backend](/guides/admin-guide/remote-backend/remote-plan#save-a-plan-and-apply-it-later) documentation. # Say Hello to the New env zero CLI Source: https://docs.envzero.com/changelogs/2026/07/cli-for-ai-agents A single binary replaces the old npm-based CLI, with project management commands, read-only sign-in, and built-in support for AI coding agents. The env zero CLI has been rebuilt as a single binary, replacing the old Node package `@env0/cli` v1.x. Install it with Homebrew or npm, and get JSON output and stable exit codes designed for scripts, CI pipelines, and AI agents alike. ## What's new * **One binary, install anywhere**: `brew install env0/tap/env0` or `npm install -g @env0/cli@2`, plus a migration guide if you're coming from the old CLI. * **Manage projects from the terminal**: create and archive projects with `env0 project create` and `env0 project archive`. * **Read-only sign-in**: sign in to a read-only session, so a teammate or an AI agent can look around without being able to change anything. * **Live deployment logs**: stream logs as they happen with `env0 deployment logs --follow`. ## Built for AI agents The CLI ships `env0 skill install`, which teaches your coding agent (Claude Code by default, or Cursor, Codex, and Copilot with `--agent`) how to use it, no explaining required. Pair that with `env0 context` for one-call diagnosis, and an agent can inspect and troubleshoot environments on its own. Learn more: [env zero CLI](/guides/community-and-resources/support-and-help/env-zero-cli) # Download Your Plan as JSON Source: https://docs.envzero.com/changelogs/2026/07/download-plan-as-json Download a deployment's plan as masked JSON from the plan step's More download options menu, ready to feed into policy checks, diffing, or your own tooling. You can now download a deployment's plan as JSON from the plan step's **More download options** menu. env zero uploads a masked plan JSON from the agent and serves it through a download API, giving you a machine-readable plan you can feed into policy checks, diffing, or your own tooling. > [!TIP] > > Learn more in [Download the plan as JSON](/guides/admin-guide/environments#download-the-plan-as-json). # env zero Free Plan Source: https://docs.envzero.com/changelogs/2026/07/free-plan env zero now has a Free plan for evaluation and small-scale use, with 250 runs per month, 30 active environments, and community support. env zero now has a Free plan. You can sign up and start deploying without a trial period, a credit card, or a sales conversation. The Free plan is intended for evaluating env zero and for small-scale use. It carries fixed limits: * 250 runs per month. A run is one successful deploy, destroy, or drift detection. * Up to 30 active environments. * One concurrent deployment, with a 20-minute limit per run. * One self-hosted agent. * Community support. The published [support SLAs](/guides/community-and-resources/support-and-help/support) apply to paid plans only. When an organization reaches the run cap, deploys, destroys, and drift detection that you trigger are blocked, and unattended runs such as continuous deployment and scheduled deployments are skipped. The count resets at the start of each month, UTC. For what each plan includes, see [Subscription tiers](/guides/billing/subscription-tiers). The announcement post, [Introducing the env zero Free Tier](https://www.envzero.com/blog/introducing-the-env-zero-free-tier-full-featured-iac-orchestration-free-forever), covers the reasoning behind it. # V2 OIDC Tokens: Per-Cloud-Provider Audiences Source: https://docs.envzero.com/changelogs/2026/07/v2-oidc-tokens OIDC credentials for AWS, Azure, GCP, and Vault can now use a provider-specific token audience instead of a single shared audience across all providers. env zero now supports a v2 OIDC token format that issues a provider-specific `aud` (audience) claim for each cloud credential, instead of the same shared audience across AWS, Azure, GCP, and Vault. This prevents a token issued for one provider from being replayed against another, and lets you write cloud IAM trust policies that key off the audience claim. ## What's new * **Provider-specific token audiences** for AWS, Azure, GCP, and Vault OIDC credentials, instead of one shared audience across all providers * **Use v2 OIDC token** option on each OIDC credential (AWS, Azure, GCP, Vault), so you opt in per credential * Existing v1 credentials keep working unchanged. v2 is opt-in, not a forced migration ## How it works * When creating or editing an OIDC credential, check **Use v2 OIDC token** to switch that credential to a provider-specific audience (for example, `sts.amazonaws.com` for AWS). * v2 tokens also drop the deprecated `https://env0.com/*` claims. Use the `client_id` claim instead if you referenced those claims in trust policies. * v1 credentials are unaffected until you opt them in. > [!WARNING] > > Self-hosted agents need v5.2.0 or later. On an older agent, enabling v2 on a credential silently falls back to the v1 audience instead of failing, so confirm your agent version before you rely on the per-provider audience. Learn more: [OIDC integrations: token versions](/guides/integrations/oidc-integrations#token-versions-v2-per-provider-audience-and-v1-legacy) # Tag Your Environments Source: https://docs.envzero.com/changelogs/2026/08/environment-tags Attach key-value tags to environments, find them by tag in Explorer or the project list, and add or remove tags across many environments at once. You can now attach key-value tags to an environment, for example `team=payments` or `cost-center=1042`. Tags record ownership, cost attribution, or any other classification your project hierarchy does not express. A key holds one or more values, and an environment carries up to 50 key-value pairs. ## What's new * **Edit tags per environment**: a Tags card in the environment's Settings tab, with suggestions drawn from values already used elsewhere in your organization. * **Find tagged environments**: filter the Explorer table by `key=value`, or search the project environments list by tag. Explorer keeps the filter in the page URL, so a tag-filtered view is a link you can share. * **Change tags in bulk**: Add Tags and Remove Tags commands in the bulk operations wizard apply the same change across every selected environment. Editing tags requires the Edit Environment Settings permission. Anyone who can view an environment can read its tags, so keep secrets out of them. Learn more: [Environment Tags](/guides/admin-guide/environments/tags) # Full SCIM Provisioning Source: https://docs.envzero.com/changelogs/2026/08/scim-full-provisioning SCIM provisioning is generally available, adding provisioning modes, group push to env zero teams, token rotation, and a reconcile check for drift. SCIM provisioning is generally available. Your identity provider creates, updates, and deactivates env zero users and teams as changes happen, rather than at login. ## Provisioning modes Each organization runs in one provisioning mode, set in **Organization Settings** > **SSO**. **Full SCIM** turns off login-time provisioning. Users, teams, and admin roles come from your identity provider, and a user who is not already an organization member is denied login. **JIT** keeps login-time provisioning and rejects SCIM writes. A new SCIM configuration starts in Full SCIM. See [provisioning modes](/guides/sso-integrations/scim-provisioning#provisioning-modes) for what changes for your users at their next login. ## Groups become teams Pushing a group from Okta or Microsoft Entra ID creates an env zero team with the group's name and keeps its membership in sync. Project roles you assign to the team survive membership changes from your identity provider. ## Token rotation Rotate the SCIM bearer token without a provisioning outage. The previous token keeps working for 24 hours, so you can update your identity provider before it expires. ## Reconcile Compare your identity provider's SCIM data against env zero users and teams. The check is read-only and reports organization members who predate SCIM, along with group mappings whose team no longer exists. Applying the fixes runs as a background job, and never creates, renames, or deletes teams. ## Set it up * [SCIM provisioning](/guides/sso-integrations/scim-provisioning) * [SCIM provisioning with Okta](/guides/sso-integrations/scim-provisioning-okta) * [SCIM provisioning with Microsoft Entra ID](/guides/sso-integrations/scim-provisioning-entra-id) # Search, reworked across env zero Source: https://docs.envzero.com/changelogs/2026/08/search-improvements Project search ranks exact and prefix matches first, Cmd+K reports environment search errors, and list filters keep their URL state. Search updates are available on the Projects page, in Cmd+K, in project environment lists, and in Organization Settings. ## Projects On the Projects page, exact project-name matches appear first, followed by prefix matches, partial matches, and matches on project ID, description, or tags. The API keeps this order stable across pages. Search results show the full folder path. The matching project name remains visible when the column is narrow. ## Environments Cmd+K searches active environments by name, ID, or workspace across your organization. It distinguishes no matches from request errors. Inside a project, the Active, Needs Attention, and Scheduled tabs filter on name, workspace, template, user, status, and tags. The Inactive tab filters by environment or workspace name. The search text and number of displayed rows are kept in the URL alongside the selected tab. Browser back restores the same view, and you can share the filtered URL. ## Organization Settings Credentials and Git Tokens can be filtered. Credential columns can be sorted, and the page size can be set to 10, 25, 50, or 100 rows. Credential filters use displayed labels. For example, `kubernetes` finds GKE, EKS, and AKS credentials, and a project name finds credentials scoped to that project. Team search matches any part of a name, regardless of case. # Allowed IPs for Each API Key Source: https://docs.envzero.com/changelogs/2026/10/api-key-allowed-ips Limit an organization or personal API key to its own list of IP addresses, on top of your organization's IP allowlist. Each API key can now have its own list of allowed IPs. A key with a list works only from those addresses, so a leaked key can't be used from anywhere else. This works for organization API keys and personal API keys. ## What's new * **Allowed IPs on organization API keys**, set when you create a key or later from **Organization Settings > API Keys** * **Allowed IPs on personal API keys**, set from **Personal settings > Personal API Keys** * **An Allowed IPs column** on both key lists, which shows **Any IP** for a key with no list * **API endpoints** to set a key's list: [Update an API Key IP allowlist](/api-reference/credentials/update-an-api-key-ip-allowlist) and [Update a personal API Key IP allowlist](/api-reference/credentials/update-a-personal-api-key-ip-allowlist) ## How it works * A key's list takes IPv4 and IPv6 addresses, subnets, and ranges, up to 50 entries. * Your organization's [IP allowlist](/guides/overview/security-overview/ip-allowlisting) still applies. A request must come from an address on both lists. * A key with no list of its own works from any address the organization allowlist accepts. Existing keys don't change. Learn more: [Allowed IPs for one API key](/guides/overview/security-overview/ip-allowlisting#allowed-ips-for-one-api-key) # Action required: switch Azure DevOps connections to Microsoft Entra ID Source: https://docs.envzero.com/changelogs/2026/10/azure-devops-microsoft-entra-id Azure DevOps connections authorize through Microsoft Entra ID, and existing connections can switch from Azure DevOps OAuth in Organization Settings. > [!WARNING] > > Existing Azure DevOps connections keep using Azure DevOps OAuth until you switch them. Microsoft scheduled Azure DevOps OAuth for removal in 2026, and connections that have not switched stop working when it is removed. Microsoft is retiring Azure DevOps OAuth apps in 2026. env zero now connects to Azure DevOps through Microsoft Entra ID. New Azure DevOps connections use Microsoft Entra ID by default. Existing connections that use Azure DevOps OAuth show an exclamation mark in **Organization Settings > VCS**. Open the connection, select **Microsoft Entra ID (recommended)**, and sign in as the same Azure DevOps user. Templates, environments, and webhooks keep working after the switch. If your tenant requires admin consent, a Microsoft Entra administrator grants it once for the tenant. Learn more: [Microsoft Entra ID authentication](/guides/admin-guide/templates/azure-devops-integration#microsoft-entra-id-authentication) # Additional deployment controls Source: https://docs.envzero.com/guides/admin-guide/additional-controls Configure advanced deployment controls via environment variables at organization, project, template, or environment scope for Terraform and IaC tools. > [!WARNING] > > Disclaimer > > Additional Controls are features that aren’t available through the user interface, but can be used by setting the appropriate environment variables, at the Organization, Template, Project, or Environment level. > [!NOTE] > > **OpenTofu Support** > > All controls that relate to Terraform should control OpenTofu the same way. ## Terraform Targeted Apply Using the `ENV0_TERRAFORM_TARGET` environment variable, you can allocate specific resources that will be targeted for apply. The variable’s value will be passed to Terraform via the '-target\` flag.\ Read more [here](https://www.terraform.io/docs/commands/plan.html#target-resource). ## Specify Terraform/Terragrunt Versions Use the `ENV0_TERRAFORM_VERSION` environment variable to set the Terraform version your environment uses. env zero also accepts `ENV0_TF_VERSION` as a legacy alias. If both are set, `ENV0_TERRAFORM_VERSION` takes precedence. See [IaC binary versions](/guides/admin-guide/templates/iac-binaries-versions). You can also use the `ENV0_TERRAGRUNT_VERSION` environment variable to specify the Terragrunt version for your applicable Terragrunt deployments. Another way to determine the version for both Terraform and Terragrunt is a version file. When a file with a name. `{type}-version` (type being either "terraform" or "terragrunt") exists in the project's root directory the version is resolved based on the content of the file. The sole content of the file should be the version you wish to use. The order of precedence whenever the version is specified using more than one option is as follows: env zero environment variable, version file, version selected when creating/updating the template. > [!NOTE] > > **Specifying version in Terraform code** > > You can also set the version in your [Terraform code](https://developer.hashicorp.com/terraform/language/settings#terraform-required_version) and env zero will automatically detect and install the minimum required version specified in your code. ## Custom Terraform Variables File Using the `ENV0_TERRAFORM_CONFIG_FILE_PATH` environment variable, you can select multiple Terraform variable files to pass on to Terraform. The list of filenames should be comma delimited. ## Terraform Backend Config Using the `ENV0_TERRAFORM_BACKEND_CONFIG` environment variable, you can pick a custom backend config to be used in `terraform init`. The value of the variable will be passed to the `-backend-config` flag.\ If you would like to have multiple `-backend-config` declarations, you can pass the multiple values in the `ENV0_TERRAFORM_BACKEND_CONFIG` environment variable as a comma-delimited string. For example, a value of `/path/to/config/file,key=value` will result in the flags `-backend-config="/path/to/config/file" -backend-config="key=value"`.\ Read more [here](https://developer.hashicorp.com/terraform/language/backend#partial-configuration). ## Enable Cost Tagging Per Environment Cost tagging works on the project level and once enabled, env zero will tag every environment under that project. Sometimes (mainly for debugging purposes) you might wish to turn on cost tagging only for a specific environment and not for the whole project.\ You can do that using the `ENV0_ENABLE_COST_TAG` environment variable. ## Adding Custom Resource Tagging When cost tagging is enabled for an environment, using the `ENV0_CUSTOM_TAGS` environment variable will enable custom resource tags to be applied using terratag (for Terraform and Terragrunt) or natively for other IaCs.\ The variable value should be supplied in the form of: `{"aTagName": "aTagValue", ...}`.\ This would apply the tags to all taggable resources in the environment.\ You can use other environment variables in the tags, for example `{"created_by": "$ENV0_ENVIRONMENT_CREATOR_NAME"}`. See [this list](/guides/admin-guide/custom-flows/#exposed-env-zero-system-environment-variables) for the environment variables that env zero exposes. ## Filtering Terratag Resource Types When cost tagging is enabled, terratag applies tags to all resource types by default. To control which Terraform resource types are tagged, set terratag's native environment variables on your environment, project, template, or organization. `TERRATAG_FILTER` and `TERRATAG_SKIP` map to terratag's `-filter` and `-skip` CLI flags. Both values are regex patterns. **To include only specific resource types**, set `TERRATAG_FILTER`: ```bash theme={null} TERRATAG_FILTER=aws_s3_bucket|aws_instance ``` This applies cost tags only to S3 buckets and EC2 instances. **To exclude specific resource types**, set `TERRATAG_SKIP`: ```bash theme={null} TERRATAG_SKIP=aws_iam_role|aws_iam_policy ``` This skips IAM role and policy resources. **To skip a family of resource types**, use a prefix pattern: ```bash theme={null} TERRATAG_SKIP=^aws_iam_.* ``` This skips all IAM resources. `TERRATAG_FILTER` and `TERRATAG_SKIP` can be combined. When a resource type matches both patterns, `-skip` takes precedence and the resource is not tagged. > [!NOTE] > > The default behavior (when neither variable is set) is equivalent to `TERRATAG_FILTER=.*`, meaning all supported resource types are tagged. Terratag uses Go's RE2 regex engine, which does not support negative lookahead; use `TERRATAG_SKIP` for exclusions instead. > > For the full list of terratag flags and their matching environment variables, see the [Terratag CLI flags](/guides/community-and-resources/community-and-open-source/terratag#cli-flags) reference. ## Skip Workspace Commands For each environment, select the existing terraform workspace or create one if necessary. The workspace will be deleted upon destroying the environment.\ If you wish not to execute these commands you can skip them by using the`ENV0_SKIP_WORKSPACE` environment variable and set its value to true. Please remove the environment variable altogether or set its value to empty to run the workspace commands. ## Custom Git Clone Arguments By default, your repository will be cloned with the arguments `--depth=1 --single-branch`.\ You can override this by supplying the environment variable `ENV0_GIT_CLONE_ARGS`, the value of which will be sanitized and appended to the Git clone command instead of the default arguments. ## Skip Git Submodules By default, if you have Git submodules configured in your repository, env zero clones them with a depth of 1.\ If you do not wish to clone your Git submodules, you can manage that via the `ENV0_SKIP_SUBMODULE_GIT_CLONE` environment variable and set its value to `true`.\ If you remove the environment variable altogether or set its value to be empty, env zero will clone your Git submodules. ## Skip Get Working Directory If you do not want to use the current working directory, set `ENV0_IGNORE_STATE=true` ## Keep Terraform Providers in the Working Directory Archive The working directory archive that env zero saves between deployments does not include provider binaries (`.terraform/providers`), which keeps the archive orders of magnitude smaller. Every flow that restores the archive runs an init step that downloads the providers again, including [ad hoc tasks](/guides/admin-guide/environments/ad-hoc-tasks#tasks-and-terraform-init). Set `ENV0_ARCHIVE_TF_PROVIDERS=true` to keep the provider binaries in the archive. Use this when the deployment container cannot reach a provider registry or a mirror, since the init step needs one. It brings back the storage cost of the larger archive. ## Skip Plan Step in Terragrunt Run-All If `run-all apply` is failing, you can try skipping the plan step by setting `ENV0_TERRAGRUNT_RUN_ALL_SKIP_PLAN=true` with "Approve Plan Automatically" enabled. Read more [here](/guides/admin-guide/templates/terragrunt/#run-all-terragrunt-command-checkbox) ## Skip state refresh in Pulumi deploy previews The Pulumi Preview step runs `pulumi preview --refresh`, which reads the current state of every resource from your cloud provider before computing the diff. On large stacks the refresh can be most of the step's runtime. Set `ENV0_PULUMI_SKIP_PREVIEW_REFRESH=true` to drop `--refresh` from the Preview step of deployments, pull request plans, drift detection and dry runs. Remove the variable or set any other value to refresh again. The variable does not affect destroy previews or `pulumi up`, which keep refreshing. To skip the refresh on a destroy preview, use the **Skip state refresh** checkbox in the destroy dialog. To skip it on `pulumi up`, see [Pass custom CLI arguments to Pulumi commands](#pass-custom-cli-arguments-to-pulumi-commands). > [!WARNING] > > Without the refresh, the preview diffs against the last saved state instead of live cloud state. Changes made outside Pulumi do not show in the preview, and drift detection does not report them. ## Pass custom CLI arguments to Pulumi commands env zero runs Pulumi with a fixed set of flags (`--refresh --diff --show-replacement-steps`). Set one of these environment variables to append your own arguments to a Pulumi command: | Environment variable | Added to | | - | - | | `ENV0_PULUMI_CLI_ARGS_preview` | The Pulumi Preview step: `pulumi preview` on deploy, pull request plans, drift detection and dry runs, `pulumi destroy --preview-only` on destroy | | `ENV0_PULUMI_CLI_ARGS_up` | `pulumi up` | | `ENV0_PULUMI_CLI_ARGS_destroy` | `pulumi destroy` | The value is added after the built-in flags, and for a repeated on/off flag Pulumi uses the last one. List flags such as `--target` and `--replace` add up instead. To turn off a built-in on/off flag, set it to `false`. env zero passes the whole string through a shell. Quote only an individual argument that contains `$` or spaces, such as a `--target` URN, in single quotes. Do not quote the whole string, or the shell passes all the flags as one argument. For example: * `ENV0_PULUMI_CLI_ARGS_up=--refresh=false` skips the state refresh on `pulumi up`. * `ENV0_PULUMI_CLI_ARGS_preview=--diff=false --show-replacement-steps=false` (and the same on `_up`) removes the verbose diff output that can hide the real error. * `ENV0_PULUMI_CLI_ARGS_up=--target 'urn:pulumi:dev::app::my:module:Parent$aws:s3/bucket:Bucket::logs' --refresh=false` updates one child resource and skips the refresh. The URN is in single quotes because it contains `$`. The Preview step does not get `--target` from `_up`, so the plan you approve still lists every resource. > [!WARNING] > > Without the refresh, Pulumi works from the last saved state instead of live cloud state. Changes made outside Pulumi are not picked up. > > The Preview step also runs for drift detection, pull request plans and dry runs. With `--refresh=false` in `ENV0_PULUMI_CLI_ARGS_preview` (or `ENV0_PULUMI_SKIP_PREVIEW_REFRESH=true`), drift detection does not report changes made outside Pulumi. > [!WARNING] > > On destroy, `ENV0_PULUMI_CLI_ARGS_preview` is added to two commands: `pulumi destroy --preview-only` and its `--json` copy. Use only flags that both `pulumi preview` and `pulumi destroy` accept. If `pulumi destroy` rejects a flag, env zero cannot show the destroy preview. It prints the stack contents instead and the destroy continues. ## Ansible Flags and Variables You can set any environment variable prefixed by `ANSIBLE_CLI_` to set any flag for `ansible-playbook`. Additionally - you can set any environment variable prefixed by `ANSIBLE_VAR_` to set any extra variable to be added under the `--extra-vars` flag. Read more [here](/guides/admin-guide/templates/ansible/#additional-controls). ## Ansible Custom Playbook File By default, env zero will try to run `ansible-playbook` on `playbook.y[a]ml`. You can control that file's name by setting the `ENV0_ANSIBLE_PLAYBOOK` variable. ## Skip Ansible Check Playbook Step If you like to skip the Ansible check step, add an environment variable named `ENV0_SKIP_ANSIBLE_CHECK` and set the value to `true`. Read more [here](/guides/admin-guide/templates/ansible/#skipping-ansible-check-step). ## Next steps * [Target specific resources](/guides/admin-guide/environments/targeted-deployments) from the deploy dialog * [Set these variables](/guides/admin-guide/variables) at the organization, project, template, or environment scope # View audit logs Source: https://docs.envzero.com/guides/admin-guide/audit-logs Track changes in your env zero organization: who made each change, whether it came from the UI, CLI, or API, and which resource it affected. The audit log records changes made in your organization: who made each change, where it came from, which resource it affected, and when. env zero records an event for most create, update, and delete requests made through the UI, the CLI, or the API, and for user logins. Some write actions are not recorded, such as canceling a deployment or approving a plan. It does not record read requests. ## Permissions > [!WARNING] > > Viewing the audit log, in Organization Settings or through the API, requires the **View Audit Logs** permission. The Organization Admin role includes this permission. To grant it to other users, add it to a [custom role](/guides/admin-guide/user-role-and-team-management/custom-roles). [Read-only API keys](/guides/admin-guide/user-role-and-team-management/api-keys#read-only-api-key) keep it. ## Recorded events Each event is named after the action that triggered it. The table lists examples for each area. The **Action Name** filter lists every action name. | Area | Example action names | | :- | :- | | Organization | Update Policy | | Projects | Create a new Project, Update a Project, Archive a Project, Upsert a project's budget | | Environments and deployments | Create Environment, Deploy Environment, Destroy Environment, Lock/Unlock environment, Update Environment TTL, Move Environment between Projects, Bulk deploy | | Drift | Set Drift Detection Environment Scheduling, Remediate Drift, Ignore Drift Cause | | Templates, modules, and providers | Create Template, Add Template to Project, Create module | | Variables | Create or update variable, Delete a variable, Create a configuration set | | Users, teams, and roles | User Login, Invite User, Remove User, Create Team, Create a Role, Create or Update a Role Assignment for a User | | API keys | Create API Key, Delete an API Key, Update an API Key IP allowlist | | SSO and SCIM | SSO configuration deleted, SCIM configuration created, SCIM token rotated, SCIM mode changed, SCIM reconcile applied, User provisioned, User deprovisioned, Group provisioned, Group member added | | Credentials | Create Credentials, Associate credentials with project, Associate Cost Credentials with Project | | VCS | Create VCS Connection, Update VCS Connection, Create a git token, Create a new SSH key, Create VCS Provider User Mapping | | Agents | Create agent, Create agent secret, Revoke agent secret, Assign agents to projects | | Governance | Create Approval Policy, Create Custom Flow, Create or Update Workflow Trigger | | Integrations and notifications | For creating or updating log forwarding configuration, Create or update an organization CloudQuery integration, Create Notification Endpoint, Update Notification Settings | | Cloud Compass | Start a Cloud Compass credential wizard draft, Delete a Cloud Compass credential, Silence A Cloud Compass Insight | ## Who performed an action **Performed By** names the person responsible for the event, and **Source** shows how the request reached env zero. | How the action was made | Performed By | Source | | :- | :- | :- | | env zero web app | The signed-in user | **UI** | | env zero CLI after `env0 login` | The signed-in user | **CLI** | | Personal API key, from the API or the CLI | The key owner | **API** | | Admin or user API key, from the API or the CLI | The API key, with **on behalf of** the user who created it | **API** | **System** marks requests that one env zero service makes to another. API keys that env zero creates automatically, such as OIDC and Terraform deployer keys, have no **on behalf of** user. Filtering **Performed By** by a user also returns actions made with API keys that user created. Some events show no source: events recorded before env zero tracked the source, user logins, [SCIM events](#scim-events), and a few settings changes such as **SSO configuration deleted**. Select **Not recorded** in the **Source** filter to find them. ### SCIM events * Changes your identity provider makes through [SCIM](/guides/sso-integrations/scim-provisioning), such as **User provisioned** or **Group member added**, show **Unknown user (SCIM)** under **Performed By** and no source. * Changes an admin makes to SCIM settings, such as **SCIM token rotated** or **SCIM mode changed**, show the admin under **Performed By** and no source. ## View the audit log **1. Open the audit log** Go to **Organization Settings** and select the **Logs** tab. **2. Narrow the results** Pick a date range, and use the column filters on **Performed By**, **Source**, **Action Name**, **Project**, and **Entity**. Sort by **Performed At** to change the order. **3. Inspect an event** Expand a row to see the event's recorded details, when it has any. **4. Load more events** Click **Show more** at the bottom of the table. | Column | Shows | | :- | :- | | **Performed By** | The person responsible. See [Who performed an action](#who-performed-an-action). | | **Source** | **UI**, **CLI**, **API**, or **System** | | **Action Name** | The action that was recorded | | **Project** | The project the event belongs to | | **Entity** | The environment, deployment, project, or template the event changed. Click the filter icon to show only that entity's events. | | **IP Address** | The IP address the request came from | | **Performed At** | When the event was recorded | When you apply filters, env zero searches a range of events per page. If it stops before the end of your date range, a note under the table shows how far it searched. Click **Show more** to search further. ## Fetch audit logs through the API Use [Fetch Audit Logs](/api-reference/audit-events/fetch-audit-logs) to retrieve audit logs programmatically. It supports the same filters as the table: date range, users, projects, entity, action names, and source. ## Forward audit logs To send audit logs to an external platform such as Datadog or Splunk, enable **Audit Log Forwarding** in a [log forwarding integration](/guides/integrations/logs-forwarding#audit-logs). The integrations that receive audit logs appear at the top of the **Logs** tab. ## Next steps For deployment counts and environment status across the organization, open the [monitoring dashboards](/guides/admin-guide/dashboards). # Custom flows overview Source: https://docs.envzero.com/guides/admin-guide/custom-flows Run custom commands during deployment with env0.yml custom flows, supporting bash, Python, and Ansible hooks before or after Terraform init and apply. Custom Flows are a way to run your own commands during the deployment of your environment. These will run outside the IaC of your choice and allow you to perform supplemental actions. For example, injecting custom variables into your IaC code before you apply it or calling external APIs with the outputs of your deployment. Custom Flows allow you to run whatever you want (bash, Python, Gcloud, Ansible, CloudFormation, etc.) at any point in the deployment process– before or after Terraform init/plan/apply, destroy/error and even [tasks](/guides/admin-guide/environments/ad-hoc-tasks). To attach a custom flow to a single [template](/guides/admin-guide/templates):\ Create a file named *env0.yml* under the template folder. env zero will use this file if it's found in your git repository. For sharing a custom flow between templates:\ Create a file named *env0.yml* under the root folder. env zero will use this file if it is defined, and an env0.yml file is not found in the template folder. For sharing a custom flow for all environments under a particular project:\ Create a custom flow file in any repository and [configure](/guides/admin-guide/custom-flows/project-level-custom-flow) it as a project policy. *We support the suffixes env0.yml and env0.yaml in the same way.* > [!NOTE] > > **Working Directory for env0.yml** > > env zero will run Custom Flow commands with the working directory being the one containing the YAML file. Based on that, you can reference your commands to other scripts/commands by using `./script.sh.` > [!NOTE] > > **Project level Custom Flows** > > Only the env0.yaml is "cloned" for project level Custom Flows, this means that scripts and other files referenced by your Custom Flow will either need to be cloned into the working directory, or you must specify the repo path location of your scripts and files. Below is an example of a custom flow that creates a more "dynamic" Terraform file, based on an environment variable value, and uses Python and Jinja before the Terraform Init (the full example of this template git repo (including the `env0.yml` file) is [here](https://github.com/env0/blueprints/blob/demo/redash/v5.0.2/aws/)): ```yaml theme={null} version: 2 deploy: steps: terraformInit: before: - name: Hydrate Template run: | pip install --user jinjanator echo "Generating \"stage.auto.tfvars\" for \"$STAGE\"" jinjanate stage.auto.tfvars.j2 > stage.auto.tfvars echo -e "Generated \"stage.auto.tfvars\":\n$(cat stage.auto.tfvars)" echo "Generating \"elb.tf\" for \"$STAGE\"" jinjanate elb.tf.j2 > elb.tf echo -e "Generated \"elb.tf\":\n$(cat elb.tf)" ``` You can include the following possible hooks in an \_ env0.yml \_ file. > [!NOTE] > > **OpenTofu backward-compatibility** > > Terraform's Custom Flow format is interchangeable with OpenTofu's. > [!NOTE] > > Task hooks > > Task hook uses the stored working directory source code to run, it will not fetch an updated version from you VCS provider. If you need updated files on your working directory to run the task hooks you will need to first run a deployment to update the files. ## Hook Stages ```yaml Terraform theme={null} version: type: number shell: sh (default) or bash deploy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string terraformInit: before: - type: string after: - type: string terraformPlan: before: - type: string after: - type: string terraformApply: before: - type: string after: - type: string storeState: before: - type: string after: - type: string terraformOutput: before: - type: string after: - type: string destroy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string terraformInit: before: - type: string after: - type: string terraformPlan: before: - type: string after: - type: string terraformDestroy: before: - type: string after: - type: string ``` ```yaml OpenTofu theme={null} version: type: number shell: sh (default) or bash deploy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string opentofuInit: before: - type: string after: - type: string opentofuPlan: before: - type: string after: - type: string opentofuApply: before: - type: string after: - type: string storeState: before: - type: string after: - type: string opentofuOutput: before: - type: string after: - type: string destroy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string opentofuInit: before: - type: string after: - type: string opentofuPlan: before: - type: string after: - type: string opentofuDestroy: before: - type: string after: - type: string ``` ```yaml Pulumi theme={null} version: type: number shell: sh (default) or bash deploy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string pulumiPreview: before: - type: string after: - type: string pulumiUp: before: - type: string after: - type: string storeState: before: - type: string after: - type: string pulumiOutput: before: - type: string after: - type: string destroy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string pulumiPreview: before: - type: string after: - type: string pulumiDestroy: before: - type: string after: - type: string ``` ```yaml CloudFormation theme={null} version: type: number shell: sh (default) or bash deploy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string cfCreateChangeSet: before: - type: string after: - type: string cfDeploy: before: - type: string after: - type: string cfOutput: before: - type: string after: - type: string storeState: before: - type: string after: - type: string destroy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string cfListStackResources: before: - type: string after: - type: string cfDeleteStack: before: - type: string after: - type: string ``` ```yaml Kubernetes theme={null} version: type: number shell: sh (default) or bash deploy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string k8sDiff: before: - type: string after: - type: string k8sApply: before: - type: string after: - type: string storeState: before: - type: string after: - type: string destroy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string k8sDiff: before: - type: string after: - type: string k8sDelete: before: - type: string after: - type: string ``` ```yaml Helm theme={null} version: type: number shell: sh (default) or bash deploy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string helmDiff: before: - type: string after: - type: string helmUpgrade: before: - type: string after: - type: string storeState: before: - type: string after: - type: string destroy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string helmDiff: before: - type: string after: - type: string helmUninstall: before: - type: string after: - type: string ``` ```yaml Ansible theme={null} version: type: number shell: sh (default) or bash deploy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string ansibleGalaxy: before: - type: string after: - type: string ansibleCheck: before: - type: string after: - type: string ansiblePlaybook: before: - type: string after: - type: string destroy: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string ``` ```yaml Task theme={null} version: type: number shell: sh (default) or bash task: onCompletion: - type: string onSuccess: - type: string onFailure: - type: string steps: setupVariables: after: - type: string taskCommands: before: - type: string after: - type: string storeState: before: - type: string ``` ## Specifying the Shell Currently, env zero's Custom Flow features allow you to select the shell: `sh` (default) or `bash`\ To use `bash`, add the following snippet into your\_ env0.yaml\_: ```yaml theme={null} shell: bash ``` ## Handling Errors If any command in your custom flow returns a non-zero exit code, the env zero deployment will stop on a 'Failed' status. You can use this to perform validation. For instance, asserting that a certain environment variable was supplied. In such a case, env zero will display any output from `stderr` as the deployment error. If no output is found in `stderr`, it will be shown as an 'Unknown Error'. > [!NOTE] > > **Error Message Handling** > > Use the `1>&2` notation to redirect stdout messages to `stderr`. This allows env zero to display the message in its UI (see [I/O Redirection](https://tldp.org/LDP/abs/html/io-redirection.html)) Here is an example: ```yaml env0.yml theme={null} version: 2 deploy: steps: setupVariables: after: - if [ -z "$MY_VAR" ]; then echo "MY_VAR must be supplied" 1>&2 && exit 1; fi ``` ## Exposed env zero System Environment Variables env zero exposes the following environment variables for you to use: | Variable Name | Value Description | | - | - | | `ENV0_ENVIRONMENT_ID` | The deployed Environment ID | | `ENV0_PROJECT_ID` | The Project ID of the deployed Environment | | `ENV0_PROJECT_NAME` | The Project Name of the deployed Environment | | `ENV0_DEPLOYMENT_LOG_ID` | The deployment ID | | `ENV0_DEPLOYMENT_TYPE` | The deployment type. One of `deploy` / `destroy` / `prPlan` / `driftDetection` / `task` | | `ENV0_DEPLOYMENT_REVISION` | The revision (available only when deployment revision is defined) | | `ENV0_WORKSPACE_NAME` | The Terraform Workspace name used in the Environment | | `ENV0_ROOT_DIR` | The root repository path | | `ENV0_ORGANIZATION_ID` | Your env zero organization ID | | `ENV0_ORGANIZATION_NAME` | Your env zero organization name | | `ENV0_TEMPLATE_ID` | The deployed Template ID | | `ENV0_ENVIRONMENT_URL` | Link to the deployed Environment in the env zero web app | | `ENV0_DISCOVERY_REPOSITORY_URL` | The repository the Environment was discovered from. (available on every deployment of an Environment created by [Environment discovery](/guides/admin-guide/environment-discovery), whatever started it) | | `ENV0_DISCOVERY_VCS` | The VCS provider of that repository. (available only on the PR Plan that a pull request on the discovery repository starts) | See [this example](https://github.com/env0/templates/tree/master/misc/environment-variables) for using these variables in our public templates repo. > [!NOTE] > > **Note** > > You can use exposed env zero variables in the UI using the \$\{...} notation: > > ![env0 variables UI notation example](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/env0_variables_ui_notation_example.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=671efc34e7810ec973184794bc1d4636) ## env zero System Files env zero generates a few files during runtime that can be used in a custom flow (and terraform) to help you programmatically access environment variables and Terraform variables. ### env0.system-env-vars.json This file contains all the environment variables generated by env zero through metadata. See above for list of available environment variables and their respective descriptions. ### env0.auto.tfvars.json This file contains all the variables defined through the UI in json format. For example, you can parse the file using jq. ```bash theme={null} cat env0.auto.tfvars.json | jq -r '.' ``` ### env0.env-vars.json This file is similar to the Terraform variables, and contains all the environment variables defined through the env zero UI. This can also be parsed using jq. > [!NOTE] > > **Accessing Environment Variables in Terraform** > > You can use this file to access environment variables within your Terraform code. Simply read and jsondecode the env0.system-env-vars.json file to get access to the metadata. See example: > > ```hcl theme={null} > locals { > env_vars = jsondecode(file("env0.system-env-vars.json")) > } > > output "env0_environment_id" { > value = local.env_vars.ENV0_ENVIRONMENT_ID > } > ``` ## Using Additional CLI Tools in Custom Flows Custom flows execute your shell commands within a dedicated deployment container. This container comes pre-loaded with a standard set of utilities, including common OS tools and package managers. However, if your custom flow hooks require specific command-line interface (CLI) tools, such as the `AWS` CLI or `kubectl`, you must explicitly configure the deployment to install them. To add these tools, set the `ENV0_INSTALLED_TOOLS` environment variable with a comma-separated list of the tools you need. For example, to make the AWS CLI and kubectl available in your deployment container, you would set the following variable: ```bash theme={null} ENV0_INSTALLED_TOOLS=aws,kubectl ``` You can set this variable at any level. For instance, if one project uses `kubectl` and another uses the `aws` CLI, it's best to set the variable at the project level to ensure each environment has only the tools it requires. ### Available tools | Tool | Description | | - | - | | `kustomize` | A Kubernetes native tool for customizing application configuration. | | `infracost` | Shows cloud cost estimates for Terraform, helping to manage budgets. | | `kubelogin` | A kubectl plugin for non-interactive authentication with OIDC providers. | | `opa` | Open Policy Agent, a general-purpose policy engine for cloud native environments. | | `aws` | The official command-line tool for Amazon Web Services. | | `gcloud` | The primary command-line tool for Google Cloud Platform. | | `az` | The official command-line tool for Microsoft Azure. | | `helm` | The package manager for Kubernetes, used to find, share, and use software. | | `dyff` | A diff tool for YAML files, especially useful for Kubernetes manifests. | | `kubectl` | The command-line tool for controlling Kubernetes clusters. | | `terratag` | A CLI tool for managing tags across all resources in a Terraform project. | | `pwsh` | PowerShell, a cross-platform task automation and configuration management framework. (Not supported on the **arm64** architecture or when running in **strictSecurityContext** mode. If you need this functionality, you must extend the image.) | | `gke-gcloud-auth-plugin` | A plugin to handle GKE authentication for kubectl and other clients. | > [!WARNING] > > **Version Updates** > > env0 will periodically update tool versions to address security considerations or end-of-life (EoL) versions. > Customers will be notified in advance whenever an update introduces breaking changes. > > You can always check the currently installed versions under the Init Packages step. ## Exporting your own environment variables To export your own Environment Variable to use in any downstream custom flow you should write a shell command in the format: `echo KEY=VALUE >> $ENV0_ENV`.\ In later steps of the same deployment, you will be able to use `$KEY` to access the stored value. > [!NOTE] > > **Note** > > For \_env0.yml \_ files that use schema version 2, when using multiple commands within a given step e.g., `terraform:plan-before`, all commands are executed inside the same shell. Exported Environment variables like these are only available for the steps that follow. > For values within the same shell, using the usual `export key=value` still works. ## Forcing Manual Approvals Whenever `ENV0_REQUIRES_APPROVAL=true` occurs, env zero will force deployment to require approval, regardless of the Auto Approval setting in the Environment. For example, instead of failing a deployment based on some policies, we can use this field to help ensure that others can still review and proceed with the deployment. Usage:\ `- echo ENV0_REQUIRES_APPROVAL=true >> $ENV0_ENV` > [!NOTE] > > **Note** > > If the project has [Skip apply when plan has no changes](/guides/policies-governance/deployment-controls#skip-apply-when-plan-has-no-changes) enabled and the plan reports no resource changes, the deployment finishes without waiting for approval and the apply step is marked as skipped. There is nothing to apply, so there is nothing to approve. This applies to workflow sub-environments as well, through the policies of the project they belong to. > > An [approval policy](/guides/policies-governance/approval-policies) that returns a pending result still holds the deployment for approval, whether or not the plan has changes. ## FAQ **Q.** How can I use Custom Flows to add new Terraform variables? **A.** The recommended approach to adding Terraform variables is to use variable definitions files, specifically the *.auto.tfvars* or *.auto.tfvars.json* files, to pass additional variables to your Terraform code. Note: Please be aware of the Terraform Variable Definition Precedence order, defined [here](https://developer.hashicorp.com/terraform/language/values/variables#variable-definition-precedence). Another way is to create new Environment Variables inside the custom flow in the form of `TF_VAR_key=value`. To do that, please follow our [guide for exporting your environment variables](https://www.terraform.io/cli/config/environment-variables#tf_var_name). **Q.** I noticed that env zero runs `init` again after approval. How can I run my custom flow only once per deployment? **A.** You can take advantage of the ENV0\_REVIEWER\_NAME field to see if the plan has already been approved. For example: ```yaml theme={null} deploy: steps: terraformInit: before: # run ./myScript.sh only on pre-approval - if [ -z "$ENV0_REVIEWER_NAME" ]; then ./myScript.sh; fi ``` **Q.** Do env zero SaaS runners use static IP addresses? I would like to whitelist env zero's runners to access my network.\ **A.** Yes, env zero uses those [IP addresses](/guides/overview/security-overview/ip-addresses) for all the outbound requests. **Q.** How do I export a multi-line string into an environment variable?\ **A.** Wrap the value in double quotes. env zero reads `$ENV0_ENV` as a dotenv file, which keeps line breaks inside a double-quoted value: `printf 'MY_PEM_FILE="%s"\n' "$(cat "$PEM_FILE")" >> $ENV0_ENV` > [!WARNING] > > **GitHub API limits** > > When downloading resources from GitHub (e.g., tflint), make sure you use an authenticated call (e.g., `curl -u USER:TOKEN`). Otherwise, you will likely run into API limits, as unauthenticated calls are pooled with other SaaS users, with a much lower API limit. See [GitHub Rate Limiting](https://docs.github.com/en/rest/overview/resources-in-the-rest-api#rate-limiting). ## Next steps * [Switch to the v2 step schema](/guides/admin-guide/custom-flows/version-2-schema) so each step shows as its own deployment step * [Pass variables into custom flow commands](/guides/admin-guide/variables) * [Build and push Docker images in a custom flow](/guides/admin-guide/self-hosted-kubernetes-agent/docker-in-custom-flows) on a self-hosted Kubernetes agent # Project-level custom flow Source: https://docs.envzero.com/guides/admin-guide/custom-flows/project-level-custom-flow Configure custom flows at the project level to apply across all environments, with override or merge policies for template-level env0.yml files. Project-level custom flows allow you to configure multiple [custom flows](/guides/admin-guide/custom-flows) for all the environments under a project or a project's [hierarchy](/guides/admin-guide/projects/sub-projects). > [!NOTE] > > **Overriding Local Custom Flow** > > To configure the custom flows override policy go to the organization settings page, go to *POLICIES* tab and choose either: > > * `Project custom flows will override template custom flow` - Project-level custom flows will override any existing custom flows configured for the environment. If there are no custom flows in the project's hierarchy we will run the environment's custom flow. > * `Merge project custom flows with the template custom flow` - Project-level custom flows will be merged with existing environment custom flow. The environment's custom flow will run after the projects' custom flows. > > The default value for new organizations is to merge custom flows. ## Use cases to configure per project * Access control - Control access to the custom flow file using a separate repository with different permissions from the IaC repository, and prevent developers from modifying the custom flow. * DRY - Re-use the same custom flow across multiple environments. ## Handling multiple custom flows The way we handle multiple custom flows is by merging them into one custom flow. The steps will run according to their order in the hierarchy meaning a parent project's custom flow step will run first, then a child project's step will run and then the environment's custom flow step (If we are running with merge policy).\ You can change specific steps' order by using the new `executeAfterChild` property in the [custom flow step](/guides/admin-guide/custom-flows/version-2-schema#new-step-schema). Using it you can configure a certain step in the parent to run after all the children finish. To see what custom flows will run for a deployment, view the merged custom flow file in the loading spec file step logs. ## Setting up custom flows execution order To decide in what order custom flows will run, you can go to the project's custom flows table in the policies tab and reorder them however you want by dragging and dropping them. Pressing the save button will persist the new order. You can also have finer control by using the new `executeAfterChild` property of the custom flow file. Setting that value to `true` will make the step run only after all the child executions finished (sub project's or the environment's custom flows) ## How to configure 1. Select the project which you like to configure from the projects list 2. Go to Project Settings -> Polices 3. Under **Project Policies** section 4. Click **+ Add Custom Flow** to configure VCS details. ![Add Custom Flow button in Project Policies settings section](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/custom-flows/87982ff-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=789a79a679693d8c368baba3693d803a) 5. Choose VCS type, repository, file path, revision. The file path should be a full path to the custom flow with the supported suffixes (`.yml`/`.yaml`). ![VCS configuration form for custom flow with fields for type, repository, file path, and revision](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/custom-flows/3c43d6e-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=9eb378b31bc3bf58a6c45f81f42e151d) 6. Click **update** to close the popup 7. Click **Save** to apply changes > [!NOTE] > > **Custom Flow File Validation** > > env zero validates the custom flow file in the following cases: > > 1. When you add the custom flow under project policies > 2. Before you run a deployment > > If the file is invalid, you cannot continue and must fix the file. ## Examples for custom flows ### Run OPA with policy in another VCS This example [policy](https://github.com/env0/templates/blob/master/custom-flows/opa-polices/null-resource.rego) will calculate how many null-resource's have been changing. It will fail when it is bigger than 2. In addition, we can see that custom flow takes the rego file from an external repository. ```yaml opa.yml theme={null} version: 1 deploy: steps: setupVariables: after: - curl -L -o opa https://openpolicyagent.org/downloads/v0.46.1/opa_linux_amd64_static - chmod 755 ./opa - git clone https://$ENV0_VCS_ACCESS_TOKEN@github.com/env0/templates.git external-repo terraformPlan: after: - terraform show -json .tf-plan >> tfplan.json - ./opa eval --format pretty -i tfplan.json -d ./external-repo/custom-flows/opa-polices/null-resource.rego --fail "data.resource.limit.allow = true" ``` ## Next steps If your environments depend on each other and must deploy in order, see the [workflow overview](/guides/admin-guide/workflows). # Custom flow schema (v2) Source: https://docs.envzero.com/guides/admin-guide/custom-flows/version-2-schema Reference for the version 2 env0.yml custom flow schema, where each configured step appears as a separate deployment step in the env zero UI with its own logs. ## Overview The `version: 2` env0.yaml schema introduces a change to how [custom flow](/guides/admin-guide/custom-flows) steps are configured and shown on env zero UI. These changes are reflected by: 1. A new step schema, described here. 2. Each custom step configured will be presented as a **separate** deployment step in env zero UI. For example this env0.yaml: ```yaml theme={null} version: 2 deploy: steps: terraformPlan: after: - name: Enforce Networking Policies run: ./enforce-networking-policies-script.sh env: FOO: bar ``` Would yield this deployment step list: ![A new Enforce Networking Policies custom deployment step](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/custom-flows/a_new_enforce_networking_policies_custom_deployment_step.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=8e06da1f38bb7337c4fac0687b3bd3c6) > [!NOTE] > > **V1 String-Only Steps Backward Compatibility** > > As the `version: 1` schema steps used to be a list of strings, the new `version: 2` schema keeps this syntax as backward compatible. The only difference is that now string-only steps will have their name originated by the command they execute. For example, if a step is configured as: > > ```yaml theme={null} > version: 2 > deploy: > steps: > terraformPlan: > after: > - echo foo > ``` > > then his custom deployment step name would be ***echo foo*** in env zero UI. ## New Step Schema The `version: 2` steps are now configured as an `object`, rather than a `string`. This `object` includes the following attributes: 1. `name`(**Required**) - The name of the step that would be shown in env zero UI. 2. `run` (Exactly one of `run` or `use` is **required**) - The bash command/s to execute. 3. `use` (Exactly one of `run` or `use` is **required**) - The GIT URL of the env zero plugin in the form of `@` (for e.g `https://github.com/env0/env0-opa-plugin@1.0.0`) 4. `env` - An `object` containing a map of environment variables by key and value that will be available to the step. A reference to another environment variable value that's available to the deployment is achievable by prefixing the value with the `$` sign. 5. `input`(Relevant for plugins only) - An `object` of attributes that are required as inputs to the env zero plugin. Read more about it [here](/guides/integrations/plugins). 6. `executeAfterChild` (Relevant for [project level custom flows](/guides/admin-guide/custom-flows/project-level-custom-flow) only) - Defaults to `false`. When set to `true` the step will run after all the children's (sub projects and environments under that project) similar hooks finished to run. > [!NOTE] > > Support for multiline strings > > In case you'd like to include multiple bash commands under a single step, you can use the supported YAML multiline string syntax. Here's an example: > > ```yaml theme={null} > version: 2 > deploy: > steps: > terraformPlan: > after: > - name: An Example of Multiline string > run: | > echo foo > echo bar > echo baz > ``` ## Migrating from v1 Schema To migrate from the `version: 1` schema and keep the same deployments step structure in env zero UI, you'll need to include minor changes to your `env0.yaml` file. Here's an example of how to migrate such a file to `version: 2`: ### Before ```yaml theme={null} version: 1 deploy: steps: terraformPlan: after: - pip install jq - echo "Installed jq" - jq --help ``` ### After ```yaml theme={null} version: 2 deploy: steps: terraformPlan: after: - name: "Terraform Plan: After" run: | pip install jq echo "Installed jq" jq --help ``` # Monitoring dashboards Source: https://docs.envzero.com/guides/admin-guide/dashboards Monitor organization activity with summary and activity dashboards showing environment status, deployment counts, top deploying users, and trends. Dashboards are divided into 2 tabs: Summary and Activity. ## Summary ### Counts Shows total users, [teams](/guides/admin-guide/user-role-and-team-management/teams), [projects](/guides/admin-guide/projects), and [templates](/guides/admin-guide/templates). ![Summary dashboard counts showing total users, teams, projects, and templates](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/bee5863-counts.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=d9fdcbd70aa4ef7976f1d70f5cce2bc1) ### Environments Pie Chart All [environments](/guides/admin-guide/environments), sliced by status(Active, \[type] Failed, and Waiting for approval) ![Environments pie chart showing distribution by status: Active, Failed, and Waiting for approval](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/3445750-environmentspiechart.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=355ff3bc0b222468f9136a797ffe4459) ### Environments Table Contains all environments which can be filtered by several attributes such as name, project, status, etc... ![Environments table with columns for name, project, status, and other filterable attributes](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/d4c6028-screen_shot_2021-11-18_at_11.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=2c69ba463f88d5f1e61c6c035dc78d21) ## Activity Here you can choose a time range using the dropdown menu at the right corner, by last week, month, or quarter. ### Deployments Pie Chart All deployments, sliced by type (Deploy, Destroy, [PR Plan](/guides/admin-guide/environments/plan-on-pull-request)). Hovering on it, shows the number. ![Deployments pie chart sliced by type: Deploy, Destroy, and PR Plan](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/8a58c66-deploymentspiechart.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=13e8e493c9c22e33958191438b53bd11) ### Top Deploying Users All users, ordered by default by total number of deployments from highest to lowest (can be ordered by other criteria as well). ![Top deploying users table ordered by total number of deployments](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/guides/admin-guide/1f20b05-screen_shot_2021-11-18_at_14.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=5a7382e72a5e52998060e14b9073de12) ### Number of Deployments Per Day Contains a line chart of each deployment type. ![Line chart showing number of deployments per day broken down by deployment type](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/6d0ad32-numberofdeploymentsperday.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=87e10dc2c07a4bac311bd1d73ad7d6aa) ### Active Environments Bar Chart Shows the number of active environments per day. This data is refreshed every 24 hours. ![Bar chart showing number of active environments per day](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/guides/admin-guide/195b927-screen_shot_2021-11-18_at_14.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=3ff2eeb445f1a6b5a16a80ce0da560e1) ### Environments Table The same table from the [Summary](/guides/admin-guide/dashboards/#environments-table) tab, but here you can select a time range. > [!NOTE] > > **Calculations** > > The data presented in the dashboards is calculated during each page load or refresh. Except for the Active Environments bar chart, which is updated using a schedule task, once a day. > [!WARNING] > > Excluded Data > > Archived projects and environments are excluded from the aggregations. ## Weekly email digest env zero will email organization admins a weekly summary of env zero platform usage, detailing how your teams are using env zero.\ This will include details about your environments, most active users, and deployments per day. The env zero digest email aggregates data from the past week into four graphs: 1. Number of deployments 2. Deployments per day 3. Active environments per day 4. Top deploying users ![Weekly email digest showing four graphs: deployments, deployments per day, active environments, and top users](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/ee6be3a-weekly-email.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=84142675a905b5fc09a0f0dabc7e9d52) ## Next steps * [Review individual user actions in the audit logs](/guides/admin-guide/audit-logs) * [Set up cost monitoring](/guides/cost-monitoring/cost-monitoring) to track cloud spend alongside deployment activity # Environment discovery overview Source: https://docs.envzero.com/guides/admin-guide/environment-discovery Automatically discover, import, and manage infrastructure environments in env zero for file-based creation, PR provisioning, and bulk onboarding of IaC. Environment Discovery in env zero enables teams to identify, import, and manage infrastructure environments - whether dynamically created during development workflows or existing infrastructure deployed outside env zero. This feature is foundational to streamlining DevOps practices, increasing governance, and maximizing infrastructure visibility. ## Why Environment Discovery Matters Many teams manage a mix of ephemeral and long-lived environments across their cloud platforms. Without centralized management, these environments can lead to configuration drift, governance issues, and operational inefficiencies. env zero's discovery capabilities are designed to: * Provide **centralized visibility** into all environments. * Simplify the **onboarding** of infrastructure deployed outside env zero. * Support **automated workflows** for previewing and validating changes. * Enforce **policies and controls** across all discovered environments. ## Discovery Use Cases env zero supports three primary workflows for discovering and managing environments: ### 1. Discovery by File This feature enables teams to create and manage environments from templates using a YAML marker file (`env0-discovery.yaml`) placed at the root of their repositories. It provides a code-first approach that eliminates circular dependencies and supports multi-repo, decentralized environment management. * Creating environments directly from templates using code * Managing multiple environments from a single repository using one `env0-discovery.yaml` file * Seeing actual infrastructure changes in PR plans * Avoiding the circular dependency problem with the Terraform Provider Learn more: [Discovery by file](/guides/admin-guide/environment-discovery/discovery-by-file) ### 2. Creation per Pull Request This feature automatically provisions an environment for each Git pull request. It integrates with your CI/CD workflows, making it ideal for: * Previewing changes before merging to the main branch. * Enabling stakeholder reviews in an isolated environment. * Automatically destroying environments after merge to optimize resource usage. Learn more: [Creation per Pull Request](/guides/admin-guide/environment-discovery/automatic-environment-creation-from-pull-request) ### 3. Onboarding This process allows you to import externally deployed Infrastructure as Code (IaC) environments (such as Terraform or Terragrunt projects) into env zero. These environments were not originally deployed using env zero but are brought under its management for better governance and automation. Use cases include: * Onboarding teams with pre-existing infrastructure into env zero. * Managing and tracking environments that were deployed manually or via other tools. * Enforcing policies, visibility, and consistency across imported environments. Learn more: [Mass Import (Onboarding)](/guides/admin-guide/environment-discovery/onboarding-import-external-environments-into-env-zero) ## Next steps Pick the method that fits how your team manages infrastructure, or combine several. If you need help choosing, [contact support](/guides/community-and-resources/support-and-help/support). # Auto-create environments from pull requests Source: https://docs.envzero.com/guides/admin-guide/environment-discovery/automatic-environment-creation-from-pull-request Automatically create and destroy environments from pull requests using glob pattern directory mapping and per-project discovery settings in env zero. Manual environment creation and deployment can become tedious and error-prone at scale. env zero enables you to automatically create and destroy environments from pull requests. This uses a preconfigured directory structure to streamline your workflow, save time, and reduce errors. To enable this capability, follow the steps below: ### Get started In this example, we will create a `Terragrunt` configuration based on [Terragrunt Infrastructure Example](https://github.com/env0/terragrunt-infrastructure-example) repository. First things first, you will need to create a one time configuration of your discovery settings. This is a per Project configuration. Under `Project Settings` select `Environment Discovery` tab. To continue, click `Get Started`. ![Environment Discovery tab in Project Settings with a Get Started button to begin configuration](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environment-discovery/c5f4b7ffb0f9255c67f22ba290f3a1f40a03160ab84f4430ec05f408b2a3d8d3-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=5be1954db2e4e50e21c58b750cc6b0ac) ### Choose The Infrastructure As with setting up a [Template](/guides/admin-guide/templates), choose the type of infrastructure you are using, then click `Next`. ![Infrastructure type selection screen showing options like Terraform, Terragrunt, and others](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/environment-discovery/63c5faff53a352405c0d8d6710070ed5f92274c8d5d60fa58a0bdde73e2dc287-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=b5de6bc9bb866faa1aada1cdae2d0f7d) ### Configure Your Repository Next, choose the desired Git provider, and configure the repository you would like to discover from and click `Next` ![Repository configuration screen for environment discovery with Git provider and repository fields](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/environment-discovery/471ed7af0a1083d6e74ef19e4d955314a4b2a528eff86b4cb55ec1e5cc4773db-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=f916b0b95ebbec236747fc8f5a215e64) ### Configure the Environment Mapping The final step is crucial as it defines the structure of your project. In this section, you will specify the layout of your project, including which Environments will be created, how they will be named, and where they will be located within env zero ![Environment mapping configuration showing glob pattern, root path, and placement strategy options](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environment-discovery/97ecd06fce39e75c60b12605eb2ed07599baed14c96c1712d07fc925ccbb3742-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=ca6b6b4208a6f91bf923d7db4a37661c) Let's break it down step by step: #### Match Environments Glob You will need to define your project structure using a multi-glob pattern. Any match to this pattern will trigger the creation and planning of an environment in env zero. In this example, we aim to create an env zero Environment for any `terragrunt.hcl` file that is not located under the `_envcommon` folder ![Match Environments Glob field with a multi-glob pattern excluding the \_envcommon folder](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environment-discovery/7536e4f-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=794d03a227d7ea0a7d6c16045a3018bc) > [!NOTE] > > **[Glob pattern](https://en.wikipedia.org/wiki/Glob_\(programming\))** > > Glob patterns specify sets of filenames with wildcard characters. For example, `\*.tf` or `prod/\*\*` > > For example, you can configure pattern like `src/prod/**/*.tf`\ > In this case, we will create new env zero Environments only if the new `main.tf` is located under `src/prod/...` > > We also support extglob patterns with that you can write pattern which ignores files or use a list of folders.\ > Note that for extglob, when using OR/AND statements, make sure to wrap each option with parentheses, for example: > > * `!(prod/us-east-1/\*\*)+(dev/us-east-1/**|dev/us-west-2/main.tf)`\ > This means we will listen to any change in `dev/us-east-1` and `dev/us-west-2/main.tf`, and ignore changes under `prod/us-east-1`. (Recommend including exclusions first.) > * `+(Terraform/!(prod)**|Terragrunt/dev/**)`\ > Listen for any changes in `Terraform` or `Terragrunt/dev` but ignore any changes in `Terraform/prod` #### Root Path The root path configuration defines the starting point from which env zero will generate environments. For instance, if the glob pattern is set to `src/prod/storage/*_/_.tf`, and the discovered file is `src/prod/storage/environment0/main.tf`, with the root path configured as `src/prod`, env zero will exclude the root path from the full path of the discovered `main.tf` file. Therefore, it will be treated as `storage/environment0/main.tf` when determining where to place the environment. #### Environment Placement This section will let you choose the Environment placement strategy within your project. ![Environment placement strategy options showing sub-project matching choices](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/environment-discovery/31c796d-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=2e037777d91d0dc572b647d8f0bc68b0) Let's consider a env zero Project hierarchy of ```yaml theme={null} - environment-discovery - - prod - - non-prod ``` **Create Environments in this project** - Will not consider Sub-Projects when creating the environments. In our case, a PR to change `prod/us-east-1/prod/mysql` will create an Environment called `us-east-1/prod/mysql` **Create Environments in the closest matching Sub-Project path, matching the directory path** - Will consider the closest Sub-Project to match the path, for example a PR to change `prod/us-east-1/prod/mysql` will create an Environment called `us-east-1/prod/mysql` on `prod` Sub-Project Click `Done` and you should be greeted with the success screen if all went well. The discovery process will be started automatically but automatic Pull Request creation should be enabled in the settings section. ### Enabling Automatic Pull Request Creation ![Automatic Pull Request creation settings with workspace naming and continuous deployment options](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/environment-discovery/3be798b033f7d00daf5e341f06b8bfd2b62f014a39a90a10ff57f8f13b6bb84f-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=c08aef18afb2dbf3f3f90bb63f11f7a9) #### Workspace Naming Here we can choose to either use `default` as the workspace names or derive it from the Environment's name #### Deploy Discovered Environments on In the next section, you'll be able to set the [Continuous Deployment](/guides/admin-guide/environments/continuous-deployment) and [PR Plan](/guides/admin-guide/environments/plan-on-pull-request) settings which your Environments will be created with. ![Deploy Discovered Environments settings with options for template directory changes and file filter patterns](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environment-discovery/8f07d17-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=61c48d03a983a669583c24cccc9e4f8d) **Changes on Template Directory files** - The Environment will only plan / deploy on changes to the directory matched by the main glob pattern **Changes by file filter pattern** - The Environment will plan / deploy on changes matching the given multi glob pattern. > [!TIP] > > Custom Glob Variables > > We also support using custom string templates that are set during runtime - > > * `env0_template_dir_path` - The entire template path. > * `env0_template_dir_name` - The **name** of the directory of the template files. > * `env0_template_dir_ancestors` - Will be interpolated with each ancestor directory up the template path, and is meant to be used in an extended glob expression. It is most useful for picking up configuration files up the path, like in a Terragrunt style repository. *\*\* NOTE: this should NOT be used with a file extension\ > e.g: If the template directory is `non-prod/us-east-1/dev/postgres`, then it will be interpolated as \`non-prod/*|non-prod/us-east-1/*|non-prod/us-east-1/dev/*|non-prod/us-east-1/dev/postgres/\*\`. > > example usage:\ > `+((_envcommon/${env0_template_dir_name}/**)|(${env0_template_dir_path}/**)|${env0_template_dir_ancestors})` which means match everything under the path defined in the environment's template and match any changes under `_envcommon` matching the template dir name, and any files changes in the ancestors (or parent) folders. > [!WARNING] > > Heads Up > > In case the even that the environment creation glob and the environment CD / PR plan glob do not match, it is possible that the changes that trigger the Environment creation won't trigger the initial PR Plan (see section below for more info) In our example, we would like other changes to trigger a plan, and not only those under the Template Directory. ## Using Environment Discovery After configured, using environment discovery is easy as opening and merging a pull request. 1. Create a branch with desired changes and open a PR. ![a PR Plan has started on env0](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environment-discovery/a_pr_plan_has_started_on_env0.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=dbcb152a3e5a7dbbec1044c11ed1d2ad) a PR Plan has started on env0 2. Navigate to the relevant Project or Sub-Project in env zero or click the env zero bot comment (Remember: multiple environments can be created via a single PR) ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/environment-discovery/4171ddd-proj_desc_1_fix.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=17687e246abfba690e0097a3bdbb381e) 3. In the `Deployments` tab, you'll be able to see the initial PR Plan env zero ran on your code. ![A real world example of multiple iteration on a failed PR](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environment-discovery/a_real_world_example_of_multiple_iteration_on_a_failed_pr.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=0be356f3dd0593477f78d906c7581fe1) A real world example of multiple iteration on a failed PR > [!WARNING] > > Closing a PR > > Closing a PR will archive the `Never Deployed` Environment. Note, that for Bitbucket Cloud and Bitbucket Server automatic archival is not supported, and you will have to do so manually. 4. After the plan has been reviewed and merged, env zero will trigger a deployment for that Environment. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environment-discovery/d2d8971-proj_desc_3_fix.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=f043c73e3231a2f3d275c83f1e8e745b) ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environment-discovery/d2d8971-proj_desc_3_fix.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=f043c73e3231a2f3d275c83f1e8e745b) ## Next steps For the other ways to bring environments into env zero, see the [environment discovery overview](/guides/admin-guide/environment-discovery). # Discovery by file Source: https://docs.envzero.com/guides/admin-guide/environment-discovery/discovery-by-file Use env0-discovery.yml marker files to create environments from existing templates, avoiding circular dependencies with the env zero Terraform Provider. Discovery by File enables teams to create and manage environments from templates using YAML marker files in their repositories. This code-first approach eliminates the circular dependency problem that occurs when using the env zero Terraform Provider. Place a single `env0-discovery.yml` file at the root of your repository. env zero automatically discovers this file and creates environments based on its contents, referencing existing templates rather than requiring infrastructure code in the same repository. ## How It Works Discovery by File uses a marker file named `env0-discovery.yml` that you place at the root of your repository. When you configure discovery rules at the project level, env zero scans your GitHub organization for this file and automatically creates environments based on its contents. Each repository can have only one `env0-discovery.yml` file, located at the root path. This file can define one or more environments, each referencing an existing env zero template. The environments are created in the project specified by your discovery rule configuration, subject to proper authorization checks. ## Prerequisites Before setting up Discovery by File, ensure you have: * A GitHub VCS connection of type Deployment connected to your env zero organization. See [managing VCS connections](/guides/admin-guide/manage-vcs) for details * At least one template created in your env zero project * Project-level permissions to configure discovery rules * Appropriate repository access permissions ## Setting Up Discovery Rules Discovery rules are configured at the project level and define which repositories env zero should scan for the `env0-discovery.yml` file. ### Access Discovery Configuration **1. Navigate to project settings** Open your project and navigate to the project settings page. **2. Open Environment Discovery** Select the **Environment Discovery** tab, then click **File Discovery** to begin configuration. ![Environment Discovery options showing File Discovery button](https://mintcdn.com/envzero-b61043c8/EpBEl4-C9gUMduIF/images/guides/admin-guide/environment-discovery/discovery-options.png?fit=max\&auto=format\&n=EpBEl4-C9gUMduIF\&q=85\&s=2b2b28cf8c08f1f2db244301267bb876) **3. Configure repository scope** Repository scope works by regex. Enter a regex pattern to specify which repositories should accept discovery file changes from. ![Repository scope configuration using regex pattern](https://mintcdn.com/envzero-b61043c8/EpBEl4-C9gUMduIF/images/guides/admin-guide/environment-discovery/discovery-by-file-regex.png?fit=max\&auto=format\&n=EpBEl4-C9gUMduIF\&q=85\&s=44d7ff14b7c55c73db16645e10db40ed) > [!WARNING] > > **Authorization Requirements** > > Users can only create environments in projects where their repository is allowed for discovery. The discovery regex is applied for sub-projects as well. For example, if project "us-east-1" is a sub-project under "prod" and "prod" is configured with a discovery rule allowing the repository, you can create environments in "us-east-1" by specifying: > > ```yaml theme={null} > environments: > testEnv: > name: "test" > projectName: "us-east-1" # "us-east-1" is under "prod" project > templateName: "ec2" > ``` ## Creating env0-discovery.yml Files The `env0-discovery.yml` file is a YAML configuration file that defines one or more environments. Each repository must have exactly one `env0-discovery.yml` file, and it must be placed at the root path of the repository. env zero relies on a file named **env0-discovery.yml** to describe the environments and their configurations. Each environment definition in the file should contain: 1. ***name*** (required): The name of the environment to create. Will be displayed in the env zero UI 2. ***templateId*** (required, conflicts with ***templateName***): The ID of an existing env zero [template](/guides/admin-guide/templates) to use (e.g., `123456-asdasd-1556`) 3. ***templateName*** (required, conflicts with ***templateId***): The name of an existing env zero [template](/guides/admin-guide/templates) to use (e.g., `EC2-Instance`) > [!WARNING] > > **Template Reference** > > You must specify exactly one of `templateId` or `templateName`, not both. While you can reference templates by name, using `templateId` is more reliable as template names may not be unique across your organization. > [!NOTE] > > **Supported Template Types** > > Discovery by File currently supports Terraform and OpenTofu templates only. Other IaC frameworks are not supported at this time. 4. ***projectId*** (required, conflicts with ***projectName***): The ID of the target project where the environment will be created (subject to authorization) 5. ***projectName*** (required, conflicts with ***projectId***): The name of the target project where the environment will be created (subject to authorization). For nested projects, use `|` as a separator (for example: `Team 1|Compute|dev` or `prod|us-east-1`) > [!WARNING] > > **Project Reference** > > You must specify exactly one of `projectId` or `projectName`, not both. The project must be accessible and allowed by the discovery rule configuration. 6. ***workspaceName*** (optional): The Terraform workspace name to use for this environment 7. ***revision*** (optional): A specific git branch, tag, or commit SHA for the template deployment 8. ***variableFiles*** (optional): Array of variable file objects, each with a `path` property pointing to a `.tfvars` file. The path must be relative to the root folder of the repository. Files are processed in order, with later files potentially overriding values from earlier files 9. ***requiresApproval*** (optional): Set to `true` to require manual approval before deployments for this environment 10. ***isRemoteBackend*** (optional): Set to `true` to enable [Remote backend](/guides/admin-guide/remote-backend) for this environment 11. ***continuousDeployment*** (optional): Set to `true` to enable automatic deployments when changes are pushed to the configured branch 12. ***autoDeployOnPathChangesOnly*** (optional): Set to `true` to trigger deployments only when files in the template's configured path change 13. ***autoDeployByCustomGlob*** (optional): A custom glob pattern to specify which file changes should trigger automatic deployments (e.g., `**/*.tf`) 14. ***pullRequestPlanDeployments*** (optional): Set to `true` to automatically run Terraform plans on pull requests 15. ***vcsPrCommentsEnabled*** (optional): Set to `true` to enable env zero to post plan results as comments on pull requests 16. ***vcsCommandsAlias*** (optional): A custom alias for VCS commands used in pull request comments 17. ***driftDetectionCron*** (optional): A cron expression to schedule automatic drift detection runs (e.g., `0 4 * * *` for daily at 4 AM UTC) > [!NOTE] > > **Template Access** > > Templates must be assigned to the target project in env zero before they can be referenced in discovery files. Even if you specify a template in your `env0-discovery.yml` file, it will only work if that template is already assigned to the target project. ## Example Configuration ### Basic Structure A basic `env0-discovery.yml` file contains environment definitions as an object where each key is an environment identifier: ```yaml theme={null} environments: production-database: projectName: production name: production-database templateName: EC2-Instance variableFiles: - path: variables/production.tfvars ``` ### Multiple Environments with Advanced Configuration You can define multiple environments in a single `env0-discovery.yml` file with various configuration options: ```yaml theme={null} environments: production-database: projectName: production name: production-database templateName: EC2-Instance workspaceName: prod-db revision: main requiresApproval: true isRemoteBackend: true continuousDeployment: true autoDeployOnPathChangesOnly: true pullRequestPlanDeployments: true vcsPrCommentsEnabled: true driftDetectionCron: "0 2 * * *" variableFiles: - path: variables/production.tfvars - path: variables/common.tfvars staging-backend: projectName: staging name: staging-backend templateId: 123456-asdasd-1556 workspaceName: staging-be revision: develop continuousDeployment: true autoDeployByCustomGlob: "backend/**/*.tf" pullRequestPlanDeployments: true vcsPrCommentsEnabled: true variableFiles: - path: variables/staging.tfvars dev-environment: projectName: development name: dev-environment templateName: Simple-App requiresApproval: false continuousDeployment: true variableFiles: - path: variables/dev.tfvars ``` > [!NOTE] > > **Multi-Organization Support** > > If the env zero GitHub app is installed across multiple organizations, you can define environments that span these organizations within a single `env0-discovery.yml` file. Each environment will be processed by the env zero organization that has access to both the repository and the specified project. ### Using YAML Anchors for Shared Configuration You can use YAML anchors and aliases to avoid repeating common configuration across multiple environments: ```yaml theme={null} # env0-discovery.yml commonConfig: &defaultConfig requiresApproval: true isRemoteBackend: true continuousDeployment: true autoDeployOnPathChangesOnly: true pullRequestPlanDeployments: true vcsPrCommentsEnabled: true driftDetectionCron: "0 2 * * *" environments: service1: name: "service1" projectName: "app1|dev" templateName: "my-template" <<: *defaultConfig service2: name: "service2" projectName: "app1|qa" templateName: "my-template" <<: *defaultConfig ``` In this example, `&defaultConfig` creates an anchor for the common configuration, and `<<: *defaultConfig` merges those settings into each environment definition. This approach helps maintain consistency and reduces duplication when managing multiple environments with similar settings. ## Importing Existing Environments You can import already deployed environments into your discovery file to bring them under Discovery by File management. This allows you to transition existing environments to code-based configuration without redeploying infrastructure. > [!WARNING] > > **Prerequisites for Import** > > The environment you want to import must already be deployed and active in env zero. You cannot import environments that are not yet deployed or have been archived. ### How to Import an Environment To import an existing environment, add its configuration to your `env0-discovery.yml` file with the exact details that match the deployed environment: ```yaml theme={null} environments: existing-production: name: production-database # Must match the exact name in env zero projectName: production # Must match the current project templateName: EC2-Instance # Must match the template used workspaceName: prod-db # Must match the workspace if one is configured ``` Navigate to the existing environment in env zero and note its exact configuration including environment name, project location, template name or ID, workspace name (if applicable), and current revision/branch. Add the environment configuration to your `env0-discovery.yml` file using these exact details. When you create a pull request with the updated `env0-discovery.yml` file, the preview will show the environment under the **Imported** section, indicating it will be brought under discovery management. ![Pull request preview showing imported environments](https://mintcdn.com/envzero-b61043c8/EpBEl4-C9gUMduIF/images/guides/admin-guide/environment-discovery/pr-preview-environments-summary.png?fit=max\&auto=format\&n=EpBEl4-C9gUMduIF\&q=85\&s=05c307d8850459efa09346c8fe2f1fdc) After merging the pull request, the environment is now managed through the discovery file. Future configuration changes should be made by updating the `env0-discovery.yml` file rather than through the env zero UI. ### Import Configuration Requirements When importing an environment, the discovery file configuration must match the existing environment: * **name**: Must exactly match the environment name in env zero * **projectName** or **projectId**: Must match the project where the environment currently exists * **templateName** or **templateId**: Must match the template currently used by the environment * **workspaceName**: Must match if the environment uses a Terraform workspace > [!TIP] > > Use `templateId` and `projectId` rather than names for more reliable imports, > as IDs are guaranteed to be unique while names may change. ### After Import Once an environment is imported, it becomes fully managed by the discovery file: * Configuration changes should be made by updating the `env0-discovery.yml` file * The environment will appear in pull request previews when changes affect it * Removing the environment from the discovery file will trigger environment deletion (subject to your project's removal strategy) > [!NOTE] > > Importing existing environments is useful when transitioning from manual > environment management to a code-first approach with Discovery by File. ## Using Variable Files Variables must be defined in `.tfvars` files and referenced using the `variableFiles` field. This approach supports all variable types including primitives, maps, lists, and objects using full HCL syntax. ```yaml theme={null} environments: production-database: name: production-database templateName: EC2-Instance variableFiles: - path: variables/production.tfvars - path: variables/common.tfvars ``` Each entry in `variableFiles` is an object with a `path` property. You can reference multiple variable files, similar to how Terraform and OpenTofu support multiple `-var-file` arguments. Files are processed in the order listed, with later files potentially overriding values from earlier files. ## Pull Request Preview When you create or modify an `env0-discovery.yml` file in a pull request, env zero automatically runs a plan to preview the changes. The plan displays the infrastructure resources that will be created, modified, or destroyed based on your template, providing full visibility into the actual infrastructure impact. ![Pull request preview showing summary of environments to be added, modified, or removed](https://mintcdn.com/envzero-b61043c8/EpBEl4-C9gUMduIF/images/guides/admin-guide/environment-discovery/pr-preview-environments-summary.png?fit=max\&auto=format\&n=EpBEl4-C9gUMduIF\&q=85\&s=05c307d8850459efa09346c8fe2f1fdc) The PR comment shows a summary of affected environments organized into sections: * **Added**: New environments that will be created * **Modified**: Existing environments with configuration changes * **Removed**: Environments that will be deleted * **Imported**: Environments that already exist and are being imported into the discovery file * **Errored**: Environments with configuration errors (e.g., invalid template references or project names) Click any environment name in the summary to view its detailed plan output. > [!NOTE] > > PR plans provide full visibility into infrastructure changes before merging, > helping you catch issues early in the review process. ### Plan Triggers Plans are automatically triggered when: * A new `env0-discovery.yml` file is added * An existing `env0-discovery.yml` file is modified * Template references are changed * Variable values are updated * Variable file references are modified ## Managing Variables Variables are defined in `.tfvars` files referenced by the `variableFiles` field in your `env0-discovery.yml` file. After an environment is created through Discovery by File, you can add additional variables through the env zero UI. This is particularly useful for secret values that shouldn't be stored in code repositories. ### Adding Variables After Creation 1. Navigate to the discovered environment in env zero 2. Go to the **Variables** tab 3. Add new variables as needed 4. Variables added via UI are merged with variables from `.tfvars` files referenced in `env0-discovery.yml` > [!WARNING] > > **Variable Precedence** > > Variables defined in `.tfvars` files take precedence over variables added through the UI. If you update a variable in the UI, that value will be overridden by the value from the variable files on the next deployment. ## Related Learn more: [Environment discovery overview](/guides/admin-guide/environment-discovery) Learn more: [Automatic environment creation from pull requests](/guides/admin-guide/environment-discovery/automatic-environment-creation-from-pull-request) Learn more: [Importing external environments](/guides/admin-guide/environment-discovery/onboarding-import-external-environments-into-env-zero) # Import external environments into env zero Source: https://docs.envzero.com/guides/admin-guide/environment-discovery/onboarding-import-external-environments-into-env-zero Import and bulk-migrate Terraform or Terragrunt environments into env zero using environment discovery, with pre-filled variable keys and batch import. If you're advanced in your IaC journey and have decided to adopt env zero, you likely have existing environments that you want to import and manage within the platform. The [Environment Discovery](/guides/admin-guide/environment-discovery) feature simplifies this process by scanning your external environments and offering the ability to import them directly into env zero. Bulk imports allow you to select and configure multiple environments simultaneously, reducing manual work and lowering the chances of human error. This process helps minimize the time required to migrate your environments into env zero. ## Discover Activate the Environment Discovery feature within your project and configure it to detect your existing environments. ![Environment Discovery configuration screen showing project settings and discovery setup options](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environment-discovery/f5d8a3b9ede0790fb4d42d8fcae363621dd73a151bbb688aa4d44067b0e42f5d-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=2d2cc1c53987aad098b34983f6338545) ![Environment discovery settings panel with glob pattern and placement configuration fields](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environment-discovery/eda24ef3bc7eb0e0c0ed686e38c081f7e0b17eeb1ec9fc01dccc2ecc10ab3549-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=a7eccca4007c8fb3fecd18a2f044fb13) Once configured, env zero will display all detected environments in the Discovered Environments table. Each discovered environment will include the following details: * **Path:** The environment’s location within your Git repository. * **Target Project:** The project where the environment will be placed (as defined by your Environment Placement configuration). * **Target Environment:** The generated name for the new environment, based on your Environment Placement configuration. ![Discovered Environments table listing path, target project, and target environment name for each found environment](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/environment-discovery/36c75ee4f60eda1031d0c0ff5480a40314221f5130cbf3ee5f60fc46b899f6e1-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=2a1d59f673cbe2aa0ccdf8cad9cfe27a) ## Initiate Import Batch Once env zero has discovered your environments, you can initiate the import by selecting the desired environments and clicking the 'Import' button. ![Import button and environment selection list for initiating a bulk import batch](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/09/8e22b7c8b6ed8441e2a1ee4ee318f28c5e7b69e44591d5dd5fa356e126024a6e-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=1d2e65a01deecaeeca909d7b4b45aa08) Next, you'll need to configure each environment, including shared settings that can be defined at the Project level. The following configurations must be provided: * **Workspace Name (required)** Enter the workspace name for each selected environment to ensure that env zero references the same environment and state, rather than creating a new one. * **Variables:** Define the necessary [Terraform or environment variables](/guides/admin-guide/variables). These can be set at either the Environment or Project level. * **Deployment Credentials (recommended but not required):** Specify the credentials env zero will use to deploy your environment and connect to your [cloud account](/guides/getting-started/connect-your-cloud-account) successfully. ![Import batch configuration showing workspace name, variables, and deployment credentials fields](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/09/c221ac4b7a774b89e34a4d9da8be6e708eecade991bae927ef598fa299a5c74b-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=97b96306d4c5aea4ea5582ca369c9b93) > [!NOTE] > > **Pre-filled Terraform Variables** > > During the environment discovery process, env zero scanned your Git repository and reviewed the Terraform environments and variables in use. > > env zero will automatically pre-fill your Terraform variable keys with those defined in the environment. If a `default` value was specified for a variable, env zero will pre-fill the corresponding value as well. Once you’ve completed the configuration, click the ‘Import’ button in the bottom-right corner to initiate the batch import process. ![Import button in the bottom-right corner to submit the configured batch import](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/09/54b3981c13b40eb3872cb3be1ed0a3240308c6a3ea86dc92ccf3ff5ab82edc8d-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=706b9d0d14b642b1e6cae6b1fa4daf8e) > [!NOTE] > > **What is considered a Successful Import?** > > An import is considered successful and its status will update to "Imported" when the following conditions are met: > > * The deployment completes successfully, with no errors during the process > * The Terraform plan shows **0 changes**, meaning env zero deployed the environment in the same workspace without attempting to create new resources. It successfully uses the existing resources > > If these conditions are not met, the status will change to "Error." ## Rerun Imports Mistakes can happen - whether it's a missed variable, incorrect credentials, or other human errors. These issues can cause an import to fail. To address this, env zero provides a Rerun option. You can select the environments that encountered errors, adjust their configurations as needed, and run the import process again. ![Rerun import interface showing failed environments with options to adjust configuration and retry](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environment-discovery/fcb54a513a8baddbfb4b38a12a083df22ec062f16822d3eba7c772594bbc584a-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=ae273aa38cb39658510bb828a02ad309) # Environment overview Source: https://docs.envzero.com/guides/admin-guide/environments Manage IaC deployment environments in env zero - create, destroy, mark as inactive, and redeploy across Terraform, Terragrunt, CloudFormation, Pulumi, and Helm. ## What is an environment? An environment represents a deployment managed by env zero. Your users manage environments in [Projects](/guides/admin-guide/projects). They can create, destroy, and redeploy environments. The user who creates an environment is the owner. Administrators manage access control and budgets with [policies](/guides/policies-governance/policies) defined at the Project and Organization levels. Here's how env zero environments map to terms from common IaC tools: * **Terraform:** equivalent to a Terraform workspace or module (e.g., a `production-vpc` workspace) * **Terragrunt:** matches a specific Terragrunt configuration directory managing Terraform modules * **CloudFormation:** corresponds to a CloudFormation stack * **Pulumi:** maps to a Pulumi stack * **Kubernetes:** relates to a Kubernetes namespace or a set of YAML files * **Helm:** aligns with a Helm release ## View environment details To view your environments, choose a Project and select the **Environments** tab. The list shows all environments in the project that you have permission to see. For each environment, you can see the template it came from, the revision (the Git branch with the IaC code), the owner, the status, the remaining time-to-live, and the number of cloud resources currently consumed. Click an environment to open its details page, where you can run operations such as **Destroy** or **Redeploy**, view deployment logs, Terraform outputs, [variables](/guides/admin-guide/variables), and the deployment history. ## Environment status An environment can be in one of the following states: * *Active* - successfully deployed and running * *Inactive* - successfully destroyed * *Deploy in progress* - currently being deployed * *Undeploy in progress* - currently being destroyed * *Failed* - errors encountered during deployment or undeployment * *Waiting for approval* - a Planner initiated a change; a Deployer must approve before it executes An environment you [mark as inactive](#mark-an-environment-as-inactive) keeps the status it had. It moves to the **Marked as Inactive** tab, and its cloud resources keep running. ## Environment resources When an environment is Active, you can view all resources it manages by clicking into the environment. Resources are grouped by provider and type, for example, all AWS S3 buckets appear together. Use the search box to filter. ![Resources list with search box](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/resources_list_with_search_box.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=e1426f216e80648007a85ba300f455ae) Example of the resources list ## Time to live (TTL) TTL is the amount of time before env zero automatically destroys the environment. You set TTL when you create or redeploy. Predefined values are: 12 hours, 1 day, 3 days, 1 week, 1 month, and infinite. You can also set a specific end-of-life date. Infinite TTL means the environment is never automatically destroyed. This is appropriate for stable environments like staging or production, but not recommended for development environments. Administrators can control default and maximum TTL values using [TTL policies](/guides/policies-governance/policy-ttl). Non-admin users are bound by the policy for the current project. ## Terragrunt working directory The working directory of your Terragrunt deployment. This lets you define one template per repo or folder and create environments based on your Terragrunt folder structure. ## Create an environment You can create environments two ways: **Template-based:** Use pre-configured [templates](/guides/admin-guide/templates) for standardized, repeatable deployments with built-in RBAC and governance controls. Recommended for teams that need consistency. **Direct VCS integration:** Connect directly to your Git repository for quick deployments without template overhead. Useful for prototyping. Both approaches support all IaC frameworks: Terraform, OpenTofu, Pulumi, CloudFormation, Kubernetes, and Helm. For setup instructions, see [Setting up a new environment](/guides/admin-guide/environments/setting-up-a-new-environment). After the environment is created, the Environment Details page opens and deployment progress appears in the Deployment Logs section. env zero runs `terraform plan` and `terraform apply` and stores the outputs and state. If the deployment is successful, the status is set to Active and the owner receives an email notification. If it fails, the status is set to Failed and the owner receives an email with details. ## Destroy an environment An environment with a TTL other than infinite is automatically destroyed when its time limit is reached. To manually destroy an environment, open the Environment Details page for an *Active* environment and click **Destroy Environment** in the top right. If a deploy or destroy is already in progress, your destroy request is queued and starts automatically when the current operation completes. You can cancel a queued destroy from the **Deployments** tab. When the undeploy completes successfully, the status is set to Inactive and the owner is notified by email. The environment also leaves the project's active environment list and appears in the **Destroyed** tab. If the undeploy fails, the status is set to Failed and the environment stays in the active list. When destroying, the "Checkout updated code" option is enabled by default, meaning env zero uses the latest code from your repository. Disable it to use the code from the last deploy. Destroying deletes real infrastructure. If you only want env zero to stop tracking an environment and leave its resources alone, [mark it as inactive](#mark-an-environment-as-inactive) instead. **Destroy Environment** is disabled for an environment that has never deployed, since there is nothing to undeploy. Mark it as inactive to clear it from the active list. ## Mark an environment as inactive Marking an environment as inactive, also called archiving, tells env zero to stop tracking it. This is a metadata change only. No deployment runs, and none of the environment's cloud resources are touched. Open the Environment page, click the three-dot icon, and select **Mark as Inactive**. To do it for several environments at once, use [bulk operations](/guides/admin-guide/environments/bulk-operations). From the terminal, use [`env0 environment archive`](/guides/community-and-resources/support-and-help/env-zero-cli#step-5-inspect-destroy-and-archive). ![Environment Details three-dot menu open, showing the Mark as Inactive option](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/ca50f5e-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=d2dec243fb7e1d45c500fc260c136072) When you mark an environment as inactive: * Its resources keep running in your cloud account and keep costing money. env zero no longer manages them or reports on them. * Ongoing and scheduled deployments are removed. * It leaves the project's active environment list and appears in the **Marked as Inactive** tab. To bring it back, [redeploy it](#redeploy-an-inactive-environment). Once an environment is inactive, whether you marked it inactive or destroyed it, its workspace name stops being reserved. A new environment can be created with that name, where the old one would have been rejected as a duplicate. > [!WARNING] > > The inactive environment keeps its state. If you later create a [remote backend](/guides/admin-guide/remote-backend) environment with the same workspace name, that new environment inherits the state of the inactive one. ### Destroy compared with mark as inactive Both actions end an environment's active life, which is why they are easy to confuse. Only Destroy removes infrastructure. The project environments page keeps them apart: a destroyed environment appears under **Destroyed**, one you marked inactive under **Marked as Inactive**. | | Destroy | Mark as inactive | | :- | :- | :- | | Runs a deployment | Yes, on the agent | No | | Cloud resources | Deleted | Untouched, still running and still billable | | Terraform state | Emptied as the resources are removed | Kept as is | | Duration | As long as the deployment takes | Immediate | | Can fail | Yes, the environment goes to Failed | No | | Resulting status | Inactive | Unchanged, the environment keeps the status it had | | Where it appears | **Destroyed** tab | **Marked as Inactive** tab | ### Who can mark an environment as inactive This action is controlled by the **Archive Environment** permission. It is part of the Project Admin and Environment Admin [default roles](/guides/admin-guide/user-role-and-team-management/default-roles), and it can be granted to a [custom role](/guides/admin-guide/user-role-and-team-management/custom-roles). ## Redeploy an environment To redeploy, navigate to the Environment Details page and click **Redeploy** in the top right. If a deploy or destroy is in progress, the new deployment is queued and starts after the current operation completes. You can view and cancel queued deployments from the **Deployments** tab. ### Redeploy an inactive environment Redeploying an inactive environment runs `terraform apply` and brings the environment back to Active. If the original TTL date has already passed, set a new one before redeploying. You can also set new variable values. If the environment was destroyed, the apply recreates its resources. If it was only marked as inactive, its resources were never removed, so the apply reconciles them against the current code and usually changes little or nothing. ### Redeploy an active environment Redeploying an active environment applies all code changes from the template. Setting a new TTL is optional. Variable values can also be updated. ## Abort a deployment To stop an ongoing deploy or destroy, open the Environment Details page and click the red **Abort** button. ![Environment interface showing alt text configuration options](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/alt_text.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=69221371af2effe409cd6f62b240a13e) > [!WARNING] > > Aborting is a destructive action > > When aborting, env zero attempts a graceful shutdown with a 1-minute timeout. After the timeout, the process is forcefully terminated. Aborting may result in lost state or orphaned resources. ## Cancel queued deployments When a deploy or destroy is in progress, additional requests enter a Queued state. To cancel a queued action before it starts, click **Cancel** in the Deployments tab. ![Deployments tab showing queued deployments with Cancel button on the right](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/4d6a1cb-screen_shot_2020-08-25_at_12.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=91df1a836037986744a489fe301a3be0) To cancel all queued deployments at once, use **Cancel All Queued Deployments** from the environment's details menu. ![Environment details menu showing Cancel All Queued Deployments button](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/c0def2c-monosnap_env0_-_null_template-33416_2022-06-19_14-42-14.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=c8aef02f60e4e1bd173e75768d39c6f6) ## Import an existing environment Prerequisites: * [Connect your VCS](/guides/getting-started/connect-your-vcs) and your [cloud account](/guides/getting-started/connect-your-cloud-account) * [Create a template](/guides/admin-guide/templates) pointing to your Terraform code * [Add variables](/guides/admin-guide/variables) matching the ones used in the original deployment > [!NOTE] > > You can import environments that were deployed via Terraform and use a remote state backend. 1. Go to your Default Organization Project and open the Project Templates page. 2. Find the template you created and click **Run Now**. 3. Under **Workspace Name**, enter the existing Terraform workspace name. 4. Uncheck **Approve plan automatically** to prevent accidental changes. 5. Click **Run**. Terraform reads the existing state from your remote backend and generates a plan. If the code and variables match the original deployment, no changes are planned. Click **Approve** to take ownership, or **Cancel** to exit. ## Approval flow For every operation (create, destroy, or redeploy), env zero runs a Terraform plan first. Executing the plan requires approval from a user with [Deployer privileges](/guides/admin-guide/user-role-and-team-management/user-management/#project-roles). Deployers and Admins can enable **Approve plan automatically** to skip the manual approval step. You can set this default in the environment's **Settings** tab under **General Settings**: ![Environment Settings tab General Settings card showing approve plan automatically checkbox](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/guides/admin-guide/0085404-screen_shot_2022-05-01_at_16.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=dbaea2a690701d2fe2af40e820b9876a) Planners cannot automatically approve their own plans. When approval is required, the environment status is set to *Waiting for approval*. A Deployer can then click **Deploy** to execute the plan or **Cancel** to discard it. ## Download the plan as JSON For Terraform, OpenTofu, and Terragrunt deployments, you can download the plan in the [JSON plan format](https://opentofu.org/docs/internals/json-format/#plan-representation) to use with policy tools, diffing, or your own tooling. The file includes every resource in the plan, including resources with no changes. > [!WARNING] > > Downloading the plan JSON requires the **View Environment** permission. **1. Open the deployment** On the environment's **Deployments** tab, open the deployment. **2. Open the plan step** Expand the **Terraform Plan** or **OpenTofu Plan** step. **3. Download the file** In the step log toolbar, click **More download options** (**...**), then **Plan JSON (.json)**. The file is named `-env0_tf_plan.json`. ### Download with the API ```bash theme={null} curl -L -u ":" -o plan.json \ "https://api.env0.com/environments/deployments//plan-json" ``` The endpoint redirects to a download link that is valid for 5 minutes. Add `?redirect=false` to get the link as `{"url": "..."}` instead. See [Download Deployment Plan JSON](/api-reference/environments/download-deployment-plan-json). ### What is masked Values Terraform marks as sensitive are replaced with ``. env zero also redacts the values of sensitive env zero variables, Git tokens in repository URLs, and AWS credentials. > [!WARNING] > > Secrets hard-coded in your Terraform code are not masked. They appear in the plan's `configuration` section. ### Availability * Deploy, destroy, and **Dry Run** deployments that finish successfully, or that stop for approval after a successful plan. A deployment that fails after the plan, for example in the apply step, has no plan JSON unless it stopped for approval first. Drift detection, plan on pull request, remote plan, [saved plan](/guides/admin-guide/remote-backend/remote-plan#save-a-plan-and-apply-it-later) apply, and Terragrunt run-all deployments have no plan JSON. * env zero keeps plan JSON files for 30 days. * Self-hosted agents need v5.3.0 or later. When no file exists, the **More download options** button does not appear, and the API returns `404` with `Plan JSON is not available for this deployment`. On self-hosted agents older than v5.0.0, the button appears with **Plan JSON (.json)** disabled and a tooltip to upgrade the agent. The [approval policy](/guides/policies-governance/approval-policies#plan-format-by-iac-type) input uses the same plan format. ## Deployment comments You can add a comment when creating, redeploying, destroying, or running tasks on an environment. Comments provide context for why an action was taken and appear in the deployment history. To add a comment, write text in the **Comment** field: ![Deployment dialog with Comment input field for adding context to a deployment action](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/8367c67-screenshot_2023-01-22_at_14.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=f1f3bc19d239751e302a2a7dde400564) The comment appears on the Deployment page. ![Deployment page showing a comment displayed alongside the deployment details](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/4311197-screenshot_2023-01-22_at_15.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=771b8fe3cdaa552a011e8992c910c8bc) > [!NOTE] > > Comments support Markdown. ## Finding the environment ID You may need the environment ID when using the [Terraform provider](https://registry.terraform.io/providers/env0/env0/latest) or making [API calls](/api-reference/credentials/create-api-key). Find it in the details card at the top of the environment page. ![Environment details card showing the environment ID field](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/5b112f7-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=07815c37a54f6fedfaddddfcac13bbe8) ## Redeploy with a different template To change the template for an environment, use **Redeploy with Different Template** from the environment's context menu. ![Environment context menu showing Redeploy with Different Template option](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/88ae4ed-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=c35e6d671b659ffaacdcb81d4905458d) On the Redeploy page, use the drop-down to select the new template. ![Redeploy page showing template drop-down menu to change the environment template](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/guides/admin-guide/01f9d5f-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=d9eac32927f508a5580c280915456148) ## Best practices **Development environments:** Use short TTLs. Enable [continuous deployment](/guides/admin-guide/environments/continuous-deployment) for dev branches. Require manual approval only where necessary. **Production environments:** Use infinite TTL. Require manual approval for all changes. Use [environment locking](/guides/admin-guide/environments/environment-locking) during maintenance windows. # Environment access Source: https://docs.envzero.com/guides/admin-guide/environments/access Control RBAC permissions at the environment level in env zero to grant users or teams access to specific environments using custom roles. In every organization, there is a need to establish custom permission assignments tailored to their specific needs. For example, when collaborating with outsourced teams, it becomes crucial to grant permissions exclusively to the areas they are directly involved in, without providing unnecessary access. To address this requirement, env zero lets you control RBAC Permissions all the way to the granularity of a specific environment. With this feature, administrators can precisely define permissions at the environment level, ensuring that users are granted access only to the environments directly relevant to their tasks. This capability offers organizations the flexibility to maintain security, optimize collaboration, and tailor permissions according to specific teams or projects > [!WARNING] > > Role to control environment access > > In order to configure Environment Access, the assigning user needs to have the `ASSIGN ROLE ON ENVIRONMENT` permission. > > Project and Organization admins have that permission by default. > > [Read more here](/guides/admin-guide/user-role-and-team-management/user-management) ## How to assign Access to an Environment ### Preconditions There are 2 things you need before assigning access to an environment: 1. The [Environment](/guides/admin-guide/environments/setting-up-a-new-environment) should exist beforehand 2. You need to have a [Custom Role](/guides/admin-guide/user-role-and-team-management/custom-roles) with the specific permissions you wish to assign > [!NOTE] > > Roles > > At the moment - only custom roles are supported for environment access ### Assigning Access 1. Navigate to an existing environment, and click on the ACCESS tab ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/5bd01cd-project_envs_access_1_fix.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=262c31702b38cecd05cc81880775c7f3) 2. While in that tab, you can assign access to either individual Users or entire Teams 3. On the two tables, you can see the entire collection of users and teams in your organization (respectively) 4. To assign one a role on the current environment, make sure the checkbox on the left-hand side is ticked, and select the role you wish to assign ![Access tab showing users table with checkbox selected and role dropdown to assign a role](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/010be27-screenshot_2023-06-08_at_15.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=a9bc85564d5ddae2b8368aa18119adcd) 5. Finally, hit "save" ![Access tab with Save button highlighted after assigning roles to users and teams](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/57e2c71-screenshot_2023-06-08_at_15.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=7ea6ab5c00feb0a46e9a44ceb8607324) And you're good to go! > [!WARNING] > > Project View > > When a user is given permissions to a specific environment - they can see all ancestor projects leading up to it. This is purely for traversal, and they won't have any other permissions for those projects, so keep in mind this is not the same as them having `VIEW PROJECT` permissions for the project tree ## Next steps * [Organize users into teams](/guides/admin-guide/user-role-and-team-management/teams) to grant environment access to a group in one step * [Review how RBAC works](/guides/admin-guide/user-role-and-team-management/rbac) across organization, project, and environment levels # Running ad hoc tasks Source: https://docs.envzero.com/guides/admin-guide/environments/ad-hoc-tasks Run arbitrary bash commands on your env zero deployment container without committing to git using ad hoc tasks, with access to all environment variables. Sometimes you may want to execute arbitrary commands on your deployment container - for example, manually altering the state or manipulating a local file. These commands can be run using [Custom Flows](/guides/admin-guide/custom-flows), but that requires committing the commands to your git repository, which doesn't always fit the use case. In these cases, it is possible to execute **Run a Task** on the deployment container. > [!NOTE] > > **Permissions to run a one time tasks** > > Ad hoc tasks allow you to run **any** command on the deployment container, so by default only [organization administrators](/guides/admin-guide/user-role-and-team-management/user-management) may run these tasks. You can use [Custom roles](/guides/admin-guide/user-role-and-team-management/custom-roles) to grant this permission to other users. ## Executing a Run Task ![Environment advanced context menu with Run a Task option highlighted](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/5299661-ss.jpg?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=7e0930b706c6136cf51ecdaebd572eac) From the environment's advanced context menu, click on `Run a Task`.\ It will prompt you to enter the commands you desire to execute.\ Enter the commands, as you would in a bash script. Separate commands with new lines.\ When you are ready to run your task - click the `RUN A TASK` button below. ![Run a Task dialog showing bash command input area and RUN A TASK button](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/1ee51e5-screenshot_2023-01-23_at_10.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=79a7cc10f5abbfb0e9e7434b18792518) > [!WARNING] > > Task Timeouts > > Tasks have a 30 minute timeout Your task will be queued and executed on the deployment container, including the local cache env zero saves between deployments. You'll be able to see your commands execute in the Deployment Logs, like any other deployment.\ During the task execution, all the variables that are defined in the environment will be available for you to use. Tasks also support [custom flows](/guides/admin-guide/custom-flows). You can read more about the available hooks [here](/guides/admin-guide/custom-flows/#hook-stages). ## Common Tasks * [Migrate state](https://www.terraform.io/cli/commands/init#backend-initialization): `terraform init -migrate-state -force-copy` or `echo "yes" | terraform init -migrate-state` * [Release state lock](https://www.terraform.io/cli/commands/force-unlock): `terraform force-unlock -force LOCK_ID [DIR]` * [Retrieve output](https://www.terraform.io/cli/commands/output): `terraform output [options] [NAME]` * [Taint a resource](https://www.terraform.io/cli/commands/taint) `terraform taint [options]
` * [Move state](https://www.terraform.io/cli/commands/state/mv): `terraform state mv [options] SOURCE DESTINATION` > [!NOTE] > > The tools available for executing commands are the same ones that were available during your last deployment. > If you require additional tools, make sure to update the ENV0\_INSTALLED\_TOOLS variable and run the deployment again. ## Tasks and Terraform Init Tasks do not clone your source code. When the environment has a working directory archive from a previous deployment, env zero restores it and runs your script against it, and that archive does not include Terraform provider binaries (`.terraform/providers`). For Terraform, OpenTofu, and Terragrunt environments, env zero runs an init step before your task script whenever the restored working directory is missing its provider cache. Your script still runs exactly as you wrote it, and you do not need to add `terraform init` yourself. The init step does not run when: * The provider binaries are already in the working directory, for example after an agent version that still archived them. * The environment uses a tool with no init step, such as Pulumi, Helm, Kubernetes, Ansible, or CloudFormation. * `ENV0_ARCHIVE_TF_PROVIDERS=true` is set, because the archive still carries the providers. * There is no working directory to restore, which is covered in the next section. If the init step fails, for example because the deployment container cannot reach the provider registry or a mirror, the task fails with the init error and your script does not run. To keep provider binaries in the archive, see [Keep Terraform Providers in the Working Directory Archive](/guides/admin-guide/additional-controls#keep-terraform-providers-in-the-working-directory-archive). ## Tasks on Environments With No Working Directory You can run a task on an environment that has never been deployed, and on one whose working directory archive has expired. A task is often how you inspect or repair an environment before it has ever run, so it does not require a deployment first. env zero notes what it found in the deployment log and runs your script either way: against the state files alone when those are still available, or in an empty working directory when they are not. Nothing is initialized in that case, so a task that needs Terraform providers or modules has to run `terraform init` itself before anything else. ## Task Comments You can add a comment, to let your teammates know why the task was run.\ Add a comment, by filling in the *"Comment"* input down below the `bash` input. ![Run a Task form showing Comment input field below the bash command input](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/db668ae-screenshot_2023-01-23_at_10.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=975fb83c3e75d6f935c5b74765e99585) The comment will be displayed in the Task page.\ Markdown syntax is supported. ![Task deployment page displaying the comment alongside task execution details](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/a35dcfd-screenshot_2023-01-22_at_14.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=70b2177d1f85b379c3e5db3871a22729) > [!NOTE] > > **Markdown Support** > > The comment supports Markdown, so you would be able to generate even more context. ## Next steps Tasks run with the environment's variables, so [manage those variables](/guides/admin-guide/variables) to change the values a task receives. # AI-powered summarization and error insights Source: https://docs.envzero.com/guides/admin-guide/environments/ai-powered-summarization-and-error-insights Use AI error insights and plan/apply summarization in env zero to analyze deployment errors and highlight infrastructure changes for Terraform runs. env zero offers AI-generated insights, helping your day to day work, analyzing what has occurred in your deployments in env zero. You can use AI to help analyze the cause of an error in a deployment, or summarize what has occurred in that deployment ### AI-Powered Error Insights When an error occurs in your deployment logs, env zero can analyze it, explain what the error means and what's the likely cause of the error, and suggest possible ways to resolve it. Error Insights could help you save time when debugging and fixing IaC issues and errors, and is especially helpful with people who are not well-versed in that IaC. If an Error Insight is available, an "Ask AI" button will appear next to the error message. Clicking this button will generate an AI-powered explanation and potential fixes. ![Deployment logs showing an error message with Ask AI button to generate an explanation](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/04/99ea503fa335cf129ffc8701de88003328a8923a6b179b8ada3869402519551d-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=e6d979a0c5ca00380fc821fd06bb11cb) ![AI-generated error insight panel showing error explanation and suggested fixes](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/04/5eb0f795df37bb2cc197b659c1a2b25cb005b4138e6611cf99d17739dba32a8b-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=d118b0c12a4d717f4e9c32016b7098fc) ### AI-Powered Plan and Apply Summarization For successful [OpenTofu](/guides/admin-guide/templates/opentofu), [Terraform](/guides/admin-guide/templates/terraform), and [Terragrunt](/guides/admin-guide/templates/terragrunt) plan/apply runs, env zero can generate a summary highlighting the most important changes. The summary can help you have a better picture of what are the expected or performed run changes to your cloud resources, help you identify specific things that require a closer look, and in general - help you gain a better understanding of the resource changes faster In plan logs, the summary provides an overview of proposed infrastructure modifications, highlighting any significant or sensitive changes, and offers recommendations for the configuration or for things to look out for. In apply logs, the summary highlights the changes that were successfully applied, how they were applied compared to the plan, and additional insights. If summarization is available, a "Summarize" button will be shown in the respective logs. ![Plan logs showing Summarize button to generate an AI-powered summary of proposed changes](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/04/6abfc950ed31ebeb4043037fdf182cb49a836f824ae0a0e24ad11aa9be8bafcf-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=ec6fab3ff452536f66ee9e53ca24c750) ![AI-generated plan or apply summary showing key infrastructure changes and recommendations](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/04/74826f277c87ee85f50364a0886472c9f4329e0784721db3dc70b1d07521b94d-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=f33c9f3ebed33c012c92a276686f56a4) #### Security and Privacy When the feature is enabled, and when an AI-Powered Summary or Error Insight is explicitly requested, env zero leverages AI to analyze deployment specific data relevant for the analysis. This includes the error message and the command that ran, environment variables with redacted values for [sensitive variables](/guides/admin-guide/variables#secrets), the plan file, and apply command logs. All data is used solely by env zero, never shared with third parties or used for training models. ## Next steps To review plan output before code is merged, [run a plan on every pull request](/guides/admin-guide/environments/plan-on-pull-request). # Managing bulk operations Source: https://docs.envzero.com/guides/admin-guide/environments/bulk-operations Run deploy, destroy, or other operations on multiple env zero environments simultaneously from the project environments page or organization dashboard. As your organization gets larger, and your projects contain more and more environments, running some operations on many environments at once can be a cumbersome task. That's where env zero's bulk operations feature can come in handy. ## Running a Bulk Operation Running a bulk operation is very simple: 1. Navigate to your `Project Environments` page. 2. Click the kebab menu button on the top right of the list and pick `Toggle selection mode` ![The environments list with the kebab menu open on Toggle selection mode](https://mintcdn.com/envzero-b61043c8/37DrZ5Yu0iArtwRW/images/guides/admin-guide/environments/bulk-operations-toggle-selection-mode.png?fit=max\&auto=format\&n=37DrZ5Yu0iArtwRW\&q=85\&s=823dced65aa2de7521f315b14d292a30) 3. Check the environments you would like to run the operation on and click `Perform Action` ![Three environments checked in selection mode, with the Perform Action button showing the count](https://mintcdn.com/envzero-b61043c8/37DrZ5Yu0iArtwRW/images/guides/admin-guide/environments/bulk-operations-select-environments.png?fit=max\&auto=format\&n=37DrZ5Yu0iArtwRW\&q=85\&s=fbd056eb3200bf76aea2d2b087368a91) > [!NOTE] > > **Cross-Project Bulk Operations** > > The selection phase can be done also from `Organization Dashboard` page, in case you would like to run the operation on environments across multiple projects 4. The bulk operations wizard will appear, on which you will have to choose the operation you would like to run ![Bulk operations wizard showing available operation types to run across selected environments](https://mintcdn.com/envzero-b61043c8/37DrZ5Yu0iArtwRW/images/guides/admin-guide/environments/bulk-operations-command-step.png?fit=max\&auto=format\&n=37DrZ5Yu0iArtwRW\&q=85\&s=e5f31c1d66bb7a802d5112c5fcc4c0c5) The supported operations are: 1. Deploy 2. Destroy 3. Approve a plan 4. Cancel a plan 5. [Lock](/guides/admin-guide/environments/environment-locking) 6. [Release lock](/guides/admin-guide/environments/environment-locking) 7. Cancel queued deployments 8. [Running a task](/guides/admin-guide/environments/ad-hoc-tasks) 9. [Mark as inactive](/guides/admin-guide/environments#mark-an-environment-as-inactive) 10. [Add tags](/guides/admin-guide/environments/tags#add-and-remove-tags-in-bulk) 11. [Remove tags](/guides/admin-guide/environments/tags#add-and-remove-tags-in-bulk) For some operations, such as `Deploy`, you can edit some of the request settings on the `Details` step. In case there is nothing to edit, you will be taken straight to the `Summary` step. ![Bulk operation Details step showing the deploy settings for the selected environments](https://mintcdn.com/envzero-b61043c8/37DrZ5Yu0iArtwRW/images/guides/admin-guide/environments/bulk-operations-deploy-details-step.png?fit=max\&auto=format\&n=37DrZ5Yu0iArtwRW\&q=85\&s=adc013035600a918b46490022970884f) In the `Summary` step, you can review and approve your operation. Click `Execute` when you are ready to start the bulk operation. ![Bulk operation Summary step listing the selected environments with an Execute button](https://mintcdn.com/envzero-b61043c8/37DrZ5Yu0iArtwRW/images/guides/admin-guide/environments/bulk-operations-summary-step.png?fit=max\&auto=format\&n=37DrZ5Yu0iArtwRW\&q=85\&s=f1bbeec7f70f0bbf581d9ef0362397a6) The operation you choose will now be executed across all your selected environments simultaneously. ## Following a Bulk Operation After you click `Execute`, the wizard stays open and turns into a live results panel. It refreshes every few seconds until every environment has finished, so you can see what actually happened to each one instead of only being told that the request was accepted. ![Bulk operation results panel with one environment still in progress and two succeeded](https://mintcdn.com/envzero-b61043c8/37DrZ5Yu0iArtwRW/images/guides/admin-guide/environments/bulk-operations-results-panel.png?fit=max\&auto=format\&n=37DrZ5Yu0iArtwRW\&q=85\&s=1719763dbf10c4a43c75fd7a3fc97e1c) Each environment shows: * A status: `Pending` while it is waiting its turn, `Starting...` while env zero is starting it, and then the deployment's own status (`Queued`, `In Progress`, `Waiting for approval`, `Success`, `Failure`, `Cancelled`, and so on). Operations without a deployment, such as lock or mark as inactive, end at `Completed`. * A link to the deployment, as soon as one exists. * `Failed to start` when env zero could not start the operation at all, for example because the environment is locked or you do not have permission on it. Hover over the row's icon to read the error. At the top, a progress bar and an `X of Y finished` counter track the whole batch, with the number of failures next to it. Once everything settles, the panel says so and stops refreshing. ![Bulk operation results panel after every environment finished successfully](https://mintcdn.com/envzero-b61043c8/37DrZ5Yu0iArtwRW/images/guides/admin-guide/environments/bulk-operations-results-finished.png?fit=max\&auto=format\&n=37DrZ5Yu0iArtwRW\&q=85\&s=b8430b3b0999ac730fef25ef0556222a) > [!NOTE] > > The operation runs on env zero's servers, so closing the window does not stop it. The results panel is not restored after you close it. # Using continuous deployment Source: https://docs.envzero.com/guides/admin-guide/environments/continuous-deployment Configure env zero environments to automatically redeploy on every push to a git branch, with options for any change or file filter pattern triggers. > [!NOTE] > > **Currently, we support Continuous Deployment only for GitHub, GitLab, Bitbucket and Azure DevOps repositories.** ## Continuous Deployment in env zero env zero allows you to configure an environment to automatically re-deploy your environment with your updated terraform code on every push to a git branch. If a deployment is already in progress when a git push occurs, a deployment will be queued, and the environment will deploy again when the current deployment is finished. > [!NOTE] > > **Connect Your Template To Your VCS** > > Before creating or configuring an environment to continuously deploy, make sure that you have a template integrated with [GitHub](/guides/admin-guide/templates/github-templates), [GitLab](/guides/admin-guide/templates/gitlab-integration), [Bitbucket](/guides/admin-guide/templates/bitbucket-integration) or [Azure DevOps](/guides/admin-guide/templates/azure-devops-integration). ## New Environment To create an environment, choose a specific **Project**, select the **Project Templates** tab, and then click *Run Now* on the template you want to use. On the **Run Environment** screen, pick the branch you would like to continuously deploy, and tick the `Redeploy on every push to the git branch` checkbox. Then, fill out the rest of the configuration for the deployment. When you're done, click **Run**.The environment will now deploy and will redeploy again on every push to the git branch ![New environment deployment dialog with continuous deployment options](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/new_environment_deployment_dialog_with_continuous_deployment_options.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=cbe7a8b8f730713e113425ec1299584d) New Environment Deploy Dialog ## Existing Environment Choose your **Project**, select the **Project Environments** tab, and then click on the environment you would like to configure for continuous deployment. Go to the **Settings** tab, tick the `Redeploy on every push to the git branch` checkbox. **You can choose to run by the following options:** * **Any change** - your environment will redeploy on every push * **Changes on Template Directory files** - your environment will redeploy on every push which contains file changes in the Terraform folder used by the environment's template. * **Changes by file filter pattern** - your environment will redeploy on every push which contains changes in files matching the given pattern. See below how to configure glob pattern. ![Edit existing environment settings for continuous deployment](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/edit_existing_environment_settings_for_continuous_deployment.jpeg?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=09fb4016fc6a4879c60d9628b1e754f3) Edit Existing Environment Settings > [!NOTE] > > **[Glob pattern](https://en.wikipedia.org/wiki/Glob_\(programming\))** > > Glob patterns specify sets of filenames with wildcard characters. For example, *.txt or my\_folder/*\* > > It means you can configure pattern by git repository which re-deploy environment only if the push contains files that change by free pattern. > > For example, you can configure pattern like src/project\_1/\*\* > In this case, we will re-deploy only if the push contains file which starts with src/project\_1/... > > We also support [extglob patterns](https://github.com/micromatch/extglob#extglob-cheatsheet) with that you can write pattern which ignores files or use a list of folders. > For extglob, when using OR/AND statements, make sure to wrap each option with parentheses, for example: +((/first/path/**)|(/second/path/**)) > > The path should be defined from the **root of the repository.** ### Deployment Comment When an environment is triggered due to CD - a comment would be automatically added, with a link to the head commit upon the time of trigger. ![Deployment comment automatically added by CD showing a link to the triggering git commit](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/14e001a-screenshot_2023-01-22_at_10.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=2422e31779b13ba3d2c0acdb1ca89dd0) ### Skipping deployments You can skip CD triggered by the push events by including a command in your commit message. CDs that would otherwise be triggered using on: push won't be triggered if you add any of the following strings to the commit message in a push ```text theme={null} [skip env zero] [env zero skip] ``` ## Next steps * [Run a plan on every pull request](/guides/admin-guide/environments/plan-on-pull-request) to review changes before they reach the deployed branch * [Skip redundant deployments](/guides/policies-governance/deployment-controls#skip-redundant-deployments) when several pushes queue deployments and only the latest matters * [Chain downstream environments](/guides/admin-guide/environments/workflow-triggers) # Drift Detection Source: https://docs.envzero.com/guides/admin-guide/environments/drift-detection Set up automated drift detection in env zero to identify when cloud resources diverge from IaC definitions, with cron scheduling and notification options. Managing Infrastructure as Code (IaC) comes with its own set of challenges, and one of the most significant is drift. Drift occurs when the actual state of your cloud resources deviates from the state defined in your code - whether due to manual changes, external automation tools, or other processes outside of your IaC pipeline. Detecting and managing drift is critical to maintaining consistency, security, and compliance across your infrastructure. With env zero, you can proactively address this issue by setting up automated drift detection. env zero schedules deployment tasks that conclude with an analysis of the Terraform plan output, allowing you to identify and resolve drifts in real-time. > [!NOTE] > > **Previous Support** > > Although drift detection has been a feature of env zero for a while, now we provide additional drift event notifications. If you would like to set up a drift detection on your environment and get notified on drift occurrences, you will need to follow these steps: 1. \*\* Schedule a drift detection job:\*\* In the environment **Settings** tab, under Drift Detection, make sure you add a cron expression based on the interval you would like to check the drift. For example, if you would like to check the drift twice a day at 10AM and at 7PM, enter `00 10,19 * * *`. > [!NOTE] > > **Drift Detection Scheduling** > > Despite being able to configure any cron pattern for drift detection, the minimum interval is one day for Free and plans, and one hour for Enterprise plans. > > The scheduler runs once an hour, and controlling the exact minute of the run within the hour is not possible. ![Environment Settings Drift Detection section with cron expression input field](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/changelogs/2025/02/ed1613488c4b718336e8f6d2797507de46a656090354cb88de6fe20cb9390be7-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=e456171c51f9991f63258e6230de45a2) 2. **Add Notification:** To get notified directly in Slack,Microsoft Teams, email, or Webhooks when a drift has been detected, set up notification targets and events on your project settings under [Notifications](/guides/integrations/notifications).\ You can set the following types of events: * **Drift detected** - The remote resources have been changed. * **No drift detected** - The remote resources are synced with your infrastructure code. * **Drift failed** - The task has failed for some reason. You can read more about notifications [here.](/guides/integrations/notifications) ![Project notifications settings showing drift detection event types available for Slack, Teams, and email alerts](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/27b370b-screen_shot_2022-03-08_at_15.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=2414dc2703fececb7f430a8766e99f0d) When a drift detection job is executed, you'll see its status under the Deployments tab : ![Deployments tab showing drift detection job entries with their run status](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/0767af2-screen_shot_2022-03-08_at_15.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=2712486035b4c7061e8994f1d09ce815) When a drift is identified, or if the drift detection process encounters an issue, environment drift-status will shift to Drifted or Error, correspondingly.\ These statuses will be accompanied by an informative message that links to the related Drift Detection deployment logs.\ Performing a new deployment on an environment with a drift will reset its status accordingly. Following a drift occurrence: ![Environment card showing Drifted status badge with a link to the drift detection deployment logs](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/272f0d356b622f83fd7f375bd2910bdb5d92b1c8ea752ec1473b52add7cb03c0-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=16b25c65ab12a2bf67ce5ef9c54149f2) Following an error during drift detection: ![Environment card showing Error status badge after a failed drift detection process](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/87ee291-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=5df25bebb8faa6293edd74a65c9682f3) ### Understanding Drift Statuses * `OK`: No drift has been detected; the environment's state matches the defined Infrastructure-as-Code (IaC) configuration * `Error`: An error has occurred during the drift detection process * `Drifted`: Drift has been detected; the environment's state differs from the IaC configuration * `Never Run`: Drift detection has never been executed for this environment * `Disabled`: Drift detection is disabled for this environment ## Drift Remediation env zero offers both automatic and manual drift remediation options. With automatic drift remediation, you can configure env zero to apply the necessary changes to your cloud resources automatically, ensuring they stay aligned with your IaC configuration. Read more about different ways to remediate drift in env zero [here](/guides/admin-guide/environments/drift-detection/automatic-drift-remediation). ## Further reading * [Drift under control: keep your infrastructure consistent](https://www.envzero.com/blog/drift-under-control-keep-your-infrastructure-consistent-with-continuous-detection-intelligent-analysis-and-safe-remediation) * [Drift cause: closing the loop on infrastructure drift management](https://www.envzero.com/blog/drift-cause-closing-the-loop-on-infrastructure-drift-management) * [Expanding drift remediation: keep your code aligned with cloud changes](https://www.envzero.com/blog/expanding-drift-remediation-keep-your-code-aligned-with-cloud-changes) ## Next steps * [Analyze why an environment drifted](/guides/admin-guide/environments/drift-detection/drift-cause), such as a manual cloud change or a provider version update * [Fix one drift cause across many environments](/guides/admin-guide/environments/drift-detection/drift-actions) with Drift Actions, where it is enabled for your organization # Remediate Drift Source: https://docs.envzero.com/guides/admin-guide/environments/drift-detection/automatic-drift-remediation Automatically or manually remediate infrastructure drift in env zero by deploying code from VCS or creating pull requests for manual cloud changes. Drift occurs when the actual state of your infrastructure no longer matches its desired state, which can lead to security, compliance, and reliability risks, as well as increased costs. Complementing env zero's [Drift Detection](/guides/admin-guide/environments/drift-detection) capabilities, Drift Remediation ensures consistency by quickly reconciling drift as part of your infrastructure management workflow - either automatically or with a simple two-click manual action. ## Configuring Automatic Drift Remediation Activating automatic Drift Remediation offers a hassle-free way to ensure that all detected drifts are immediately corrected, using one of the following options: * **Disabled**: Selecting this option will disable automatic drift remediation. When drift is detected, you will need to manually review and remediate the differences. * **Deploy code changes to the cloud (Run env zero deployment)**: If drift is detected, env zero will automatically attempt to remediate it by running an env zero deployment with the latest configuration from your connected version control system (VCS). This option assumes that the desired state is accurately reflected in your code. * **Create a pull request for manually modified cloud resources**: If drift is detected and it appears that cloud resources were modified manually (outside of env zero), this option will trigger the creation of a pull request in your connected VCS. This pull request will contain the changes necessary to bring your IaC configuration in line with the current cloud state. This allows you to review and approve the changes before they are applied. * **If the cloud resource was manually changed, create a pull request; otherwise, deploy code changes to the cloud**: This option provides a hybrid approach. If drift is detected and identified as a manual cloud modification, a pull request will be created for review. However, if the drift is not attributed to a manual change, env zero will automatically attempt to remediate it by deploying the latest code from your VCS. ![Environment Settings showing automatic drift remediation options including deploy code, create PR, or hybrid approach](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/3656607c4c6ae5ab7d822b512b0dd74f809c3d8c1452177d84e21d97b5e67e7a-image.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=dc9d87e563991078c7ef1964f90464f0) The setting can be configured at the project level for all newly created environments or individually at the environment level. Finally, automatic remediation can also be set to Disabled, allowing you to reconcile drift manually using the ‘Remediate Drift’ button available on the deployment details page. There, you can choose how to resolve the detected discrepancies between your code and the actual infrastructure state. The specific actions available under this button allow you to initiate the reconciliation process: * **Deploy code changes:** * It immediately attempts to apply the configuration defined in your current code/template directly to the live infrastructure, overwriting the detected drift to enforce the state defined by your code. * **Create a pull request:** * It generates a pull request (PR) in your version control system containing the code modifications needed to correct the drift. This allows the fix to be reviewed and approved before being merged and deployed. ![Deployment details page showing Remediate Drift button with options to deploy code changes or create a pull request](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/73ccfc413d06789eba8bad9297170865f376f2f950ecad53ab58cf8b7eb96139-image.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=234be4a1ceed2bf27dcbf8d9c26ff147) ## Policies and Governance Importantly, Drift Remediation deployments support all existing env zero policies and governance features. This ensures that any automated remediation action adheres to approval processes, security policies, and compliance requirements.\ For example, you can require approval before applying Automatic Drift Remediation to certain environments.\ See [Approval Policies](/guides/policies-governance/approval-policies) for details on how to configure these rules. ## Scheduling Deployments In some cases, rather than reacting to drift immediately, you may want to ensure that infrastructure is regularly reconciled with your code.\ [Scheduling](/guides/admin-guide/environments/scheduling) allows you to automate deployments at predefined intervals to maintain alignment with your declared configuration. ## Next steps Before choosing between redeploying and opening a pull request, [analyze the drift cause](/guides/admin-guide/environments/drift-detection/drift-cause) to see whether someone changed the resource manually in the cloud. # Drift Actions Source: https://docs.envzero.com/guides/admin-guide/environments/drift-detection/drift-actions Group drift root causes across environments in env zero, rank them by blast radius and age, then fix or ignore a cause everywhere at once. > [!NOTE] > > Drift Actions is not enabled by default on any plan. To turn it on for your organization, contact your account manager. [Drift detection](/guides/admin-guide/environments/drift-detection) tells you which environments have drifted. Drift Actions tells you why, across your whole fleet, and lets you fix one root cause everywhere at once. A provider upgrade that drifted 40 environments is one row, not 40. ## Where to find it * **Organization menu > Actions > Drifts** covers every project you can access. * **Project menu > Drifts** covers a single project. The navigation item is hidden if Drift Actions is not enabled for your organization, or if you do not have the View Drift Cause permission. ## Permissions **View Drift Cause permission:** * Open the Drifts page and see causes **Run Apply permission** on each affected environment: * Fix by redeploying **Edit Environment Settings permission** on each affected environment: * Ignore and un-ignore a cause Both actions run only on the environments you are permitted to act on. The confirmation modal reports how many were left out. ## How causes group A [cause](/guides/admin-guide/environments/drift-detection/drift-cause#drift-cause-analysis) is identified by the destination of a change, not by the transition. A fleet mid-upgrade to `aws 2.2` is one cause, whether an environment came from `2.0` or `2.1`. | Cause | Summary shown in the worklist | Severity | | - | - | - | | Unmanaged Change | Resource type and path, changed or deleted outside env zero | Warning | | Unapplied Commit | `Commit not applied` | Warning | | Provider Version Change | Provider name and detected version | Info | | Module Version Change | Module name and detected version | Info | | Variable Change | Variable name, whether it was added, removed or changed, its scope and type | Info | | State Modified | Who modified the state, and whether by a remote apply, a task, or an apply by comment | Info | Grouping is coarser than it looks in three cases: * Variable changes group on the variable, not its value. Two environments given different new values for the same variable are one cause. * Unmanaged changes group on the resource, not the attribute. Index segments are stripped, so `aws_instance.web[0]` and `aws_instance.web[1]` are one cause, as are a tag change in January and a security group change in March. * State Modified is reported only when env zero found the deployment that changed the state. > [!WARNING] > > Variable values are never shown on this page. env zero does not store or serve them for this feature. A row tells you which variable changed, in which scope, and how, never what it changed to. For before and after values, open that environment's drift detection. ## Read the worklist One row per cause, sorted by priority. The columns are **Priority**, **Cause**, **Summary**, **Blast radius** (environments and projects affected), **Age** (days since the cause was first seen, shown as `<1d` on the first day, hover for when it was last detected), and **Actions**. Filter by cause type and project, or search by subject. Expand a row for the affected environments, grouped by project, and **What drifted**: the commit, the provider or module and its detected version, the variable name, scope, scope ID, type and change, the resource type and path, or who changed the state and how. Five cubes sit above the worklist: **Open causes**, **Aged over 7d**, **Detection enabled**, **Detection broken**, and **Median to close**. Each counts only what your project access lets you see, so none of them is an organization-wide total. **Detection enabled** measures configuration, not coverage. An environment can have detection enabled and never have been scanned. **Median to close** covers the last 90 days and is a trend, not a service commitment, because env zero cannot prove what closed a cause and a cause that drifts again starts its clock over. ## How priority is calculated ```text theme={null} score = severity (Info = 1, Warning = 2) + 1 if the cause affects more than 5 environments + 1 if the cause was first seen more than 7 days ago ``` | Severity | No escalation | One escalation | Both escalations | | - | - | - | - | | Info | Low | Medium | High | | Warning | Medium | High | Critical | Each escalation adds at most 1, so a cause first seen 90 days ago scores the same as one first seen 8 days ago. Hover the priority badge to see the derivation for that row. > [!WARNING] > > Priority is calculated per viewer and is never stored. The environment count that feeds it is narrowed by your project permissions, so two people can correctly see different priorities for the same cause. ## Fix by redeploying **1. Select Fix by redeploying** The confirmation modal lists every environment the action will run on, and how many affected environments were excluded because you cannot deploy them. **2. Select Trigger deployments** env zero triggers a remediation deployment in each listed environment, redeploying your code so the cloud matches it. **3. Wait for detection to confirm** Deployments run asynchronously. The cause leaves the worklist once they complete and the next drift detection run confirms it is gone. > [!WARNING] > > This triggers real deployments in every listed environment. There is no partial selection: the action runs on every environment in the group you are permitted to deploy. The button stays disabled until the whole batch has been sent. ## Ignore a cause Select **Ignore** on the row, then **Ignore this cause** in the confirmation modal. Use this for accepted drift you do not intend to fix. > [!WARNING] > > Ignoring never expires and applies per environment. It does not silence the cause anywhere else, and if a new environment develops the same cause, the row returns for that environment. For unmanaged changes, ignoring is keyed on the resource, so it also hides later, unrelated changes to that resource. To undo, turn on **Show ignored** and select **Un-ignore**. The cause reappears after the next drift detection run, about 24 hours, if the drift is still there, and its age restarts from that appearance. Environments whose settings you cannot change stay ignored. ## When drift detection fails If drift detection failed on its last run for any environment you can see, a banner appears above the worklist and cannot be dismissed. Those environments contribute no causes, so the worklist is incomplete by that many environments. This is a detection failure, not drift. Expand the banner to list them, up to the first 100. ## Empty states **Drift detection is not enabled** appears when none of the environments you can see are monitored. A project's [drift detection policy](/guides/policies-governance/drift-detection-policy) applies only to environments created after you enable it, so enable drift detection in each existing environment's scheduling settings to cover it. **No drift detected** means env zero found no drift causes, not that every environment was scanned. Environments that have never been scanned look the same. Check the **Detection enabled** cube for how much of your fleet has detection turned on. ## Next steps To have each environment fix its own drift as soon as it is detected, [configure automatic drift remediation](/guides/admin-guide/environments/drift-detection/automatic-drift-remediation#configuring-automatic-drift-remediation). # Analyze drift cause Source: https://docs.envzero.com/guides/admin-guide/environments/drift-detection/drift-cause Identify the root cause of infrastructure drift in env zero, covering manual changes, provider version updates, and unapplied code for Terraform. > [!NOTE] > > **Feature Compatibility** > > The feature is fully compatible starting from agent version 1.0.1044 > The feature is supported only for Opentofu, Terragrunt, and Terraform. Drift refers to the divergence between the actual state of infrastructure and the state defined in configuration files. This can occur when changes are made outside of the Infrastructure as Code (IaC) tool, such as manual updates through a cloud provider's console or automated processes outside of the IaC pipeline. Drift is risky because it can lead to unexpected behavior, inconsistencies in resource management, and potentially compromise system reliability or security. If not detected and addressed, drift can cause deployments to fail, resulting in costly misconfigurations and possibly leaving systems vulnerable to exploitation. Regular drift analysis is crucial for maintaining infrastructure consistency and ensuring that all changes are tracked and aligned with the defined code. When resources are managed in env zero, env zero captures drift causes automatically. Whether a user has modified the state directly, a provider version change has introduced differences, or new code was pushed without being applied - env zero captures these events. ## Drift Cause Analysis Based on the IaC data, env zero will analyze the drift to determine whether it was caused by one or more of the following reasons: 1. ### Unmanaged Change A resource was changed manually (by a user or API) in the cloud provider's console. Unmanaged changes to infrastructure are risky and not recommended. env zero will check if a change was made to the resource outside of the IaC code. If a change is detected, it will appear here: ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/dc87af165638c3f824e82187b39cb5977f3a3df819f4f7b58f160fab97940654-1.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=f3210c9d5c978ed832e9ada14c35a100) If you have [Cloud Compass](/guides/cloud-compass/cloud-compass) configured, a 'More Details' link will appear. Clicking it will show all the events that occurred within the resource between the last modifying deployment and the drift check deployment. In the events modal, you can view event details related to the changed resource - Event Date, Event Resource, Event Name, and the user who took the action. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/e04965fe524d3a0fade0295edb6aad45de4c4aabb339b774f8c83f8414cc33ab-1.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=a8c9fff1f235255b523743a141260c89) Each event has a link that provides more information directly from the Cloud Provider. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/b217f3056e5b186daa5cfed6732207a83262d9ae90401226560cbfa40743f639-1.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=d00f8214a642664d0714e4258427b4c9) > [!WARNING] > > Getting Events > > Currently, retrieving resource events is supported only for AWS and Azure.\ > In order to retrieve resource events, you must first set up Cloud Compass in your organization.\ > For more information, please refer to the documentation. 2. ### Provider Version Change A provider's version was changed, causing the drift. This can occur when the infrastructure code doesn't use static provider versions. env zero will display which provider's version changed, along with the old and new versions. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/c38b85a2635d1ff7ce89d49bf5cfee10f10c3b0bbcfafcab0dad79b9e13627e1-2.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=2959e54cc9794c2fe5c0d3eb2e79c3d4) 3. ### Module Version Change A remote module's version was changed, causing the drift. This can happen when the infrastructure code doesn't use static module versions. env zero will display which module's version changed, along with the old and new versions. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/f98b44bc5e5d742c145f2cbd2812c909174157886c657a03263ce247862a5385-3.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=600ebc07eb575fd81e210fa6191b505b) 4. ### Variable Change One of the environment's inputs in env zero changed, causing the drift. env zero will display who made the change, when it occurred, and the variable's name, scope, old value, and new value. The old and new values will not be displayed for sensitive values. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/1f29a759b846950c5b7c71019835b54269c14a795579ebfaf7138c016fae10f1-4.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=9e3088df12f71af55f06094f149a1f95) 5. ### Unapplied Commit A change was made to the infrastructure code but has not yet been applied. env zero will check if a commit was made to the infrastructure code after the last modifying deployment and show the commit (with a link to it in the VCS provider), along with who made it and when. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/31c8b2920028bd88ee5345b035bb86d341dd8c49dd9193d200e8f32dd2d8312e-5.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=4dd4e1a4bbcfeecc66406eb5ba65b054) env zero uses globs to make this check more accurate. The default globs are: ```text theme={null} ${TEMPLATEPATH}/**/\*.tf;${TEMPLATE_PATH}/**/.tofu;${TEMPLATEPATH}/\*\*/.hcl;env0.yml;env0.yaml ``` where `${TEMPLATE_PATH}` is the template's path.\ These default globs can be overwritten by using the `DRIFT_CAUSE_UNAPPLIED_COMMITS_GLOBS` [environment variable](/guides/admin-guide/variables) on the environment in env zero. It is a semicolon-delimited list of globs. env zero will also ensure that the environment's revision and the revision at the time of the drift check are the same. 6. ### State Modified The environment's state was directly modified. env zero will detect a state change and try to find a corresponding [remote apply](/guides/admin-guide/remote-backend/remote-apply) and link to it. If no remote apply is found, a message indicating that the state has changed will appear.\ When a remote apply was detected: ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/6c67f293910029dc3090435d1281ce5fe893a27a2501eeb0ef03f360c4e2330b-6.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=6676b84be5b854610568786823ca6e7a) When no remote apply was detected but the state has changed: ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/46d229f4d0b11b20233cb52f41ae5884588451cf6abf29fcd1de319fe03dae40-6.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=ec3bf8df7955d5f9b76a28bcc0748072) ## Using Drift Cause There are two ways to utilize Drift Cause: 1. ### In The Environment Page If a drift has been [detected](/guides/admin-guide/environments/drift-detection) in your environment, you will see a collapsible showing the number of issues found and a link to the drift deployment. Opening the collapsible will show a list of the different drift causes env zero checks for, as well as the check's status. These results will appear on the right. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/88471782e903d629a4ff17b06efb65c55c497083d6004cec4db4974a270cf773-7.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=9ccbc7932dfd52d5e061fca94e06de46) 2. ### On The Deployment Page The 'Drifts' tab on a drifted deployment page shows a list of the different drift causes env zero checks for, as well as the check's status. The drift cause check results will appear on the right. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/1abee4d5c9d8af0bbef61f25e456902c25293d59a84ed4614796e6f063b74766-8.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=8f87435d7c2fd66fb17609ccb3b568cc) Below it you will see the changed resources list and what changed. You will also be able to get the resource's events by pressing the 'Analyze Drift Cause' button. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/drift-detection/212b9c0b7abbe1a5e0c11b6a08817f775978682654184ac76b5fa0220b5cdea2-9.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=bd1cd54f716816ee01eb1dcebaff7e59) > [!NOTE] > > **Reasons Drift Cause won't be able to show events for resource** > > There are several reasons why events will not be available: > > * A missing resource ID, which can happen for a number of reasons: > * An old agent is being used > * The drift reason is a resource being manually deleted > * Unsupported provider, as detailed above > * A user is missing the View Drift Cause permission ## Next steps Once you know why an environment drifted, [remediate the drift](/guides/admin-guide/environments/drift-detection/automatic-drift-remediation) by redeploying your code or opening a pull request that matches the code to the cloud. # Locking environments Source: https://docs.envzero.com/guides/admin-guide/environments/environment-locking Lock env zero environments to prevent deploy, destroy, plan, and drift detection from running, with an optional lock reason visible to project members. Environment locking prevents any change to the environment. While the environment is locked no deploy, destroy, plan or drift detection actions will be run. ## Who can lock and release environments To lock or release an environment, a user needs the `Lock/Unlock Environment` permission (part of [the default "Project Admin" role](/guides/admin-guide/user-role-and-team-management/default-roles/#project-admin). Any user with this permission can release the lock, regardless of who locked it. ## How to use ![Environment advanced context menu showing the Lock Environment option](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/environment_advanced_context_menu_showing_lock_environment_option.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=b3e394660f0d2c8143c7d3885276374a) From the environment's advanced context menu, click on "Lock Environment". It will ask for confirmation. You can provide an optional reason, so other users will know why the environment is locked. ![Lock Environment confirmation dialog with optional reason field](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/lock_environment_confirmation_dialog_with_optional_reason_field.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=e4e7fae917a4d2a3933a07c394fc2031) Locked environments will have a banner explaining who, when and why the environment is locked, and a button to release the lock. ![Locked environment banner showing who locked it, when, the reason, and a Release Lock button](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/locked_environment_banner_showing_lock_status_user_who_locked_it_and_unlock_button.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=4296f5ad9697821640fdd0cad49b1907) ## What happens when the environment is locked * User cannot run Deploy, Destroy or [Ad hoc Task](/guides/admin-guide/environments/ad-hoc-tasks) * [Scheduled Deploy, Destroy](/guides/admin-guide/environments/scheduling), and [Drift Detection](/guides/admin-guide/environments/drift-detection) will not run. They will resume after unlocking. * [Continuous Deployment](/guides/admin-guide/environments/continuous-deployment), [Plan on Pull Request](/guides/admin-guide/environments/plan-on-pull-request), and [Plan and Apply from PR Comments](/guides/admin-guide/environments/plan-and-apply-from-pr-comments) will not work. * Environment will not be destroyed due to [TTL](/guides/policies-governance/policy-ttl). After unlocking, a notification will be sent as usual, before the environment is destroyed. ## Next steps To lock or release many environments at once, use [bulk operations](/guides/admin-guide/environments/bulk-operations). # Moving environments Source: https://docs.envzero.com/guides/admin-guide/environments/move-environment Move env zero environments between projects to reorganize structures, with automatic updates to variables, policies, and state access control settings. Moving environments between [projects](/guides/admin-guide/projects) can be useful when reorganizing project structures, reallocating resources, or consolidating environments for more efficient management. By moving environments, you can ensure that your infrastructure aligns with your team’s evolving needs and project goals. 1. Navigate to the Environment page of the environment you would like to move 2. Open the menu at the top of the card 3. Click `Move Environment` ![Environment card menu open with Move Environment option visible](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/07/c963361-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=e55a7c55af814b34b709772fec99f3d7) 3. Select your target project from the list and click `Move` ![Move Environment dialog showing a project list to select the target project and a Move button](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/07/b870ffa-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=58a8d52ba27f5107964f205a287579e2) 4. You'll be redirected to the redeploy page to deploy the environment in the target project. > [!WARNING] > > **Limitations** > > When moving an environment, most of your environment settings will stay intact, however, project related settings may change. Here is a list of the settings that might change: > > * [Variables](/guides/admin-guide/variables) > * Project policies > * [State access control](/guides/admin-guide/remote-backend/state-access-control) > * Costs > > From now on those settings will be part of the new project, however, this will only take affect after a successful deployment on the new project. > > **[Redeploy your environment](/guides/admin-guide/environments#redeploy-an-environment) immediately after moving it.** # Plan and apply via PR comments Source: https://docs.envzero.com/guides/admin-guide/environments/plan-and-apply-from-pr-comments Trigger env zero plan and apply from pull request comments in GitHub, GitLab, Bitbucket, Azure DevOps, and self-hosted VCS providers. As software developers, we all use a Version Control System (VCS) as the main tool in our process. With env zero, you can also manage your Infrastructure as Code (IaC) deployments directly from your VCS provider.\ Commenting with env zero commands on a pull request makes it possible to interact with your env zero environments without having to log in to the env zero platform. #### For an env zero environment to be actionable in a pull request comment, the following prerequisites must be met: 1. The environment needs to have originated from a VCS-integrated template, and its configured revision must be the same as the base branch (target) of the pull request 2. The environment has ‘Enable PR Comments Commands for this Environment’ enabled 3. (Optional) The environment has Alias set ## Configuration To configure this feature, enable the ‘Enable PR Comments Commands for this environment’ checkbox. Go to ‘Environments’, select ‘Settings’ and check ‘Enable PR Comments Commands for this environment’. Optional: Set an alias for each environment in which you would like to run individual commands using an `-e` flag. This alias will be used as a unique environment identifier when running a command from your VCS provider.\ **Environment aliases may only contain letters, numbers, \_, and -.**\ Even without setting an alias, the environment will still be included when using `--all` or `--path` flags. ![Environment Settings showing Enable PR Comments Commands checkbox and alias field](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/c54b143-image.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=276a8e88be67fb4df87f1293c685b9e2) > [!WARNING] > > **Role Based Access** > > When this feature is enabled, anyone who can comment on the pull request can trigger a plan or an apply command, regardless of their role and access level in env zero, making your VCS provider determine the RBAC in this case. > > If you want to enforce PR commenter permissions based on env zero user permissions, jump to the [Enforce PR commenter permissions section](/guides/admin-guide/environments/plan-and-apply-from-pr-comments/#enforce-pr-commenter-permissions-on-env-zero). > [!NOTE] > > **Self-hosted VCS provider support** > > To enable this feature for GitHub Enterprise, Bitbucket Server and GitLab Enterprise, make sure your VCS Webhook is configured to send PR comments events. ## List of Affected Environments Every PR push will generate a PR comment, indicating which environments are affected by changes to this PR. An environment must enable the 'Enable PR Comments Commands for this environment' to be detected as affected, as described in the [Configuration](/guides/admin-guide/environments/plan-and-apply-from-pr-comments/#configuration) above. Below is an example of a comment which lists three affected environments and their full paths: ![PR comment listing three affected environments with their full paths in the repository](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/d12a257-image.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=e6314e151a5d475461d7e589ccf82a31) This comment is updated (edited) on every PR commit, so only a single comment will be shown in the PR. ## Supported env zero commands: ### env0 help command `env0 help` - Lists all available commands. ![PR comment showing output of env0 help listing all available commands](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/f8599b6-screenshot_2023-07-06_at_12.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=6666ac1c373d72db87792de213a6daea) ### env0 list command `env0 list` - Returns a list of all available environments and their aliases to plan and apply in env zero. ![PR comment showing output of env0 list with all available environments and their aliases](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/93bebff-env0_list_command.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=86cdbf61df09d847d4be0ee558a619b0) ### env0 plan command `env0 plan --all [-v {name=value}]` - Runs `plan` on all the affected environments listed in the `affected environments` comment above. `env0 plan --path "" [-v {name=value}]` - Runs `plan` on all the environments listed in the `affected environments` comment above whose full path matches the given [glob pattern path](https://en.wikipedia.org/wiki/Glob_\(programming\)). Use quotes `"` around the glob pattern if it contains spaces. `env0 plan -e {environments aliases} [-v {name=value}]` - Runs `plan` on a set of provided env zero environment aliases (comma-separated). ![PR comment showing deployment status after running env0 plan on affected environments](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/de7be33-env0_plan_command.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=fff8b395685ce5e82ee9523d231a36d2) ### env0 apply command `env0 apply --all [-v {name=value}]` - Runs `apply` on all the affected environments listed in the `affected environments `comment above. `env0 apply --path "" [-v {name=value}]` - Runs `apply` on all the environments listed in the `affected environments` comment above whose full path matches the given [glob pattern path](https://en.wikipedia.org/wiki/Glob_\(programming\)) . Use quotes `"` around the glob pattern if it contains spaces. `env0 apply -e {environments aliases} [-v {name=value}]` - Runs `apply` on a set of provided env zero environment aliases (comma-separated). ![PR comment showing deployment status after running env0 apply on affected environments](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/27d28e9-env0_apply_command.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=a5e49358841d2f48140d75f3ee33756d) > [!NOTE] > > **Requires Approval Behavior in env zero Apply** > > By default, applies triggered from PR comments are approved automatically. > > **Why?** > When using apply via PR comments, we assume that users rely on their existing VCS governance methods, such as: > > 1. Status checks > 2. PR approvals > 3. Branch protection rules > > You can override this behavior by enabling "Require approval for PR comment applies" in the `Organization Settings → Policies page`. > > Learn more about it [here](/guides/admin-guide/environments/plan-and-apply-from-pr-comments#require-approval-for-pr-comment-applies) > [!NOTE] > > **Specifying Environment Variables in plan and apply** > > To include multiple variables, use the following format: > > ```bash theme={null} > -v {name=value} -v {name=value} > ``` > > #### Use Case: Terraform Environment Variables > > This approach is especially useful for setting [Terraform environment variables](https://developer.hashicorp.com/terraform/cli/config/environment-variables#environment-variables). > > For example, you can utilize the `ENV0_TERRAFORM_TARGET` variable to perform [Target Resources](https://developer.hashicorp.com/terraform/tutorials/state/resource-targeting) deployments, as explained in the [Additional Controls](/guides/admin-guide/additional-controls/#terraform-targeted-apply): > > ```bash theme={null} > -v ENV0_TERRAFORM_TARGET=module.example_resource > ``` > [!WARNING] > > **Important Note on Persistent Variables** > > When setting a variable using: > > ```bash theme={null} > -v {name=value} > ``` > > This value will persist in the next deployment. > > For example, if you set `ENV0_TERRAFORM_TARGET`, subsequent deployments will continue to use the same target, which may be opaque to users and could lead to unexpected behavior. ## Apply Requirements The apply command also verifies that the pull request has the following requirements: 1. **GitHub** - We won't run the apply command if you have a protected branch in place and all the requirements are not met. You can read more about [protected branches here](https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/about-protected-branches). 2. **Bitbucket / Bitbucket Server** - We verify that at least one person who isn't the author of the PR approved the pull request, and that none of the participants requested changes. You can learn more about [reviewing a pull request](https://support.atlassian.com/bitbucket-cloud/docs/review-code-in-a-pull-request/) in Bitbucket and [declining a pull request](https://support.atlassian.com/bitbucket-cloud/docs/decline-a-pull-request/). 3. **Azure DevOps** - We won't run the apply command if you have required [branch policies](https://learn.microsoft.com/en-us/azure/devops/repos/git/branch-policies) checks that failed. > [!WARNING] > > **GitHub: Circular dependency with required `env0/Apply` status check** > > If you set the `env0/Apply` status check as a required check in GitHub branch protection, the PR will appear non-mergeable before apply runs, preventing the apply from executing. To resolve this, enable the [Bypass apply mergeability check](/guides/policies-governance/deployment-controls) policy. ## env0/Apply Commit Check When running `env0 apply --all` or `env0 apply --path `, a new `env0/Apply` commit check will be added on top of the individual deployment checks that you have per environment deployed. > [!TIP] > > If you want to make `env0/Apply` a required status check in GitHub branch protection, see [Bypass apply mergeability check](/guides/policies-governance/deployment-controls) to avoid a circular dependency with the apply mergeability requirement. ![GitHub commit checks panel showing the env0/Apply commit check alongside per-environment checks](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/ed776ba-image.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=51493ed9295672b4efceaaeca0d349fd) This commit check will show a `success` status once all the environments listed in the [affected environments comment](/guides/admin-guide/environments/plan-and-apply-from-pr-comments/#list-of-affected-environments) have been applied successfully. In case of failure in any of the deployments, the check's status will be set to `failure`. ![GitHub commit checks showing env0/Apply check with failure status when a deployment failed](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/7320e29-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=86fc82eb29b4743312292a84be0764ce) The check's status is calculated after every deployment of an environment listed in the affected environments comment. ## Enforce PR commenter permissions on env zero With env zero, you can restrict your users' permissions through [role-based access controls](/guides/admin-guide/user-role-and-team-management/rbac). One drawback of using PR Comment Plan and Apply is that the VCS provider determines your users' permissions. By default, anyone with comment permission on your repository can run a Plan or an Apply on your environments. Enforce PR commenter permissions on env zero is an organizational policy that lets you apply your env zero permissions to your VCS provider users. When turned on, env zero will validate that a user trying to run PR Comment Commands have adequate permissions. ### Turning on the policy for your organization Navigate to 'Organization Settings' then go to 'Policies' and check 'Enforce commenter permissions on env zero'. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/85b7ab9-pr_plan_policy.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=f5ffeff25200a7d6d0ccdd91fb5dbb3c) ### Map VCS provider user Now that the feature is turned on, every user across the organization who wishes to use the PR comments flow must set up a mapping of their VCS provider user.\ First you will need to get your VCS provider user ID from one of the supported VCS providers. ### Setting your VCS user in env zero Now that you have your VCS provider user ID, head over to your env zero account, click on the avatar image in the top right corner, and click on 'Personal Settings' to enter your profile page.\ In the VCS user ids tab, enter the ID from the previous step in the VSC Provider User ID textbox and click on the ‘Save’ button. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/efd62d423af68ffe01e1dbc13946cfbbf0916df9e011169df0644c621086a25d-image_6.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=f3a60190b0094d0b627a359ba2c0529a) ### GitHub While logged in to your GitHub account, click on your profile image in the right top corner of the page and copy your username. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/d7cae97-screen_shot_2023-02-23_at_14.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=a0bc082b0df4f890bd4abd320492aaff) ### Bitbucket While logged in to your Bitbucket user, visit [this URL](https://bitbucket.org/!api/2.0/user) from your browser. You will receive a JSON from which you will need to extract the `accound_id` field. ![Bitbucket API JSON response in browser showing the account\_id field to copy as VCS user ID](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/ed5026d-screen_shot_2023-02-23_at_16.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=820345ed7187a27a586009127cf25bc6) ### Bitbucket Server While logged into your Bitbucket Server account, go to your profile and locate the username by your avatar. ![Bitbucket Server profile page showing the username displayed next to the user avatar](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/480e929-screen_shot_2023-02-23_at_14.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=9bfcdeac7c870de8958c14b3ef9eb3fa) ### GitLab / GitLab Enterprise Edition While logged into your GitLab account, navigate to the ‘Profile’ tab and ‘Edit Profile’ or "kebab" menu to find and copy your user ID. ![GitLab Edit Profile page showing the user ID field to copy as VCS user ID](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/87b05a73e0b321414b32c6271f2c45aa9dd434a6ab9b61b5c449479cbe0abdc6-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=9db0e060d576c4af1d22a230b929fd82) ### Azure DevOps While logged in to your Azure DevOps account, click on your profile image in the right top corner of the page and copy your unique user ID. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/109df60-screenshot_2023-07-02_at_16.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=3a5279b09176044822e5800307cd7d71) > [!NOTE] > > **Additional Content** > > * [Alternative to Atlantis](https://www.envzero.com/alternatives/atlantis-alternative) > * [Migrating from Atlantis to env zero](https://www.envzero.com/blog/video-tutorial-how-to-migrate-from-atlantis-to-envzero) ## Status Checks for PR Comments env zero tracks the deployment status of your PRs directly from your Git provider's interface. This gives you visibility into deployment statuses and allows you to use checks in your CI pipeline to enforce successful infrastructure deployments. ![Git provider PR interface showing env zero deployment status checks for each environment](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/d0360f5-image.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=c5a1369206aaa945379708507623bf62) ## Require approval for PR comment applies To require approval for applies triggered by PR comments, you must enable the "Require approval for PR comment applies" policy in Organization Settings → Policies. With this policy enabled, running env zero apply will trigger a deployment that will wait for manual approval.\ Once the plan step finishes, the plan results will be posted as a comment on the PR: ![PR comment showing plan results posted after env0 apply with require approval policy enabled](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/2b0fa90d8c9af8629a430672a6ebca9ed03fe066c74232776afaebb897685531-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=306d094a056ed533f4fb3311103a7510) The environment’s Apply Commit Check and the Apply All Commit Check will remain “In Progress” until the deployment is either approved or canceled. ![GitHub commit checks showing env0 Apply check as In Progress while awaiting deployment approval](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/841a24810f3b06dbd75ccf50c79b095efaaa988b25bdf60e8f079c7f1f6aceb9-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=24f9ef11ecdca9d13b12ddad92b7c378) When running an apply that requires approval, we will not check if the PR is mergeable at this stage - that check happens when approving the apply. Additional Supported Commands (when the policy is enabled): ### env0 approve command `env0 approve --all [-v {name=value}]` - Runs `approve` on all the affected environments listed in the `affected environments` comment above. `env0 approve --path "" [-v {name=value}]` - Runs `approve` on all the environments listed in the `affected environments` comment above whose full path matches the given [glob pattern path](https://en.wikipedia.org/wiki/Glob_\(programming\)). Use quotes `"` around the glob pattern if it contains spaces. `env0 approve -e {environments aliases} [-v {name=value}]` - Runs `approve` on a set of provided env zero environment aliases (comma-separated). ### env0 cancel command `env0 cancel --all [-v {name=value}]` - Runs `cancel` on all the affected environments listed in the `affected environments` comment above. `env0 cancel --path "" [-v {name=value}]` - Runs `cancel` on all the environments listed in the `affected environments` comment above whose full path matches the given [glob pattern path](https://en.wikipedia.org/wiki/Glob_\(programming\)). Use quotes `"` around the glob pattern if it contains spaces. `env0 cancel -e {environments aliases} [-v {name=value}]` - Runs `cancel` on a set of provided env zero environment aliases (comma-separated). Both commands will only run for environments where the deployment awaiting approval was triggered from the same PR. When approving, a deployment summary will be posted back to the PR, and commit checks will be marked as successful. ![PR comment with deployment summary posted after approving an apply via env0 approve](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/566e32313b6e11190d53b1f2ea83520010c93cc04e1dc3339af8d7b076779846-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=484de2c0ae87e4f5b6324b9cd7ba58ec) ![GitHub commit checks updated to success status after approving the apply deployment](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/966609a60004ba80c0fea82cad58b7bc7ea9db73960b959872a11d6f643f7f31-image.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=462ea7092fa3a6503db4a0287692db98) Attempting to approve a deployment triggered from another PR will fail and post an error comment to the PR. ![PR error comment indicating the approval failed because deployment was triggered from a different PR](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/64c9065e88398060f1bbac1b8f60459270b731cadd9be5bddf7addccca8e8c71-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=bd3ff28f0d3769fdf3ed9c40dd23ceef) When canceling, commit checks will fail, and a Deployment Canceled comment will be added to the PR. ![GitHub commit checks showing failed status after an apply was canceled via env0 cancel](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/8020b6d588598170a428947e35a092b9a9f1d1339248211eb3f0c7c1c449f996-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=ad8c2547b0825f87bf214fc20f489300) ![PR comment showing Deployment Canceled message added after running env0 cancel](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/6dd172eba168b9d2a6e33458581a3fd00cb90a27cb89fc609bfca9a6c2d89481-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=d83b92d334504818adf7b77573bd7161) If you try to run an apply while another apply is already waiting for approval, the new deployment will be queued, and a PR comment will indicate this. ![PR comment indicating a new apply is queued because another apply is already waiting for approval](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/e03e2002678c1e38a853b911add7401618916c9de2653241e29ae0c9625224c5-image.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=e6a1e9abca232edfaf186cffa350194b) ![GitHub commit checks showing In Progress status for the queued apply deployment](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/0331158be031de5c87f307ace49d347052c34c37c525e5be3e0e477d50076d92-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=d29e18b7b49eb0ccb8824189f0b1f56a) ## Next steps * [Run a plan automatically on every pull request](/guides/admin-guide/environments/plan-on-pull-request) * [Connect your VCS provider](/guides/admin-guide/manage-vcs) if the repository is not connected to env zero yet # Running plan on pull requests Source: https://docs.envzero.com/guides/admin-guide/environments/plan-on-pull-request Automatically run a Terraform plan on every pull request to review infrastructure changes before merging, with results posted as a PR comment. ## Pull Request Plan in env zero env zero allows you to control and monitor your infrastructure code changes with pull request automation. When setting Pull Request Plan (PR Plan), your environment will automatically run a deployment consisting of only the Plan phase (without applying any infrastructure changes) and share the results with you via a comment on your pull request. Pull Request Plan will run on every push to an open pull request. ### For a PR Plan to run automatically, the following prerequisites must be met: 1. The environment has Pull Request Plan enabled 2. The environment originated from a VCS-integrated template, and its configured revision is the same as the branch (target) of the pull request * [GitHub Integration](/guides/admin-guide/templates/github-templates) - is the only VCS supporting forks (from private repositories only) ## Enable Pull Request Plan Go to your existing Environment in env zero and head to the Settings tab.\ Under Continuous Deployment, enable Run Terraform Plan on Pull Requests targeting this branch. ![Environment Settings Continuous Deployment section with Run Terraform Plan on Pull Requests checkbox enabled](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/ccf9004-screen_shot_2022-05-01_at_13.jpeg?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=cb49da250f2d9f92042d3e0279a68ab3) **You can choose to run by the following options:** * Any change - your environment will receive a PR Plan on every push to the repository. * Changes on Template Directory files - your environment will receive a PR Plan on every push that contains file changes under the Template folder * Changes by file filter pattern - your environment will receive a PR Plan on every push containing file changes by matching them to the pattern. See below how to configure the glob pattern. You can track the Deployment history for deployments by PR Plan type: ![Deployments tab filtered to show PR Plan deployment history entries](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/9ccc1dd-ee170a7-screen_shot_2020-11-23_at_17.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=1cc8f2c67528fcf8a459e7417af8e2af) > [!NOTE] > > **[Glob pattern](https://en.wikipedia.org/wiki/Glob_\(programming\))** > > Glob patterns specify sets of filenames with wildcard characters. For example, \*.txt or my\_folder/\*\* > > It means you can configure pattern by git repository which re-deploy environment only if the push contains files that change by free pattern. > > You can configure patterns by Git repository which re-deploy an environment only if the push contains files that change by free pattern. > > For example, to configure a pattern like src/project\_1/\*\* > you should re-deploy only if the push contains files that start with src/project\_1/... > > env zero also supports [extglob](https://github.com/micromatch/extglob?tab=readme-ov-file#extglob-cheatsheet) patterns. These allow you to write a pattern that ignores files or uses a list of folders. > > When using **OR/AND** statements with extglob, make sure to: > > * Wrap each option in parentheses > * Avoid unnecessary spaces - do not add spaces between the different glob pattern options > > Examples: > > * `!(third/path/\*\*)+(first/path/**|second/path/myfile.txt)` > This means we will match any change in first/path and second/path/myfile.txt, and ignore changes under third/path. (It is recommended to add exclusions first) > * `+(Terraform/!(prod)**|Terragrunt/dev/**)` > Match any changes in `Terraform` or `Terragrunt/dev` but ignore any changes in `Terraform/prod` > [!NOTE] > > **PR Plans Concurrency** > > PR Plans do not lock the Terraform state, and can be in parallel. If a bunch of PR Plans are queued in sequence, they will all run simultaneously. > [!NOTE] > > **Status Checks** > > When the PR Plan completes, aside from commenting with the plan itself, your commit will be marked with a passing status check. In case the PR Plan failed, the commit status will be failure. > > If the PR Plan doesn't run because the push didn't contain changed files, env zero will mark the latest commit as skipped ( if the Version Control supports it). Additional policy configuration can be found under [Do Not Report Skipped Status Check](/guides/policies-governance/deployment-controls). > [!NOTE] > > **PR Plans from Merge Commits** > > To control whether Merge Commits will trigger PR Plans, see [Skip PR Plan on Merge Commits](/guides/policies-governance/deployment-controls) ## Pull Request Comments env zero will make a comment on your pull request for three different reasons: 1. When a PR Plan has started: ![GitLab PR plan started](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/gitlab_pr_plan_started.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=23267354365dc3df3a7ec29ac1eb6900) GitLab ![Azure DevOps PR plan started](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/azure_devops_pr_plan_started.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=b4e68416b252caf29d2f9974e643e0af) Azure DevOps 2. When a PR Plan has finished successfully (full log is attached under Plan Details) ![GitHub PR plan finished successfully](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/github_pr_plan_finished_successfully.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=d93abf8acbca040d939f58146a45d685) GitHub ![GitLab PR plan finished successfully](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/gitlab_pr_plan_finished_successfully.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=72dee81feaca684ff7ad58c9a22c580d) GitLab ![Bitbucket PR plan finished successfully](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/bitbucket_pr_plan_finished_successfully.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=a04aee584651d9f1ecbab353f687bafb) Bitbucket ![Azure DevOps PR plan finished successfully](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/azure_devops_pr_plan_finished_successfully.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=99fc1970eb6569aa3017c86a401b274e) Azure DevOps 3. When a PR Plan has failed: ![GitHub PR plan failed](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/github_pr_plan_failed.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=8c1af48ac6012a13275b7e9fce44d7f7) GitHub ![GitLab PR plan failed](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/gitlab_pr_plan_failed.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=f602a6de583080682cf89e885b12ce56) GitLab ![Bitbucket PR plan failed](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/bitbucket_pr_plan_failed.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=dc6eb58bc1b8f04ec405b30c2315ab47) Bitbucket ![Azure DevOps PR plan failed](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/azure_devops_pr_plan_failed.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=2f22b39edc72171765007e2d973ded9b) Azure DevOps 4. Rerun a PR Plan: You can rerun a PR plan deployment. The newly created deployment will be an exact snapshot in terms of commits and code source of the original PR plan. ![Deployment page showing a Rerun button to trigger a new PR plan deployment from the same commit](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/c118443-screen_shot_2021-12-26_at_10.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=bae3723618226eb1b9a78f04e4f2d484) ## GitHub Commit Status Checks env zero will set a status check on the commit you want to merge in the pull request. The status will be changed to 'failed' when the run had failed to generate a Terraform plan, and 'successful' when a plan was generated. 1. When the PR plan is pushed to the queue: ![GitHub commit status showing PR plan queued and pending](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/054e702-screen_shot_2021-04-29_at_14.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=e757b20e6ad98846ea1bb80a6aed77b9) 2. When a PR Plan starts running (this will not happen [until you approve](/guides/admin-guide/environments/#approval-flow) the previous deployment): ![GitHub commit status showing PR plan is now running](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/04c2a82-screen_shot_2021-04-29_at_15.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=0cff7cb8de6a08ae23a7774271a10471) 3. When a Terraform plan was generated: ![GitHub commit status showing successful Terraform plan was generated](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/5c9aaa7-screen_shot_2020-12-30_at_16.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=ee7c9d9af89dfc5c6433d7f9a5ec6f77) 4. When the run was not able to generate a proper Terraform plan: ![GitHub commit status showing failed status when Terraform plan generation encountered an error](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/failed_terraform_plan_generation.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=8b6173b2b90d6321796d740bb82f49b7) 5. If you linked your PR to multiple environments you will get the summary of all the *PR Plans* ![GitHub commit status showing a summary of multiple PR plans from linked environments](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/a295a33-multiple_pr_plans.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=b6f9091ba6dd01ad3fa45fb23dc8293d) By clicking Details, GitHub will forward you to the Checks tab: ![GitHub Checks tab listing individual env zero deployment checks with pass or fail status](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/feac7f5-screen_shot_2020-12-30_at_16.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=72098c1f03bb16d23b8f894ae2cd0e81) Clicking View more details on env zero will take you to your environment on env zero ## GitLab Pipelines env zero will run set a GitLab pipeline and job status on the commit you want to merge in the merge request.\ The status will be shown as 'failed' when the run had failed to generate a Terraform plan, and 'successful' when a plan was generated. ![GitLab merge request with env zero pipeline status](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/gitlab_merge_request_with_env0_pipeline_status.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=b7ff41f8299a0740657e466b473f200e) A Merge Request and its associated env zero pipeline run status Clicking the pipeline on the Merge Request will reveal which env zero environment deployments were triggered and show their status. Clicking the status will take you back to env zero, where you can see more details on this automatic plan run. 1. When a PR Plan starts running, the commit will be labeled ‘in progress’: ![GitLab merge request commit status showing PR plan is in progress](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/75cca25-screen_shot_2021-05-10_at_11.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=4a6452581fca68a3499a4f5049e9c038) 2. When a Terraform plan was generated: ![GitLab merge request commit status showing successful Terraform plan generation](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/73800e2-screen_shot_2021-05-10_at_11.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=792f10f1183c6dc93d694140e764368a) 3. When the run was not able to generate a proper Terraform plan: ![Failed Terraform plan generation](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/failed_terraform_plan_generation.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=8b6173b2b90d6321796d740bb82f49b7) ## Bitbucket Commit Build Status env zero will set a status check on the commit you want to merge in the pull request. The status will be set to ‘failing’ when the run had failed to generate a Terraform plan, and ‘successful’ when a plan was generated. 1. When the PR Plan starts running, the commit will be labeled as ‘in progress’: ![Bitbucket commit build status showing PR plan is in progress](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/6af4b03-screen_shot_2021-05-10_at_10.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=378cd2c09cdf2a9fcd4aed30f7fbd9d9) 2. When a Terraform plan was generated: ![Bitbucket commit build status showing successful Terraform plan generation](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/621c48b-screen_shot_2021-04-08_at_14.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=a70f163cfcd78b98ed1c20016170e49e) 3. When the run was not able to generate a proper Terraform plan: ![Bitbucket commit build status showing failed status when Terraform plan could not be generated](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/bf38ff2-screen_shot_2021-04-08_at_14.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=378dfafb86383ea085ef3d80203c025b) ## Azure DevOps PR Status env zero will set a status check on your pull request.\ The status will be set to 'failing' when the run had failed to generate a Terraform plan, and 'successful' when a plan was generated. 1. When the PR Plan starts running, the PR status will be labeled ‘pending’. ![Azure DevOps PR status showing pending state while the PR plan is running](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/1c0d52d-image_6.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=3e3b348988e18eeeda2674e840ceeb52) 2. When a Terraform plan was generated: ![Azure DevOps PR status showing successful Terraform plan generation](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/032fcd0-image_7.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=5b90873602e66261e67aaacd3ba0ed23) 3. When the run was not able to generate a proper Terraform plan: ![Azure DevOps PR status showing failing state when the Terraform plan could not be generated](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/d26915b-image_10.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=4281990ab754d3a88c8e5f8b892b1b68) ## Rerun a PR Plan You can rerun a PR Plan deployment on the deployment page.\ The newly created deployment will be an exact snapshot of the commits and code source of the original PR Plan.\ This will recreate the comment on the PR and the status checks. ![Deployment page showing Rerun button to recreate a PR plan from the same commit snapshot](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/dca11de-screen_shot_2021-12-26_at_10.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=df8159c1f39fbc863c7b799b74061abe) ### Deployment Comment When a PR Plan is triggered, a comment will be added in env zero, linking to the PR. ## Suggested Content [Do Not Report Skipped Status Check](/guides/policies-governance/deployment-controls) [Skip PR Plan on Merge Commits](/guides/policies-governance/deployment-controls) [Terraform Modules Guide](https://www.envzero.com/blog/terraform-modules) [Terraform Plan Examples](https://www.envzero.com/blog/terraform-plan) [Migrating from Atlantis to env0](https://www.envzero.com/blog/video-tutorial-how-to-migrate-from-atlantis-to-envzero) [Alternative to Atlantis](https://www.envzero.com/alternatives/atlantis-alternative) ## Next steps To deploy from the pull request once the plan looks right, [plan and apply from PR comments](/guides/admin-guide/environments/plan-and-apply-from-pr-comments). # Environment promotion strategies Source: https://docs.envzero.com/guides/admin-guide/environments/promotion-strategies Plan how to promote infrastructure changes across environments in env zero using branch-based or folder-based strategies with automated or manual approvals. env zero supports any branching or folder structure you currently use to manage environment promotion. This page covers the two most common patterns and how env zero handles each. ## Branch-based promotion If your team uses separate branches for each environment stage (for example, `dev`, `staging`, `prod`), each branch maps to its own env zero environment. Merging from one branch to the next triggers the promotion. Set each environment to use [continuous deployment](/guides/admin-guide/environments/continuous-deployment) targeting its branch. Add an [approval policy](/guides/policies-governance/approval-policies) to the production environment to require a manual sign-off before the apply runs. ## Folder-based promotion If your team uses a single branch with separate directories for each environment (for example, `envs/dev/`, `envs/staging/`, `envs/prod/`), each directory maps to its own env zero template. Use the [file filter pattern](/guides/admin-guide/environments/continuous-deployment) in the continuous deployment settings to scope each environment to its folder. ## Automated promotion [Workflow triggers](/guides/admin-guide/environments/workflow-triggers) let you chain environments so that a successful apply in one environment automatically triggers a plan or apply in the next. Use this to build a promotion pipeline that runs without manual intervention for lower-environment changes. ## Manual approval gates For production or sensitive environments, [approval policies](/guides/policies-governance/approval-policies) pause the deployment after the plan step. Reviewers see the full plan output before approving or denying. Policies can be written in OPA to approve automatically based on cost thresholds, resource type, or tag compliance, and escalate to manual review only when thresholds are exceeded. # Deployment scheduling Source: https://docs.envzero.com/guides/admin-guide/environments/scheduling Schedule automatic deploys and destroys for env zero environments using UNIX cron expressions, with options for recurring actions and TTL interaction. ## What is Scheduling? Scheduling allows you to automatically trigger destroys and deploys of your environments on a scheduled basis. Scheduling is configured based on cron expressions, and can be attached to an already deployed environment only. > [!NOTE] > > **Scheduling vs TTL** > > Scheduling is an advanced feature that can't coexist with the simpler [TTL policy](/guides/policies-governance/policy-ttl) of your environment. Enabling scheduling for your environment will disable any existing TTL setting of your environment. > > It's also important to notice that TTL policies don't apply on any scheduled recurrences. ## Who Can Configure Scheduling The minimum role for setting a scheduled action for an environment is [Project Deployer](/guides/admin-guide/user-role-and-team-management/user-management/#project-roles). ## How To Configure Scheduling After deploying your environment, click on **Settings** tab, on \*\*Environment Details \*\*page and scroll down to the **Scheduling** card. ![Environment scheduling configuration interface](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/environment_scheduling_configuration_interface.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=268dc1249ec68fdd7e7f21913724d409) To configure scheduling for your environment: 1. Check the box for the required action (either *Deploy* or *Destroy*) 2. Input a valid [UNIX cron expression](http://www.nncron.ru/help/EN/working/cron-format.htm) (Optional Year suffix isn't supported).\ For example: `0 23 * * MON-FRI` (UTC timezone) 3. Press **Save**. The environment is now scheduled! You may notice that the environment's countdown indication has changed per your next schedule: ![Scheduled environment countdown display](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/scheduled_environment_countdown_display.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=f9a60a55a613abad19664e2a576ce8a8) ## Next steps To pause scheduled deploys and destroys for a while, [lock the environment](/guides/admin-guide/environments/environment-locking). They resume once you release the lock. # Creating a new environment Source: https://docs.envzero.com/guides/admin-guide/environments/setting-up-a-new-environment Create a new env zero environment from a template with RBAC controls or direct VCS integration for Terraform, OpenTofu, Helm, and other IaC frameworks. env zero provides two approaches for creating a new environment: 1. Based on a pre-defined [Template](/guides/admin-guide/templates) 2. Based on a direct VCS integration env zero Templates allow reusability and RBAC, however in some cases you may want to connect to your VCS directly without using Templates to avoid unnecessary complexity. Both approaches will result in a complete env zero environment with all of the available features so you can choose the approach that most fits your style and use case. > [!NOTE] > > **Permissions** > > If you are a *project planner* - you must select a template for the new environment. > > If you are an *organization admin* - you will be prompted to select between **Template** / **VCS**. > > To enable Environment creation based on VCS integration for non organization admins, create an Organization Role with the **Create & Edit Templates** permission. Users may have to log out and log back in to deploy see the modal to deploy an Environment without a Template. > Organization -> Settings -> Roles -> (Create or update an existing role with the permission) To create a new environment, all you have to do is choose a specific *Project* and click on the **CREATE NEW ENVIRONMENT** button (located in the top right corner). ![Project environments page with CREATE NEW ENVIRONMENT button in the top right corner](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/3330de8-screen_shot_2022-04-20_at_16.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=3967a9d011472dd7dcaec15537f94eb5) ## Based On a Pre-defined Template This choice is great for you if you want to use env zero templates with all of their benefits. To run an environment based on a pre-defined template, follow these short instructions: 1. Select your desired [Template](/guides/admin-guide/templates). 2. Set environment details: environment name, workspace name (optional - only for Terraform), [Time To Live (TTL)](/guides/policies-governance/policy-ttl) , [Variables](/guides/admin-guide/variables) and [Terragrunt Working Directory](/guides/admin-guide/environments/#terragrunt-working-directory) (only refers to Terragrunt Templates, optional). ## Based On a Direct VCS Integration This choice is great for you if you don't want to overwhelm yourself with env zero templates - connect to your VCS and deploy. To run an environment based on a direct VCS integration, follow these short instructions: Select one of the many supported IaC types. ![New environment dialog showing supported IaC type options to select from](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/7b5f5e3-image.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=11f604e20fbda2d5590083bbf7fb0d3d) Select one of the many supported Git repositories. ![New environment dialog showing supported Git repository providers to connect](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/0f48f43-2022.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=a4ae511e9ccd8e326ae6a01fb2a4be59) Once a Git repository has been selected a new window will load, asking you to authenticate to that git account. This will install the env zero application as a trusted source to read/write to your chosen repositories. ![Git authentication prompt asking you to install the env zero app as a trusted source on your repositories](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/aec2cb5-2022.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=146280bcf2894777a15f4eb39039d996) Add any Terraform or environmental variables you may want on the next screen. Set the environment details and options. ![New environment configuration screen with fields for environment details, variables, and deployment options](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/62d4666-2022.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=1bc214d731f465cb214e46222c86573f) Click done to complete the environment creation and run your first deployment. > [!TIP] > > **Import existing environment (for Terraform only)** > > You may import an existing Terraform environment by specifying the *Workspace Name* > [!NOTE] > > **Auto deploying created Environment** > > The default behavior in env zero is to automatically deploy a created environment. > > In case you would like to create the environment without deploying, you can use the [create environment API](/api-reference/environments/create-environment) and set the `preventAutoDeploy` param to `true`. > > This is also supported in our [Terraform Provider](https://registry.terraform.io/providers/env0/env0/latest/docs/resources/environment) ## Next steps To redeploy the environment automatically whenever its branch changes, [turn on continuous deployment](/guides/admin-guide/environments/continuous-deployment). # Environment Tags Source: https://docs.envzero.com/guides/admin-guide/environments/tags Tag env zero environments with key-value pairs, then find them by tag in Explorer or the project environments list and act on them in bulk. Tags are key-value metadata you attach to an environment, for example `team=payments` or `cost-center=1042`. Use them to record ownership, cost attribution, or any other classification your project hierarchy does not express, then find environments by tag and act on them in bulk. A tag key holds one or more values. An environment tagged `team=payments` and `team=platform` carries one key with two values, and each pair renders as its own chip. Project tags are a separate, simpler feature: plain labels with no keys and no values. > [!WARNING] > > Anyone who can view an environment can read its tags. Do not put secrets or personal data in tags. Use [variables](/guides/admin-guide/variables) for values that must stay hidden. ## Limits | Constraint | Value | | - | - | | Key-value pairs per environment | 50. A key holding three values counts as three pairs. | | Key length | 1 to 128 characters | | Value length | 1 to 256 characters | | Allowed characters | Letters, digits, spaces, and `_ . : / + - @`. `=` and `,` are not allowed in a key or a value. | | Values within a key | Must be unique | Editing tags requires the **Edit Environment Settings** permission, the same permission that gates every other environment setting. Without it, the environment's tags are shown as read-only chips. ## Edit an environment's tags **1. Open the environment's settings** From the **Project Environments** tab, click the environment, then open the **Settings** tab and scroll to the **Tags** card. **2. Add a tag** Click **+ New tag** and type the key in the left field. **3. Add values** In the values field, type a value and press Enter. Repeat for as many values as the key needs. Values already used with that key elsewhere in your organization appear as options, and **Add all** applies every one of them at once. **4. Save** The counter under the editor shows how many of the 50 pairs you have used. Click **Save** to apply the changes. Click the trash icon on a row to remove a tag and all of its values. Invalid rows are highlighted with the reason, and saving is blocked until they are fixed. ## Find environments by tag Tags appear in two places, and each one searches differently. ### Project environments list Each environment card shows up to four tag chips, with a `+N` chip for the rest. The search box at the top of the list matches tags along with names, templates, and statuses, so typing `payments` returns environments tagged `team=payments`. ### Explorer The [Explorer](/guides/cloud-analyst/cloud-analyst/explorer) table has a **tags** column with its own filter. Open the filter and tick one or more `key=value` pairs, and the table narrows to environments carrying any of the ticked pairs. The filter has a search box, so you can type to find a pair in a long list. Explorer covers every active environment in your organization across projects, and its filter selection persists in the page URL, so a tag-filtered view is a link you can share. > [!NOTE] > > Explorer lists active environments. To find tags on inactive environments, use the [API](/api-reference). ## Add and remove tags in bulk The [bulk operations](/guides/admin-guide/environments/bulk-operations) wizard has two tag commands. Filter Explorer by tag, or select environments from the project environments list, then click **Perform Action** and pick a command. **Add Tags** applies the same tags to every selected environment. Fill in keys and values with the same editor used in environment settings. A key that already exists on an environment has its values replaced, and keys you do not list are left untouched. **Remove Tags** takes a list of keys and removes each one from every selected environment, values and all. A key an environment does not carry is skipped. Both commands require the **Edit Environment Settings** permission on each selected environment. The wizard's summary step marks environments you cannot edit with a failure icon and skips them. The rest of the selection is processed. ## Next steps To deploy, redeploy, or destroy a single environment, see the [environment overview](/guides/admin-guide/environments). # Performing targeted deployments Source: https://docs.envzero.com/guides/admin-guide/environments/targeted-deployments Deploy specific Terraform resources or modules in env zero using targeted deployments via the UI, API, or ENV0_TERRAFORM_TARGET environment variable. > [!WARNING] > > Use Resource Targeting with Caution > > Resource targeting (e.g., using `-target` during planning or applying) can lead to unintended consequences by modifying only a subset of your infrastructure, potentially leaving resources in an inconsistent state. > > For more details, refer to the [OpenTofu documentation on resource targeting](https://opentofu.org/docs/cli/commands/plan/#resource-targeting). Targeting resources and modules allows us to pinpoint exactly what needs to be changed instead of deploying a whole environment. Such selective deployments minimize risks associated with broader changes, ensuring that updates are precise and efficient. This precision is useful for testing, enabling quicker iterations and focused debugging. With Targeted Deployments, teams can confidently experiment with changes, minimizing risks and streamlining development workflows. ## Supported versions Targeted deployments are not supported on [self-hosted agents](/guides/admin-guide/self-hosted-kubernetes-agent/overview) prior to version `3.0.611`. However, the `ENV0_TERRAFORM_TARGET` environment variable can still be used. ## Using Resource Targeting Below are all the different ways in which targets could be specified. > [!NOTE] > > **Combining Target Inputs** > > More than 1 option could be used at a time. > > env zero will take into account all the different definitions of targets, and combine them. ### Using the UI Whenever you deploy or [redeploy](/guides/admin-guide/environments#redeploy-an-environment), you can open the `Targeted Resources` section. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/62f8232-screenshot_2023-12-25_at_15.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=a771086aec577d7a0159130d9106eebe) Then choose modules and resources using the autocomplete below. > [!NOTE] > > **Adding a Custom Target** > > The list of resources contains resources from the latest deployment. > > So when adding new resources, they won't be present in the list - but only after they're deployed. > > If you want to target new additions, you need to add them manually by typing their full address, and hitting `Enter` ### Using the ENV0\_TERRAFORM\_TARGET variable Another option is to use the `ENV0_TERRAFORM_TARGET` [control variable](/guides/admin-guide/additional-controls#terraform-targeted-apply). Set the environment variable, separated with commas for multiple values, and it will be directly converted to `-target` flags. ```bash theme={null} ENV0_TERRAFORM_TARGET="resource1,resource2" ``` Since this is an environment variable, targeting persists as long as the variable is defined. ### Using the TF\_CLI\_ARGS\_plan variable The `TF_CLI_ARGS_plan` is nifty for forcing flags and arguments to commands.\ Providing a list of targets for `TF_CLI_ARGS_plan` would therefore take effect over deployments in env zero. ```bash theme={null} TF_CLI_ARGS_plan="-target=resource1 -target=resource2" ``` > [!WARNING] > > TF\_CLI\_ARGS\_apply > > Note - the `TF_CLI_ARGS_apply` will NOT take effect since env zero runs your plan behind the scenes. Hence, it is recommended to either be used with the same value as `TF_CLI_ARGS_plan`, or not be used at all. Since this is an environment variable, targeting persists as long as the variable is defined. ## Viewing Targeted Resources After executing a targeted deployment, you can go to the deployment page and click on the `Targeted Resources` field. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/RwbdEslsc74czQBG/images/guides/admin-guide/environments/8fee802-screenshot_2023-12-25_at_15.png?fit=max\&auto=format\&n=RwbdEslsc74czQBG\&q=85\&s=2812956165acef89796ebae5c27f969d) And the full list of targeted resources and modules will pop up ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/T2JW_alZSK9mPIUs/images/guides/admin-guide/environments/75e4c8a-screenshot_2023-12-25_at_15.png?fit=max\&auto=format\&n=T2JW_alZSK9mPIUs\&q=85\&s=473fbd57e2e928ce33ab25f3babf93fe) ## Next steps To run a one-off state command such as `terraform state mv` without a full deployment, use [ad hoc tasks](/guides/admin-guide/environments/ad-hoc-tasks). # Configure workflow triggers Source: https://docs.envzero.com/guides/admin-guide/environments/workflow-triggers Configure chained environment deployments in env zero using workflow triggers, defining dependent environments that deploy after an upstream success. ## Workflow Triggers in env zero env zero allows you to configure chained dependent environments to your current environment. Using workflow triggers, you can define which environments would trigger a deployment downstream in response to a deployment of your current environment. This allows you to configure a cascading series of environment deployments. Workflow triggers can be configured by [Project Deployers](/guides/admin-guide/user-role-and-team-management/default-roles#project-deployer) and are viewable to all users. > [!NOTE] > > Workflow triggers are operational only upon a **successful deploy** (and not destroy) and can be set only to an [active environment](/guides/admin-guide/environments#environment-status). (i.e the *triggered environment* must be active) ## How to set Workflow Triggers Go to your existing **Environment** in env zero, and head over to the **Settings** tab.\ Under the **Workflow Triggers** card you can see a table that consist of all the triggered environments. * To add a new workflow trigger, use the *Add New Trigger* dropdown to select any active environment in your project. * To remove an existing workflow trigger, use the Trash icon next to the relevant trigger. Hit *Save* to persist your changes. ![Workflow triggers configuration interface](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/environments/workflow_triggers_configuration_interface.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=1b10520473743bf9c24806276f5c686e) Workflow Triggers Card ## Next steps * [Deploy on every push](/guides/admin-guide/environments/continuous-deployment) so a commit starts the chain * [Orchestrate environments with a workflow](/guides/admin-guide/workflows) when the dependency graph should live in one file # Product homepage Source: https://docs.envzero.com/guides/admin-guide/homepage Navigate the env zero homepage to review failed, drifted, or approval-pending environments and view Cloud Compass infrastructure coverage insights. env zero's Homepage is designed to provide a high-level overview of your organization, making it easier to find what matters most. ![env zero homepage showing Needs Review, Recently Updated Projects, and Insights sections](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/f7bd71bff885dbaa45b94f942e6e1e5561e25e08874cff4e61e11dffab8ac7b8-image.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=67bb1b1121ccf462ee08846cf4a5a39a) ## Needs Review section This section helps you find [Environments](/guides/admin-guide/environments#environment-status) that require your attention. The list features Environments whose status is either Failed, Waiting for Approval, or [Drifted](/guides/admin-guide/environments/drift-detection). You may filter the list by projects or templates of interest, and navigate to the relevant environment page by clicking its name. `Review` will take you to the latest deployment log page, or to the list of deployments in case of drifts, so you can take relevant action such as approving a plan, investigating a failure reason, or checking what caused a drift. ![Needs Review section listing environments with Failed, Waiting for Approval, or Drifted status](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/30ce38eb2d92fc0c3dcb3ec4b645dcc3b0b0461370ad7ff628db154f1163a35b-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=262cc1591e2e22ebd05ff1d5ebc686d6) ## Recently updated Project section To quickly pick up from where you left off in env zero, in this section you'll see the last three [projects](/guides/admin-guide/projects) you've updated within the app. Updates refer to anything from deploying an environment, and changing a setting, to editing variables and more. Each project card shows the project’s name, hierarchy, and how many active environments are part of it. ![Recently Updated Projects section showing the last three projects with name, hierarchy, and active environment count](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/bf3e3a57d10a8078b330e33893d6270e2db6f1da3756748a8b3e0d7541363de1-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=45047ced5731a46ad4608803f4e6f844) ## Insights section The two dashboards in this section give you a better understanding of your organization's infrastructure state: * The environments chart shows the amount of managed environments, and the percentage of each status (active, failed, waiting for approval, etc.) * The IaC Resources Trend chart provides IaC Coverage insights from [Cloud Compass](/guides/cloud-compass/cloud-compass#insights)\ You can navigate to more detailed [dashboards](/guides/admin-guide/dashboards) of your organization and Cloud Compass by clicking the button under each chart. ![Insights section showing environments status chart and IaC Resources Trend chart from Cloud Compass](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/37d1ea18d3038db68d70408ab4ede28edd43635cac3549ba21a4d62bc9b0f508-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=79bd1f319f717f766d6fa56ea52f3004) > [!NOTE] > > **Permissions** > > This section is available only to users with `View Dashboard` [permissions](/guides/admin-guide/user-role-and-team-management/custom-roles#organization-permissions). ## Feedback We’d love your feedback about our Homepage and any ideas to improve it – you can find the feedback button at the top of the page. ![Feedback button at the top of the env zero homepage](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/3b6eea65d0819685cb3a36424f7e8039c8cfb0f6ddb92d50995793daefd29eb8-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=4e2c820dd3d245a194aa74865978f524) ## Persistent state Your latest filters, selected cloud account, and recently updated projects are saved locally for easier and personalized usage. # Git and VCS integration Source: https://docs.envzero.com/guides/admin-guide/manage-vcs Connect Git repositories and VCS to env zero - including GitHub, GitLab, Bitbucket, and Azure DevOps - for automated IaC deployments and GitOps workflows. env zero connects directly to your Git repository to trigger infrastructure deployments. env zero enables teams to connect their code repositories. This connection keeps your infrastructure code in sync by automatically updating env zero whenever your repository changes. This means less manual work, consistent environments, better tracking of changes, and improved teamwork between developers and operations. Integrating your VCS is a key enabler of a GitOps workflow. For example, env zero's Pull Request (PR) plans automatically trigger a plan for your infrastructure code whenever changes are committed. This allows teams to continue using their familiar tools while env zero enhances their Infrastructure as Code (IaC) processes with features like PR plan/apply via comments and Continuous Deployment. These capabilities automate PR plan triggers, generate pull requests for review, and apply updates to your infrastructure. Continuous Deployment further simplifies workflows by automatically redeploying and executing the complete IaC lifecycle - initializing, planning, and applying - with each code commit. This results in faster iteration within testing environments and reduces the need for manual reviews. **With VCS integration, you gain access to all these capabilities**: * [Plan on Pull Request](/guides/admin-guide/environments/plan-on-pull-request) * [Continuous Deployment](/guides/admin-guide/environments/continuous-deployment) * [PR Comments Commands](/guides/admin-guide/environments/plan-and-apply-from-pr-comments) * [Module Registry](/guides/admin-guide/private-registry) * [Project-level custom flow](/guides/admin-guide/custom-flows/project-level-custom-flow) * [Approval Policies](/guides/policies-governance/approval-policies) * [Create a pull request (Code Generation)](/guides/policies-governance/drift-detection-policy) env zero integrates with several popular Version Control System (VCS) providers to bring you the benefits of GitOps for your Infrastructure as Code. Currently, env zero natively supports: * [GitHub](/guides/admin-guide/templates/github-templates) * [GitLab](/guides/admin-guide/templates/gitlab-integration) * [Bitbucket](/guides/admin-guide/templates/bitbucket-integration) * [Azure DevOps](/guides/admin-guide/templates/azure-devops-integration) * [GitHub Enterprise Server](/guides/admin-guide/templates/github-enterprise-integration) (Self-Hosted) * [Bitbucket Data Center (Server)](/guides/admin-guide/templates/bitbucket-server-integration) (Self-Hosted) * [Offline GitLab ](/guides/admin-guide/templates/gitlab-enterprise-integration) (Self-Hosted) * [Git Server](/guides/admin-guide/templates/#manage-git-connectivity) (Self-Hosted) - This basic integration allows actions like git clone, but does not support advanced features such as automated PR plans or Continuous Deployment. > [!WARNING] > > VCS Self-hosted - Connecting to self-hosted version control systems requires deploying and running the [VCS Agent](/guides/admin-guide/self-hosted-kubernetes-agent/standalone-docker-agent/#running-a-vcs-agent-for-on-prem-/-self-hosted-vcs) ## Centralized Management All your VCS integrations can be managed and configured under the Organization settings. Go to your Organization Settings and select the VCS tab. From there, you can edit existing connections or create new ones. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/63cf466a617518ea407f6eff7e2ea21e4b132264a525c4d59a212bb4fc30b184-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=9388bf379c3d6fdd2b78eccb5ec3ff74) 1. In this modal, select the relevant VCS provider. Options are separated into Cloud and Self-Hosted categories. 2. Choose **[env zero Access](/guides/admin-guide/manage-vcs/#connection-types)** 1. If you see the label 'Not Configured,' it indicates that this connection has not yet been saved in env zero. 3. Choose **[Authentication Type](/guides/admin-guide/manage-vcs/#authentication-types)** 1. Each VCS supports different Authentication Types. If only one option is available, it will be selected by default. 4. Provide the necessary authentication information. 5. Click 'Save Connection' to save these details to env zero. 1. Remember to click 'Save' to apply any changes you make to the VCS connection. ### VCS Actions Within this modal, please confirm that the appropriate connection type is chosen. Additionally, you can perform the following actions: * Delete Connection * Deleting the connection here will remove all related details from env zero. To revoke access from the VCS itself, you'll need to do so within your VCS provider's settings. * Display connection health * Display Available Repositories * [Display Webhook Settings](/guides/admin-guide/templates/self-hosted-vcs#configure-webhook-integration) - These are the settings you need to configure within your self-hosted VCS to enable automatic triggering of features. ### Connection Types > [!NOTE] > > **Repositories Access** > > For any connection type, you can specify which repositories env zero can access. For example, you might grant env zero access to both `repoX` and `repoY` for deployments, but limit code writing access to only `repoX`. * **Deployment** * Using this connection, env zero can deploy resources for your organization and enable all the features offered by CI/CD and governance. Available for all supported VCS providers. * **Code Write** * This connection allows env zero to commit code changes and generate AI-driven pull requests on your behalf. This capability powers features such as automatically creating pull requests to synchronize cloud environment changes with your code repository. Available for GitHub and Self-Hosted VCS providers. ### Authentication Types * **OAuth** * When you click the 'Grant Access' button, a pop-up window will appear. You'll need to authorize env zero to access your resources. After the pop-up closes (if successful), click 'Save Connection'. * **By VCS Agent** * You need to have an active [VCS Agent running](/guides/admin-guide/templates/self-hosted-vcs#configure-vcs-agent-proxy). Then, provide the VCS URL and select the specific VCS Agent that env zero should connect to. ## Look up a connection in Terraform Use the [`env0_vcs_connection`](https://registry.terraform.io/providers/env0/env0/latest/docs/data-sources/vcs_connection) data source to reference an existing connection from the [Terraform provider](/guides/community-and-resources/support-and-help/terraform-provider). Set `access_scope` to the connection's scope as shown under **Organization Settings** > **VCS**, and `connection_type` to `DeploymentPipeline` or `CodeWrite` (see [Connection types](#connection-types)). ```hcl theme={null} data "env0_vcs_connection" "github" { access_scope = "Organization:" connection_type = "DeploymentPipeline" } resource "env0_template" "example" { name = "example" repository = "https://github.com//" type = "terraform" vcs_connection_id = data.env0_vcs_connection.github.id } ``` The `access_scope` format depends on the VCS provider. See the [data source reference](https://registry.terraform.io/providers/env0/env0/latest/docs/data-sources/vcs_connection) for each format. # Manage organizations Source: https://docs.envzero.com/guides/admin-guide/organizations Set up and manage organizations as the top-level entity for projects, templates, variables, and policies in env zero, including SSO configuration. ## What is an organization? An *Organization* is the highest level logical entity in env zero. All *Projects*, *Templates*, *Variables*, *Policies*, and *Environments* are defined for a specific organization. Organizations are logically separate from each other, and do not share any entities. Most users belong to a single organization, but they can be a member of several organizations, with different roles and permissions for each one. An organization is the highest level scope for settings such as [Variables and Secrets](/guides/admin-guide/variables), and [Policies](/guides/policies-governance/policies). Only users with *administrator* role in an organization, can change the settings or invite new users for that organization. ## Select the active organization Users in env zero have one *Active Organization*. This is shown at the upper left of the screen. To change the Active Organization, click the organization name, and then select an organization from the list. ## Join an organization A user can join an organization in the following ways: * When joining env zero the user is added to the env zero Demo Organization. * By invitation, from an organization administrator. * By creating a new organization, in which case the user becomes the first user and administrator for the new organization. * Through Single Sign-On (SSO), if configured for the organization. Users authenticating via SSO are automatically provisioned with appropriate roles. ## Create an Organization To create a new organization, click *Active Organization* at the upper right, and then click *Create Organization*. Enter a name, description (optional), and URL for the organization logo (optional).\ You can edit these settings later. Once the organization is created, it automatically becomes the *Active Organization*. You can add a user to the organization in the *Settings* tab. ## Organization Settings *Organization* is the highest scope for configuration in env zero. All other entities inherit the organization's settings. Only a user with the *administrator* role can view or edit the organization settings. To edit the settings, select the *Settings* tab at the upper left. Organization settings include name and logo, user management, SSO configuration, API Key management, and policies. *Variables* configuration is accessed in the *Variables* tab and is accessible to non-administrator users as well. ## Finding my Organization ID Sometimes you may need your organization ID for various reasons. Here's how you can find it: 1. Click on your organization icon in the bottom left corner 2. Select `Settings` from the left side panel 3. Go to the `General` tab under `Organization Settings` 4. Copy the Organization `ID` as shown in the screenshot below ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/c982227f0a1d55883c693dc85deea22d71e79e638bbff4193535b10ecaade6e0-cleanshot_2024-09-29_at_5.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=0b1f3b4a28aa6150f7643fc9f854c16d) ## Single Sign-On (SSO) Organizations can configure Single Sign-On to authenticate users through an external identity provider. This enables centralized user management, enforces your security policies, and meets enterprise compliance requirements. SSO can be configured directly from Organization Settings > SSO tab. See [Self-service SSO integration](/guides/sso-integrations/self-service-sso) for setup instructions. ## Next steps * [Create a project](/guides/admin-guide/projects#create-a-project) to separate environments and their access rights * [Group users into teams](/guides/admin-guide/user-role-and-team-management/teams#creating-a-team) # Private registry Source: https://docs.envzero.com/guides/admin-guide/private-registry Host and manage private Terraform modules and providers in the env zero registry, with automated authorization during deployments and API key access. env zero offers a private registry solution for both your Terraform [modules](/guides/admin-guide/private-registry/modules) and [providers](/guides/admin-guide/private-registry/providers). You can access your organization's registry by clicking on the `Registry` link on the side navigation bar: ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/9923c0d-registry.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=42fc58173c5bd732e32dcb8aa403f6af) ## Authorization When running private modules or providers, Terraform will have to authorize you to ensure you have read access to them. When deploying through env zero, we will take care of this authorization for you. ### Local Usage If you’d like to run Terraform code that uses a private registry, you will need to supply the authentication details to Terraform. These must be supplied in a file called `terraform.rc` (for Windows) or `~/.terraformrc` (other systems). #### Manually setting the token ##### Option 1 - Terraform rc file You can use an API Key (obtained from your [organization's Settings page](/guides/admin-guide/organizations/#organization-settings)). The API key must be entered into the terraform rc file like this: ```hcl theme={null} credentials "api.env0.com" { # A valid Basic authentication header value, using your env zero API Key ID and Secret token = "Basic base64-encoded(api-key-id:api-key-secret)" } ``` Here's an example of how to generate your token (in a Mac terminal) ```bash theme={null} export ENV0_API_KEY={replace with your key} export ENV0_API_SECRET={replace with your secret} echo -n $ENV0_API_KEY:$ENV0_API_SECRET | base64 ``` Your \~/.terraformrc should look something like this. > [!NOTE] > > ```bash theme={null} > cat ~/.terraformrc > credentials "api.env0.com" { > # A valid Basic authentication header value, using your env zero API Key ID and Secret > token = "Basic " > } > ``` > [!WARNING] > > The .terraformrc file must be stored in the home directory (\~/) These instructions are also available in the Instructions tab of the module or provider page. ##### Option 2 - TF\_TOKEN\_api\_env0\_com > [!WARNING] > > This setting is only supported for Terraform Version 1.2+ Use an environment variable named `TF_TOKEN_api_env0_com`. You can retrieve the encoded token when you [create a new API key](/guides/admin-guide/user-role-and-team-management/api-keys#how-to-create-an-api-key), or you can generate and assign the API with the following example. See: [Terraform - Environment Variable Credentials](https://developer.hashicorp.com/terraform/cli/config/config-file#environment-variable-credentials) ```bash theme={null} export TOKEN=$(echo -n "$ENV0_API_KEY:$ENV0_API_SECRET" | base64) export TF_TOKEN_api_env0_com=$TOKEN ``` #### Terragrunt Authentication When using [Terragrunt](/guides/admin-guide/templates/terragrunt), you will also need to set the `TG_TF_REGISTRY_TOKEN` environment variable to the encoded authentication value: ```bash theme={null} export TOKEN=$(echo -n "$ENV0_API_KEY:$ENV0_API_SECRET" | base64) export TG_TF_REGISTRY_TOKEN=$TOKEN ``` ## Next steps After you publish modules, [track their adoption](/guides/admin-guide/private-registry/modules/module-usage) across your environments. # Module overview Source: https://docs.envzero.com/guides/admin-guide/private-registry/modules Share Terraform and OpenTofu modules with the env zero private module registry, with VCS-backed publishing, version control, and organization-wide access. ## env zero Module Registry The env zero Module Registry is a private registry for sharing and reusing [OpenTofu/Terraform modules](https://www.terraform.io/docs/language/modules/syntax.html), within your organization. You can access your organization's module registry through the Registry tab in the Organization Menu. Using env zero's private registry enhances security by ensuring that only authorized users have access to approved infrastructure modules, reducing the risk of deploying unverified code. It also offers improved version control, customization, and compliance, helping teams maintain consistency and enforce governance across different environments. By centralizing the management of Terraform modules, teams can ensure they are using standardized, reliable code while retaining flexibility to adapt to specific needs. ![Private registry menu interface showing module management options](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/registry_menu.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=86eed0a5bf0f6eada751f82de625ec8d) ![Module Registry tab selected in the Registry section of the organization menu](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/modules_tab.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=6490c13dd460bf59a687c2ac5686db2f) ## Adding a module to the registry To add a module to your registry, go to the Module Registry screen and click on “CREATE NEW MODULE” in the top right. Only organization administrators are authorized to create new modules. ![Create New Module button in the top right of the Module Registry screen](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/private-registry/271bba4-2.jpg?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=700d35b6598bafbc35df2334de3fc86d) First, you must enter the general details for your module: * A name for your module - This can be any string of your choice. * The provider the module belongs to - This too can be any string of your choice. These two choices will affect how your module is used (see 'Using a module in your code'). The combination of name and provider must be unique within your organization’s modules. The description will be shown to members of your team when they browse the module registry. It is a useful way of summarizing what the module does and when it should be used. ![Module creation form with fields for name, provider, and description](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/5baa027-image.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=7ace20c33d2ccfc0c77f4873525a3623) Next, you must connect to the VCS provider, where your module’s source code is stored. Click on the VCS provider you'd like to use. After you've authorized env zero to access your repositories, select a repository from the dropdown menu and enter the folder where module files are stored (defaults to root folder). Click “Create” to save your work and create the new module. ## Module versioning To use a module, it must be versioned using a SemVer format (e.g., `1.0.0`). The versions must be applied to your source repository as [Git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging). ### Versioning modules for mono-repo When using a mono-repo for managing several modules, a team might come across the need to tag and manage versions for each module individually. To do that, you have to assign a tag prefix to identify a specific module's version in env zero. ![Tag prefix input field for mono-repo module versioning configuration](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/private-registry/58f2b8d-image.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=5fa3148b4115d4f89114f6952185e597) For example, to tag a module named `module1`, we may assign the prefix `m1`.\ When we'd use the tags `m1/1.0.0`, `m1/1.2.4`, the versions for the module in env zero will be `1.0.0` and `1.2.4` The delimiter is a single dash / and there is no need to write it in the Tag Prefix input. > [!NOTE] > > **Terraform restrictions on tags** > > Terraform enforces using a valid SemVer string as a version. Tagging with a prefix will only allow you to use the SemVer part and not the tag directly when using a module from env zero's private registry that is configured to use the tag prefix. ## Using a module in your code To use a module from the env zero Module Registry in your Terraform code, you must reference it like this: ```hcl theme={null} module "my-module" { source = "api.env0.com/{organization-id}/{module-name}/{module-provider}" version = "1.0.0" } ``` You can find this exact snippet, pre-filled with your values, in the Instructions tab of your module page. > [!NOTE] > > **Using a module from Gitlab Enterprise Edition or BitBucket Server** > > In order to enable Gitlab Enterprise or Bitbucket Server as a module registry you are required to set an [env zero custom flow](/guides/admin-guide/custom-flows) that will run the following command on after setup variables. > > ```bash theme={null} > git config --global url.https://$ENV0_VCS_ACCESS_TOKEN@$GIT_ADDR/.insteadOf https://$GIT_ADDR/ > ``` > > This command will instruct git CLI to use the authorized URL for checking out the code, where `ENV0_VCS_ACCESS_TOKEN` is an environment variable populated by env zero with the access token for the VCS system and `GIT_ADDR` is the domain of your VCS. > > ```yaml env0.yml theme={null} > version: 2 > > deploy: > steps: > setupVariables: > after: > - export GIT_ADDR="mygleeserver.example" > - git config --global url.https://$ENV0_VCS_ACCESS_TOKEN@$GIT_ADDR/.insteadOf https://$GIT_ADDR/ > ``` ## Using a module locally (or from a different env zero Organization) When you deploy your Terraform code through env zero, login to the env zero Module Registry is handled for you. If you'd like to run the same code locally, in a CI environment, or in a different env zero Organization, you will need to supply the authentication details to Terraform. Follow the guide on [how to authorize when using a private registry](/guides/admin-guide/private-registry/#authorization) for more info. ## The Modules List The Modules List page is available to every user in the organization by clicking on “Module Registry” in the organization’s menu (bottom left of the screen). On this page you can see which modules have been set up for your organization. You can use the search box to locate specific modules by name, provider, description, or the users who created them. ![Modules list page showing all registered modules with name, provider, and search box](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/e5ea366-modules_list.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=6d08247726286fe88f3bd08f59e013f9) ## The Module Page You can get to the Module page by clicking on a module from the Modules List. ![Module detail page with Readme, Instructions, and Versions tabs](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/b8f9132-5.jpg?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=9b10361256d3c3d3bcd7832624239679) Here you can see the details of your Module. The Versions dropdown menu at the top right allows you to switch between the different versions of your module. Versions are linked to [Git tags](https://git-scm.com/book/en/v2/Git-Basics-Tagging) in your repository, which match the [semantic versioning](https://semver.org/) schema. The **Readme tab** will show the contents of the `README.md` in your repository. The **Instructions tab** will include instructions on how the module can be used in your Terraform code. > [!WARNING] > > **HTML in README** > > For security reasons, HTML tags such as `` or `
` will be rendered as regular text inside the README tab. > > If you would like to have a link for example, please use the markdown syntax (e.g., `[link text](http://example-link.com/)`) rather than the HTML syntax (e.g., `link text` ) ## Submodules Rather than creating a dedicated repository for each module, you can create a single repository and place submodules within this larger repository. Using the submodules in code is achieved in the same way as referencing submodules within Git – by using the double slash; "//" and then folder location. ```hcl theme={null} module "my-module" { source = "api.env0.com/{organization-id}/{module-name}/{module-provider}//submodule" version = "1.0.0" } ``` ## Finding My Module ID Sometimes you may need your module ID for our [terraform provider](https://registry.terraform.io/providers/env0/env0/latest) or for some [API calls](/api-reference/credentials/create-api-key). You can find it in the Module card in the `Modules` tab under the `Registry` page. ![Module card in the Registry Modules tab displaying the module ID](https://mintcdn.com/envzero-b61043c8/SMkZGUXJ1AhEm5OR/images/guides/admin-guide/private-registry/5a50d57-image.png?fit=max\&auto=format\&n=SMkZGUXJ1AhEm5OR\&q=85\&s=4242af675fedce88d674430fa8161d2a) ## Further reading * [Terraform modules guide](https://www.envzero.com/blog/terraform-modules) ## Next steps * [Track module adoption](/guides/admin-guide/private-registry/modules/module-usage) through download counts and dependent environments * [Test your modules in CI](/guides/admin-guide/private-registry/modules/modules-continuous-integration-testing) on every commit or pull request # Using modules Source: https://docs.envzero.com/guides/admin-guide/private-registry/modules/module-usage Track module adoption in the env zero private registry with download counters and environment dependency counts to monitor module usage across your org. ## Overview The Module Usage feature provides insights into how your modules are being utilized across different environments. It includes charts that help understand module adoption and usage trends ## How to Access Module Usage To view module usage statistics: * Navigate to the module registry and select a module. * Select the Module Usage tab. ![Module Usage tab showing download count and environments using the selected module](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/modules/0f853062900d6678c6c9e2c8ff91535232ffbc52c8efdfb41d25adb85b489c13-image.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=009d3721f5d236acdea3048b20d22cc9) ### Downloads Over Time The module download counter tracks the number of times each module has been pulled. This feature enables you to: * Monitor the traction of your modules. * Understand adoption rates over time. ### Used By Environments This counter displays the number of environments that **currently** use on this module. It helps you: * Monitor the popularity of your modules. * Understand the dependency between your environments and modules. ### Active environments using this module A table lists each version of the module with its number of active environments. Expand a version to see its environments, each with a link and its project, 10 per page. A summary above the table shows the total, for example "Used by 12 active environments, 4 in projects you don't have access to". * **Version select:** **All versions** is the default. Pick one version to show only its row. The select also filters the charts, which show the latest version when **All versions** is selected. The README and Instructions tabs keep their own version select. * **Projects you cannot open:** Their environments are counted but not named. An expanded row ends with a line such as "2 more active environments in projects you don't have access to". * **No usage:** A module with no active environments shows an empty state. ## What module usage covers Missing data looks like no usage. An empty table means env zero recorded no use, not that nothing uses the module. This applies to the table, the charts, and the API. * **Last deploy or destroy only:** env zero records each environment's last successful deploy or destroy. It keeps no history. * **Registry sources only:** Git and local module sources are not recorded. * **Two sources for one module:** A public module used by both OpenTofu and Terraform environments appears as `registry.opentofu.org/...` and `registry.terraform.io/...`. * **Terraform and OpenTofu environments:** For Terragrunt, only run-all `module` blocks and inline single-module code are recorded. * **Nested modules count:** A module called from inside another module counts as used. * **Active environments only:** Counts and lists leave out environments marked inactive, in an archived project, or destroyed. They return when unarchived. ## Module usage API Both calls require the **View Modules** permission and never name environments in projects you cannot open. * [List Module Usage Sources](/api-reference/modules/list-module-usage-sources): Lists the module sources your active environments use, with environment counts overall and per version. Use it to find the source name for Get Module Usage. Subdirectories count under their source. * [Get Module Usage](/api-reference/modules/get-module-usage): Lists the active environments that use one source, grouped by version, newest first. Each environment has its project ID, `lastDeployedAt`, and `deployedFrom`, the template as of its latest deployment. An edit without a redeploy does not show, and a deleted template still appears. An environment on two versions is listed under both and counted once in the total. `hiddenEnvironmentCount` is the number of counted environments you may not view. An unknown source returns `200` with zero environments, which may be missing data. See [What module usage covers](#what-module-usage-covers). ## Next steps * [Publish a new module version](/guides/admin-guide/private-registry/modules#module-versioning) for the environments that depend on it * [Run module tests automatically](/guides/admin-guide/private-registry/modules/modules-continuous-integration-testing) when the module code changes * [Authenticate to the registry](/guides/admin-guide/private-registry#authorization) from your machine or CI pipeline # Testing modules in CI Source: https://docs.envzero.com/guides/admin-guide/private-registry/modules/modules-continuous-integration-testing Run automated CI tests on private registry modules in env zero using OpenTofu tftest files, with per-commit and per-PR test execution support. env zero's module testing feature allows you to stay on top of your modules' health at any point, running tests with any change done to your modules. All information will be visible within env zero and your VCS, providing a quick and clear view of your module's status and allowing you to identify and remediate issues quickly for your modules' consumers. ## Writing tests with OpenTofu tftest files Module testing in env zero uses [Opentofu test command](https://opentofu.org/docs/cli/commands/test/). Start by writing your tests as [tftest files](https://opentofu.org/docs/cli/commands/test/#the-tftesthcl-file-structure). All of your module test files have to be saved within the VCS folder of your module to be executed by env zero. ## Set Testing Credentials and Self Hosted Agent As your tests are executed by env zero, you can select which credentials are used for execution. Go to Registry Settings and select [credentials](/guides/getting-started/connect-your-cloud-account) to be used in the tests execution.\ If you're using [Self Hosted Agents](/guides/admin-guide/self-hosted-kubernetes-agent/overview), you can also set up which Self Hosted Agent will be used to execute the tests.\ The credentials and agent will apply to tests executed on all modules in the registry. ## Enable & Run tests ### Configure module testing When creating or editing a [module](/guides/admin-guide/private-registry/modules), go to the Testing step and check Enable Testing. ![Module Testing step in the module editor with the Enable Testing checkbox and OpenTofu version selector](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/modules/e0b832b0229be5448a7fd2b2b161b3d2acff1bc92c7f89fc72f0dc108f15559c-screenshot_2024-09-12_at_10.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=43a368b160ee499c6b11910f7d5a3add) When testing is enabled, `test` will be executed on each commit to the repository default branch. You can enable "Run tests on every PR" to make sure tests are also executed on each commit to a pull request targeting the default branch. Select OpenTofu version or default to the latest version, then set up any variables required for your test execution. > [!NOTE] > > **Organization Variable Inheritance** > > [Organization Variables](/guides/admin-guide/variables) will be inherited by your module registry and applied to each test execution. You can override the organization variables in the Module level. ### Manually trigger tests You can also manually trigger a module run by clicking "Run Tests" on the module details page. A run will be immediately queued and you can see its details in the Tests tab. > [!NOTE] > > **Version support** > > Module tests will always run on the latest version of the module. ## Tracking test results your VCS and in env zero When tests run is triggered by a commit, you'll be able to see status checks in your VCS indicating the test results triggered by the commit. ![VCS status checks showing module test results triggered by a commit](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/modules/284ee36-image.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=c4e81aa09864d1eeb22c170b500d8801) In env zero, within each module, the Tests tab will show all historical testing runs executed on this module. An overview recap of success, skipped, failed, and errored tests is given for each run. You can also see the type of run and which commit triggered the test execution. ![Tests tab listing historical test runs with success, skipped, failed, and errored counts per run](https://mintcdn.com/envzero-b61043c8/hr9e779VSnIZk8JC/images/changelogs/2024/01/e9633a6-image.png?fit=max\&auto=format\&n=hr9e779VSnIZk8JC\&q=85\&s=34ea8ec6d0c369e241e1f6d7fbaa3ef4) Click any record to drill down into the logs of the specific run. Within the Test Logs you'll be able to see the full details of the test execution. Each test file will have its own step with a success or failed status, and clicking the step will show the full breakdown of all test runs included in this file. ![Test logs view showing per-file test steps with pass or fail status and full breakdown](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/modules/f1f6c48-image.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=134e976beabae3fdc23a9466072ea1c6) ## Next steps * [See which environments depend on a module](/guides/admin-guide/private-registry/modules/module-usage) * [Authenticate Terraform locally](/guides/admin-guide/private-registry#local-usage) to pull modules from the registry outside env zero # Providers overview Source: https://docs.envzero.com/guides/admin-guide/private-registry/providers Publish and manage private Terraform providers in the env zero provider registry, with goreleaser version publishing and private registry authentication. ## env zero Provider Registry The **env zero Provider Registry** is a private registry for [Terraform providers](https://developer.hashicorp.com/terraform/language/providers), allowing you to privately share and reuse Terraform providers within your organization. You can access your organization’s provider registry through the `Registry` link in the left sidebar, and choosing the `Providers` tab: ![Registry section in the left sidebar with the Providers tab selected](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/c338ad3-regisrty_ui_1_fix.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=d19c914489004d36a29b3bebea4cbdff) ## Publishing A Provider > [!NOTE] > > NOTE > > This guide assumes you already have a provider set up, preferably with `goreleaser`. ### Creating A Provider As an env zero admin (or with a custom role with the `Create & Edit Providers` permission), you should have permission to create a provider. Navigate to `Registry` on the navigation bar, and click the `Providers` tab. There you will see the `Create New Provider` button: ![Providers tab in the Registry section with the Create New Provider button visible](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/97f42dd-regisrty_providers_1_fix.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=53c8e29ef2c5eed825a665aa74bf8df6) > [!NOTE] > > **Provider's type** > > Your provider’s type is essentially its name, and should match your provider’s files. For example, if your binaries look like `terraform-provider-aws_1.1.1_linux_amd64.zip`, then your provider’s type should be `aws`. > [!NOTE] > > Note > > Your binaries' names should match this format - `____.zip`, like the example above `terraform-provider-aws_1.1.1_linux_amd64.zip` ### Creating A GPG Key Terraform uses GPG keys to authenticate the identity of the entity that compiled and signed the binaries of the provider.\ Normally, when creating a release, you should provide goreleaser with your GPG\_FINGERPRINT, which should also be set on env zero. For more information regarding how to generate your GPG Key, check out [GitHub's guide](https://docs.github.com/en/authentication/managing-commit-signature-verification/generating-a-new-gpg-key). Once you have your key generated, you'll need to create it on env zero. Navigate to `Organization Settings > Keys` and scroll down to `GPG Keys`. You will see the `Add GPG Key` button: ![GPG Keys section in Organization Settings with the Add GPG Key button](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/a4e07ac-gcp_fix.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=8e831dd31f23bab1624ae0b6712dea49) > [!NOTE] > > **GPG Key ID** > > GPG Key ID is the long key ID of the key you sign releases with: a 16-character hexadecimal string, which is the last 16 characters of the key's 40-character fingerprint. Run `gpg --list-secret-keys --keyid-format=long` to see it. The `GPG_FINGERPRINT` you give `goreleaser` is the full 40-character fingerprint. ### Releasing A Version As part of your CI you should have a version releaser setup. Terraform recommends using `goreleaser`, and so do we. You can make sure your `.goreleaser` file is configured correctly following [this guide by Terraform](https://developer.hashicorp.com/terraform/tutorials/providers-plugin-framework/providers-plugin-framework-release-publish#add-goreleaser-configuration) Assuming you have a version complied and ready to ship, you will need to upload the binaries you wish to support. #### Creating A Version The first step on the release is creating a version in env zero, following the [Version API Reference](/api-reference/provider-registry/create-a-new-provider-version). #### Uploading A Version If creating a version was done correctly, you will receive a URL (valid for 1 hour) to which you can upload your `zip`, `SHA256SUMS` and `SHA256SUMS.sig` files. For each file type you will need a specific `content-type` header: * `zip` - `application/zip` * `SHA256SUMS` - `application/octet-stream` * `SHA256SUMS.sig` - `application/pgp-signature` and then with a simple `cURL` request: ```bash theme={null} curl --request PUT \ --header "Content-Type: $CONTENT_TYPE" \ --upload-file "$FILEPATH" \ "$UPLOAD_URL" ``` To ease the process we suggest using the following script to **create and upload all the binaries at once**: ```bash theme={null} #!/bin/bash # usage: upload-provider-versions.sh # required environment variables: # 1. ENV0_API_KEY - env zero's api key. you can create one at # 2. ENV0_API_SECRET - env zero's api secretd # 3. PROVIDER_ID - your provider's ID as created by env zero # 4. GPG_KEY_ID - your GPG key's long key ID (16 hexadecimal characters) # The folder containing the files to upload FOLDER=$1 # Assert FOLDER argument is passed if [[ -z "$FOLDER" ]]; then echo "Usage: upload-provider-versions.sh " exit 1 fi AUTH_HEADER="Authorization: Basic $(echo -n "$ENV0_API_KEY:$ENV0_API_SECRET" | base64)" ENV0_API_ENDPOINT=${ENV0_API_ENDPOINT:-"https://api.env0.com"} function upload_file { FILEPATH="$1" # Get the filename without the path FILENAME=$(basename "$FILEPATH") # Determine the content type based on the file extension if [[ $FILENAME == *.zip ]]; then CONTENT_TYPE="application/zip" elif [[ $FILENAME == *_SHA256SUMS ]]; then CONTENT_TYPE="application/octet-stream" elif [[ $FILENAME == *_SHA256SUMS.sig ]]; then CONTENT_TYPE="application/pgp-signature" else return 0 fi # Make the POST request to create a new version RESPONSE=$(curl --fail --silent --show-error --request POST \ --header "Content-Type: application/json" \ --header "$AUTH_HEADER" \ --data "{\"filename\":\"$FILENAME\",\"gpgKeyId\":\"$GPG_KEY_ID\"}" \ "$ENV0_API_ENDPOINT/providers/$PROVIDER_ID/versions") # Check for errors if [ $? -ne 0 ]; then echo "Error creating new version for $FILENAME" return 1 fi # Parse the response for the upload URL UPLOAD_URL=$(echo "$RESPONSE" | sed -n 's/.*"url":[[:space:]]*"\([^"]*\)".*/\1/p') # Make the PUT request to upload the file curl --fail --silent --show-error --request PUT \ --header "Content-Type: $CONTENT_TYPE" \ --upload-file "$FILEPATH" \ "$UPLOAD_URL" # Check for errors if [ $? -ne 0 ]; then echo "Error uploading $FILENAME" return 1 fi echo "Uploaded $FILENAME" } # Find all files in the folder and run the upload_file function for each one in the background for FILEPATH in "$FOLDER"/*; do upload_file "$FILEPATH" & done # Wait for all background processes to finish wait ``` Your first version should be released.\ To watch your provider's versions, navigate to its page on env zero by clicking its card. ![Provider card on the Registry page showing the uploaded provider with version information](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/d7432ce-provider_card.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=53cda229830c2ed78dac544f3fab817e) On the top right, you can see your uploaded versions. Clicking on versions then navigating to `Platforms` tab will show you the supported binaries. ![Platforms tab showing the list of supported binary targets for the uploaded provider version](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/private-registry/8548265-platforms_1_fix.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=76eecaa2cccb23113ee63bb506df8721) ### Using A Provider Now that your provider is set up every user in your organization with the `View Providers` permission (available by default to organization user) can start using it from within env zero, or outside of it. Set up the provider in your Terraform file by copying and pasting the following block. ```hcl theme={null} terraform { required_providers { = { source = "api.env0.com//" version = "" } } } ``` You can now deploy your Terraform code through env zero and it will deploy as expected. #### Outside env zero If you would like to use your provider outside env zero, you will have to set up Terraform's authorization. Follow the guide on [how to authorize when using a private registry](/guides/admin-guide/private-registry/#authorization) for more info. # Manage projects Source: https://docs.envzero.com/guides/admin-guide/projects Organize environments with projects in env zero for access control, multi-cloud account management, and separation of dev, staging, and production. Projects provide granular access control to environments in env zero. Every environment belongs to a project, and users are granted access on a per-project basis. Projects are also useful for managing multiple cloud accounts within a single organization, and for separating environments (for example, dev, staging, production) with their own access rights and policies. Projects are created within an [Organization](/guides/admin-guide/organizations). Every new organization starts with a Default Organization Project. Additional projects can be added as needed. ## Active projects Users typically work in the context of an active project, but can also work at the Organization level. The current active project is shown in the upper left in the organization/project selector. * **Project context:** Shows only templates and environments associated with the current project. * **Organization context:** Shows all projects the user has access to via the Projects tab. To switch context, use the organization/project selector in the upper left. ## Create a project To create a project, switch to the Organization context (no active project selected), select the **Projects** tab, and click **Create New Project**. Enter a name and description. The new project is set as the active project automatically. ## Associate templates with a project Only templates associated with the current project can be used to create environments. A newly created project has no templates associated. To manage project templates: 1. Select an active project. 2. Open the **Templates** tab and click **Manage Templates**. 3. Select templates from the organization list. 4. Click **Save**. ## Sub-projects Sub-projects let you nest projects within other projects for more granular organization. Each sub-project can have its own environments, templates, variables, and user roles. ### Create a sub-project Hover over the parent project in the left navigation and click the **+** icon that appears. ### Move a sub-project Use **Move** in Project Settings to relocate a sub-project. The sub-project and any of its own sub-projects move together. ### Navigate the hierarchy The Projects page shows parent projects. Click into a project to see its sub-projects or environments. The left navigation shows the hierarchy with arrows for projects that contain sub-projects. ## Access control Each sub-project inherits roles from its parent project up to the root. Users must have **View Project** permission to navigate to a project. Different roles can be assigned for different levels in the hierarchy. For details, see [Users & roles](/guides/admin-guide/user-role-and-team-management/user-management/#project-users). ## Variables inheritance What inherits from parent projects to sub-projects: * **Variables:** Inherited from parent to sub-project. What is project-specific (does not propagate to sub-projects): * **Templates** * **Policies** * **Notifications** * **Costs** (each project tracks only its own environments) ## Finding the project ID You may need the project ID when using the [Terraform provider](https://registry.terraform.io/providers/env0/env0/latest) or making [API calls](/api-reference/credentials/create-api-key). Find it under the **General** tab in **Project Settings**. ![Project settings page showing project ID field](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/4cf84ec-project_settings.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=9861f1931f97ec9fc2fa4fff83e2946a) ## Archive a project Archiving a project makes it inactive without deleting its configuration or history. This is useful for projects that are no longer in active development. > [!WARNING] > > Archiving a project cannot be undone. There is no way to unarchive or restore an archived project. When you archive a project: * Active environments within the project are not destroyed. They are [marked as inactive](/guides/admin-guide/environments#mark-an-environment-as-inactive) and removed from deployment management, so their cloud resources keep running and keep costing money. * Continuous and scheduled deployments stop running. * The project is hidden from the main project list. * Budget notifications stop, even if thresholds are exceeded. ## Best practices * Use projects to separate dev, staging, and production environments. * Align project structure with team responsibilities. * Use sub-projects for complex organizational structures. * Plan the hierarchy for growth - moving sub-projects later is supported but requires care. ## Next steps * [Organize projects into sub-projects](/guides/admin-guide/projects/sub-projects) as the hierarchy grows * [Give a team access to a project](/guides/admin-guide/user-role-and-team-management/teams#managing-team-access-to-a-project) * [Review how roles cascade](/guides/admin-guide/user-role-and-team-management/rbac#role-assignment-levels-and-inheritance), so each sub-project gets the access you expect # Manage sub-projects Source: https://docs.envzero.com/guides/admin-guide/projects/sub-projects Create and manage sub-projects to organize environments, templates, and variables hierarchically in env zero, with per-level RBAC role assignments. As your organization's IaC use grows, you might find that a single hierarchy level *Project* level is insufficient to organize all resources and domains. *Sub Projects* help you better organize your *Projects*, *Environments*, and configurations within your organization. Sub Projects have similar configurations to *Projects* but are nested within other *Projects*. Each *Sub Project* may have its own *Environments*, *Templates*, *Variables*, etc. Users may be assigned different Roles for different *Projects* in a given hierarchy, e.g., only view a parent *Project*, but run plans under a *Sub Project*. ## Navigating to a Sub Project ### Projects Page The *Organization's Projects Page* shows *Projects* that don't have a parent. Clicking on the \_ Project\_ will make it the [Active Project](/guides/admin-guide/projects/#active-projects) and will bring it to its own *Sub Projects* page if there are any, or to its *Environments* page. When clicking on another *Sub Project* the same rules apply - if there are more *Sub Projects* you'll be able to navigate into them and when there are no more *Sub Projects* the *environments* are shown ### Projects Menu The menu shows only *Projects* without a *Parent Project*. Projects containing *Sub Projects* will have an arrow next to them. Hovering on the project will show you its *Sub Projects*. That way you can use the projects menu to access any project in your organization ![Projects menu showing a project with an arrow indicator and its nested sub-projects on hover](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/projects/78db681-project_and_sub_projects_1.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=07de1b86840d7dbf4da2f9d6754262a4) When choosing a *Project*, you may navigate to its *Sub Projects* page from the menu. ![Sub Projects page accessible from the project menu showing nested project navigation](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/projects/1f8ed58-sub_project.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=4ff1f615cb61ee2b0d3f17545a63ab95) ## Creating a Sub Project To create a subproject, hover over the desired project in the left navigation panel and press the plus icon. ![Plus icon appearing on hover over a project in the left navigation panel to create a sub-project](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/projects/e2f2e50e915273f55b6fe35a556537fb8f21e686260678e791471b14994c5261-image.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=73e4689aec40d347696a22ac9c0cc05a) ## RBAC for Sub Projects Each *Sub Project* inherits the *Roles* from its parent *Project* up to the root *Project*. If a user doesn't have the *"View Project"* permission to view for a parent *Project*, but does have it on the *Sub Project*, the user may navigate the project using the menu items, with hovering over the ancestor *Projects* until the relevant project appears in the menu. Users are not allowed to click and navigate to any project they lack the *"View Project"* permission for. > [!NOTE] > > **Associated Credentials and Templates, Policies, and configured Notifications only affect the Project in which they are configured, and not affecting any Sub Project under said Project. As for Costs, each Project takes into account its own Environments only, without any Environment in its Sub Projects.** > [!NOTE] > > **Unlike the above, [Variables](/guides/admin-guide/variables) are inherited from Parent Projects to Sub Projects.** ## Environment migration from (sub) project to (sub) project When using env zero local backend, migrating from 1 (sub) project to another (sub) project is not supported. When using env zero remote backend, migrating from 1 (sub) project to another (sub) project requires the following procedure to be followed: 1. On a local machine: * Log into env zero backend "terraform login backend.api.env0.com" * Add the env zero remote backend code to the resource: ```yaml theme={null} terraform { backend "remote" { hostname = "backend.api.env0.com" organization = "[Org ID].[Project ID]" workspaces { name = "[Workspace Name]" } } } ``` * Ensuring there are no ".terraform" files or folders in the directory * Run "terraform init" * Run "terraform plan" to ensure no changes are seen in the correct environment * Run "terraform state pull > state2migrate.tfstate" * Confirm the state2migrate.tfstate file has been populated. * Update the project ID and workspace name in the code above. If a SubProject is being used, replace the Project ID with the SubProject ID (i.e., \[Org ID].\[SubProject ID] * Remove the ".terraform" files and folders. 2. In env zero: * Navigate to the new (sub) project location * Create a new environment running from the same VCS code with the same terraform and environmental variables.\ \*\* Ensure auto-approval is turned off.\ \*\* Enable "Use env0 Remote Backend" * Cancel the deployment at the "approve plan" stage as to not recreate the resources. 3. On the local machine: * Run "terraform init" * Run "terraform state push state2migrate.tfstate" * Run "terraform plan" to ensure no changes are seen in the correct environment 4. In env zero: * Redeploy the new environment and approve as no changes should be seen. * [Mark the old environment as inactive](/guides/admin-guide/environments#mark-an-environment-as-inactive). Do not destroy it, since it manages the same resources as the new one. * (Optional) All local ".terraform" files and the remote backend configuration can be removed from the local machine. ## Moving Sub-Projects Going into the project you want to move in the Project Settings of the page you can find a **Move** button ![Project Settings page showing the Move button for relocating a sub-project](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/projects/7c09364-move_a_sub_project.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=7ddd8a40b043498c55f943bbf5b7497b) Using that button will open a popup allowing you to select which project you want that project to move into ![Project selection popup for choosing the target project when moving a sub-project](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/projects/e1e36be-image.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=920b3343a3576a11f6a82ba3241c88c0) After pressing the Move button on the project selection popup the project (and its subprojects if it has any) will be moved to the selected target project ## Next steps For how roles cascade from a parent project into its sub-projects, see [role assignment levels and inheritance](/guides/admin-guide/user-role-and-team-management/rbac#role-assignment-levels-and-inheritance). # Remote backend Source: https://docs.envzero.com/guides/admin-guide/remote-backend Store and manage Terraform state with env zero remote backend, including state locking, versioning, deployment correlation, and access control. Terraform uses persisted state data to keep track of the resources it manages. Most non-trivial Terraform configurations use a [backend](https://www.terraform.io/language/settings/backends/configuration) to store the state remotely. This lets multiple people access the state data and work together on that collection of infrastructure resources. Terraform offers several state storage options, of which env zero supports [Remote Backend](https://www.terraform.io/language/settings/backends/remote), which has some great benefits such as: * **No underlying infrastructure setup and management** - env zero takes care of the setup as opposed to other approaches, where you need to do all the setup and management yourself (for example, [S3 Backend](https://www.terraform.io/language/settings/backends/s3) requires you to create an S3 Bucket and an optional DynamoDB Table for locking beforehand). * **Security** - env zero stores the state securely and assures only you can access it. * **State consistency** - Remote Backends assure that users won't overwrite each other's state with a locking mechanism and that they receive the most recent state on every Terraform operation * **[Remote plans](/guides/admin-guide/remote-backend/remote-plan)** - By providing the Remote Backend configuration and successful login, users can run `terraform plan` locally, which will trigger a remote plan in env zero. The remote plan will use the shared state and variables set for the env zero environment. Using env zero's Remote Backend has additional advantages: * **No Terraform Backend configuration when running inside env zero** - You don't have to provide any type of configuration; deploy your code as is, and env zero will automatically configure it to use the Remote Backend. * **States UI** - View the current version of your current state and all previous versions. * **Correlation of Deployment to State** - Identify which deployment caused a specific change to your state. * **[State Access Control](/guides/admin-guide/remote-backend/state-access-control)** - Specify which environments should be able to access an environment's state in env zero. > [!WARNING] > > **Reusing Workspace Name** > > Terraform uses the workspace name to distinguish between one state and another. > > When using a remote backend in env zero, the workspace name identifies that environment's state. > > Therefore, if a remote backend environment is created and then [marked as inactive](/guides/admin-guide/environments#mark-an-environment-as-inactive), and another remote backend environment is created with the same workspace name, it would inherit the first environment's state. > > Marking an environment as inactive stops reserving its workspace name, so env zero no longer rejects the new environment as a duplicate. It does not clear the state that name points at. Reuse a workspace name only when you intend the new environment to adopt the old state. ## Use Remote Backend in a New Environment To enable Remote Backend in a new environment: * Create a new [Environment](/guides/admin-guide/environments/setting-up-a-new-environment) * Check the **Enable Remote State** checkbox * Enter a **Workspace Name** Here's what it looks like for environments based on a predefined template: ![New environment form for a template-based environment with Enable Remote State checkbox and Workspace Name field](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/9aa75ce-screen_shot_2022-09-14_at_16.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=306942b6408f26aa229af38c87dac8cf) Here's what it looks like for environments based on a direct VCS integration: ![New environment form for a direct VCS integration with Enable Remote State checkbox and Workspace Name field](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/860732b-screen_shot_2022-09-14_at_16.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=675731335a1c57b772dad0c298a3863f) > [!NOTE] > > **Workspace Name Restrictions** > > env zero enforces that a Workspace Name must be unique among all Remote Backend environments in the Organization. The Terraform configuration for the Remote Backend consists of Organization ID and Workspace Name. Therefore, we have this limitation to block possible state conflicts. > [!NOTE] > > **Force Remote Backend** > > You can force all new Terraform environments in a project to be created with a Remote Backend. See [Force remote backend](/guides/policies-governance/force-remote-backend) for more info. > [!WARNING] > > **Terragrunt** > > Currently, env zero does not support using the Remote Backend with Terragrunt. Let us know (via chat or email) if you would like us to add support for this. ### Enable Remote Backend on a workflow sub-environment A workflow sub-environment takes the workflow's **Use env zero Remote Backend** setting once, when env zero creates it, and only if its template is Terraform or OpenTofu. Sub-environments have no **Settings** tab, so to enable Remote Backend on an existing sub-environment, use the [Update Environment](/api-reference/environments/update-environment) API. > [!WARNING] > > **Required permission** > > Enabling Remote Backend requires the **Edit Environment Settings** permission on the sub-environment. Before you start, you need: * An [API key](/guides/admin-guide/user-role-and-team-management/api-keys) ID and secret * A sub-environment whose template is Terraform or OpenTofu * If the sub-environment was deployed before, the **Run Tasks** permission, to migrate its state. No built-in project or environment role includes it; grant it with a [custom role](/guides/admin-guide/user-role-and-team-management/custom-roles). **1. Get the sub-environment ID** Read it from the workflow environment with the [Get Environment](/api-reference/environments/get-environment) API. `` is the sub-environment's key under `environments` in `env0.workflow.yaml`. ```bash theme={null} curl -s -u ":" \ "https://api.env0.com/environments/" \ | jq -r '.latestDeploymentLog.workflowFile.environments[""].environmentId' ``` **2. Enable Remote Backend** ```bash theme={null} curl -X PUT "https://api.env0.com/environments/" \ -u ":" \ -H "Content-Type: application/json" \ -d '{"isRemoteBackend": true}' ``` The response is the updated environment, with `"isRemoteBackend": true`. The setting applies from the sub-environment's next deployment. **3. Migrate existing state** If the sub-environment was deployed before, env zero doesn't copy its existing state into the Remote Backend. Migrate it before the next deployment, or that deployment either fails or plans to re-create the sub-environment's resources. Run a task on the sub-environment that sets the environment variable `TF_CLI_ARGS_init` to `-migrate-state -force-copy` (`"type": 0` marks it as an environment variable). The task's `init` step copies the state into the Remote Backend, and `terraform state list` prints the migrated resources. For OpenTofu, use `tofu state list`. ```bash theme={null} curl -X POST "https://api.env0.com/environments//deployments" \ -u ":" \ -H "Content-Type: application/json" \ -d '{"deploymentType": "task", "taskPayload": "terraform state list", "configurationChanges": [{"name": "TF_CLI_ARGS_init", "value": "-migrate-state -force-copy", "type": 0, "scope": "DEPLOYMENT"}]}' ``` Running `terraform init -migrate-state` as the task command doesn't work. The task's own `init` step runs first and fails with `Error asking for state migration action: input is disabled`. env zero saves `TF_CLI_ARGS_init` on the sub-environment. After the task succeeds, find the variable's ID and delete it: ```bash theme={null} curl -s -u ":" \ "https://api.env0.com/configuration?environmentId=&organizationId=" \ | jq -r '.[] | select(.name == "TF_CLI_ARGS_init") | .id' curl -X DELETE "https://api.env0.com/configuration/" \ -u ":" ``` If the sub-environment's code configures its own backend, see [Migrating State](/guides/admin-guide/remote-backend/state-migration). * Redeploying the workflow doesn't change the setting. * If another Remote Backend environment in the organization uses the same workspace name, the call returns `409` with `Workspace name "" is taken by remote backend environment`. You can't change a sub-environment's workspace name after it's created, so give each sub-environment its own `workspace` in the [workflow file](/guides/admin-guide/workflows/workflow-file-reference#sub-environment-properties) before it's first deployed. ### Viewing & Downloading State Versions After a successful deployment with Remote Backend enabled, the **States** tab lists all state versions, newest first. ![States tab listing all state versions in reverse chronological order after a successful deployment](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/cd0e876-screenshot_2022-10-25_at_14.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=4273fdbd678d5bcea9733f286b456106) To download a state version, hover on the desired version. A Download button should appear. ![State version row on hover revealing the Download button to save the state file](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/dd6c73f-screenshot_2022-10-25_at_14.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=32cdf04a952047d201331f930d3ba4bd) Clicking it should initiate a file download. > [!NOTE] > > **Note** > > Bigger state files may take a few moments to start downloading If the state version was created by env zero (i.e., not locally), there would also be a quick access link to its relevant deployment log. ![State version row showing a quick access link to the deployment log that created this state](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/guides/admin-guide/1ea47d7-screenshot_2022-10-25_at_14.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=0aa7117458706728fe509bc7869e0167) ### Release a Locked State When working with Terraform or OpenTofu, you might encounter a scenario where the **state becomes locked**. This usually occurs when a previous deployment did not complete successfully - due to an error, crash, or manual interruption. In such cases, the workspace retains a state lock to prevent conflicting changes during concurrent deployments. To resolve this issue, you can **manually release** the state lock. This action clears the lock, allowing you to re-run your deployment safely. #### How to release a locked state * Navigate to the STATES tab for the affected environment. * If the workspace is locked, you’ll see a warning along with a **Force Release** button. * Click the **Force Release** button to clear the lock > [!WARNING] > > **Important** > > Only use force unlock when you're certain that no other deployments are currently running. Forcing unlock during an active deployment can corrupt your infrastructure state. ![States tab with a locked workspace warning and the Force Release button to clear the state lock](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/4dbfd89cd07d3a64c29d69b06964b0bf15cdc73e1924cf692430b2f7d540aee9-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=8488a71272398377f2c7af8e08d4e11a) ### Using the Remote Backend Locally Please check out this guide: [Using the Remote Backend on your local machine](/guides/admin-guide/remote-backend/login) ## Further reading * [A guide to the Terraform state file](https://www.envzero.com/blog/a-guide-to-the-terraform-state-file) * [Terraform backend configuration: local and remote options](https://www.envzero.com/blog/a-guide-to-local-and-remote-backends-in-terraform) * [Manage Terraform remote state with a remote backend](https://www.envzero.com/blog/terraform-remote-state-using-a-remote-backend) ## Next steps To keep remote backend state in your own AWS S3 bucket, [set up self-hosted remote state](/guides/admin-guide/remote-backend/self-hosted-remote-state). # Authenticate locally Source: https://docs.envzero.com/guides/admin-guide/remote-backend/login Authenticate to the env zero remote backend from your local machine using a personal API key token for local terraform login and remote plan. Remote backends allow running your Terraform deployments both on env zero and locally with access to the remote state. To use the remote backend locally, you must log in so your requests are authorized. To log in, ensure the following conditions are met: 1. You have a login [token](/guides/admin-guide/remote-backend/login/#generating-a-token) 2. The current path is the directory of the Terraform stack 3. The Terraform stack defines a properly configured env zero backend ```hcl backend.tf theme={null} terraform { cloud { hostname = "backend.api.env0.com" organization = "." workspaces { name = "my-first-remote-apply" } } } ``` > [!NOTE] > > **PROJECT\_ID in the backend configuration** > > The PROJECT\_ID is only required if the env zero environment does not exist in the env zero UI. If this is the first time you are creating an env zero environment with the remote backend configuration, specify the PROJECT\_ID so env zero knows which project to place it in. If you are updating the backend configuration for an existing environment, you do not need to specify the PROJECT\_ID. To log in: 1. Run `terraform login backend.api.env0.com` 2. Enter `yes` when prompted 3. Insert your `token` > [!NOTE] > > **Module registry and remote backend use separate endpoints** > > The module registry and remote backend are hosted on different API endpoints. To use both with the same API key, you must also set up the token for `api.env0.com`. See [Private Registry authorization](/guides/admin-guide/private-registry/#authorization) for details. ## Generating a token To generate a token, create a [Personal API key](/guides/admin-guide/user-role-and-team-management/api-keys/#personal-api-key). After the API key is created, the token appears under **Using it locally for Remote Backend**. Admins can also create an [API key with a specific role](/guides/admin-guide/user-role-and-team-management/api-keys/#how-to-create-an-api-key). > [!WARNING] > > Avoid sharing tokens between users > > Terraform's workspace locking mechanism prevents state corruption by ensuring two users cannot plan or apply simultaneously. Issuing the same token to multiple users defeats this mechanism, since env zero cannot differentiate between users sharing a token. ## Logout To log out, navigate to `backend.api.env0.com/logout/{Token}` in your browser. ## Next steps * [Run a remote plan](/guides/admin-guide/remote-backend/remote-plan) from your terminal * [Run a remote apply](/guides/admin-guide/remote-backend/remote-apply) # Running remote apply Source: https://docs.envzero.com/guides/admin-guide/remote-backend/remote-apply Run terraform apply locally while executing remotely on env zero with shared state, variables, cost estimation, and an auditable deployment record. Remote Backend allows applying your Terraform locally by triggering a **remote apply** in env zero.\ The remote apply uses your local Terraform files but actually runs it remotely in env zero while using the shared state and variables set for the env zero environment. Each remote apply creates a deployment in env zero so you will have an audit for each deployment.\ By running a remote apply you can build your IaC faster, and test your changes locally before committing them. Additional benefits are the rest of the env zero features that are automatically integrated into your plan logs. It includes: * [Role Based Access](/guides/admin-guide/user-role-and-team-management/user-management) * [Custom Flows](/guides/admin-guide/custom-flows) * [Cost Estimation](/guides/policies-governance/cost-estimation) * [Variables and Secrets](/guides/admin-guide/variables) * [Policies](/guides/policies-governance/policies) * [Plugins](/guides/integrations/plugins) > [!WARNING] > > Warning > > Remote apply is not recommended for production environments as it lets you apply local code that is not VCS controlled, which can cause a drift in your infrastructure. Use this feature with caution. ## Before You Start There are some prerequisites you need to be aware of before starting to use remote apply. ### Permissions To enable Remote Apply within an environment, you must have the "Allow Edit Remote Apply" permission. As an admin, you can create a custom role with this permission, or use the Admin role, which have it enabled by default. ![Custom role editor showing the Allow Edit Remote Apply permission toggle](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/remote-backend/0936782-image.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=e7986928bb1c60b5d88fa31bffc968b4) ### Opting In for Remote Apply Within your environment's settings, navigate to `General Settings` > `Remote State` to find the *Allow Remote Apply* option. ![Environment General Settings page showing the Allow Remote Apply toggle under Remote State](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/remote-backend/a4a21fc-image.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=5e83b2f7f70be228799e24cac50c58a7) To activate this feature, your environment must meet certain prerequisites: 1. The Remote Backend must be enabled. 2. *Approve plan automatically* must be enabled. 3. There are no [approval policies](/guides/policies-governance/approval-policies) configured on this project. ## Usage 1. First, you have to have your Terraform configuration defined with the `cloud` block. ```hcl theme={null} terraform { cloud { hostname = "backend.api.env0.com" organization = "." workspaces { name = "my-first-remote-apply" } } } ``` > [!NOTE] > > **Cloud Configuration Support** > > Terraform's cloud block is only available from version 1.1.0. To use remote apply, you have to use the cloud block configuration, and not the old remote "backend" configuration. 2. To login, follow [this guide](/guides/admin-guide/remote-backend/login) 3. Next, run ```bash theme={null} terraform init terraform apply -auto-approve ``` > [!WARNING] > > `-auto-approve` flag > > the `-auto-approve` flag is mandatory to execute remote apply on env zero. A remote apply will start an logs will start appearing on the terminal. ![Terminal output showing remote apply logs streaming from env zero with a link to the deployment](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/remote-backend/a79c745-image.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=18f36883bec9598d6e89177062e3716d) > [!TIP] > > Tip > > You can see the deployment in env zero by clicking the yellow link. To apply a plan you saved with `-out`, see [Save a plan and apply it later](/guides/admin-guide/remote-backend/remote-plan#save-a-plan-and-apply-it-later). ## Next steps To control which environments can read this state, see [Configuring state access control](/guides/admin-guide/remote-backend/state-access-control). # Running remote plan Source: https://docs.envzero.com/guides/admin-guide/remote-backend/remote-plan Run terraform plan locally while executing remotely on env zero with shared state, RBAC, cost estimation, and custom flows, with auditable results. ## Remote Plan Remote Backend allows running your Terraform plan locally by triggering a remote plan in env zero.\ The remote plan uses your local Terraform files but actually runs it remotely in env zero while using the shared state and variables set for the env zero environment. Each remote plan creates a deployment in env zero so you will have an audit for each deployment.\ By running a remote plan you can build your IaC faster, and test your changes locally **before committing** them. Additional benefits are the rest of the env zero features that are automatically integrated into your plan logs. It includes: * [Role Based Access](/guides/admin-guide/user-role-and-team-management/user-management) * [Custom Flows](/guides/admin-guide/custom-flows) * [Cost Estimation](/guides/policies-governance/cost-estimation) * [Variables and Secrets](/guides/admin-guide/variables) * [Policies](/guides/policies-governance/policies) * [Plugins](/guides/integrations/plugins) ![Terminal output showing terraform plan triggering a remote plan run in env zero](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/remote-backend/56b8b73-image_5.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=41097d22f532e17c97138333b874409e) ![Remote plan output in the terminal showing plan results streamed from the env zero environment](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/remote-backend/a29345c-image_6.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=01bb411d0563ce1121e3a5e141b5ad32) ## Save a plan and apply it later Save a remote plan to a file, inspect it, and apply exactly that plan without planning again. > [!WARNING] > > Saving and showing a plan requires the **Run Plan** permission. Applying it requires the **Run Apply** permission. Requirements: * OpenTofu 1.6 or later, or Terraform 1.6 or later * The `cloud` block configuration from [Authenticate locally](/guides/admin-guide/remote-backend/login). The `backend "remote"` configuration can't save plans. * Self-hosted agents: v5.1.0 or later ```bash OpenTofu theme={null} tofu plan -out= tofu show tofu show -json tofu apply ``` ```bash Terraform theme={null} terraform plan -out= terraform show terraform show -json terraform apply ``` The plan runs as a remote plan deployment. The apply runs as a separate deployment, or as a destroy if you planned with `-destroy`. Running `apply` with the plan file is the confirmation, so the apply deployment does not wait for approval in env zero. > [!WARNING] > > The output of `show -json` includes the values of sensitive variables and outputs in plain text. Treat the output as a secret. Limitations: * Apply a saved plan within 1 day of creating it. * Each saved plan can be applied once. Applying it again fails. * You can apply only a plan that succeeded. * Workflow sub-environments do not support saved plans. ## .terraformignore If cases where your gitrepo is particularly large, this will cause the remote plan to take a longer time to process (due to compressing and decompressing the gitrepo). You can save time on the remote plan by adding a [`.terraformignore`](https://opentofu.org/docs/cli/cloud/settings/#excluding-files-from-upload-with-terraformignore) to the root of the repo. ```.terraformignore theme={null} /** !my-working-dir/ my-working-dir/.terraform my-working-dir/.terraform/** ``` > [!WARNING] > > ignore the local `.terraform` folder > > If you have a local `.terraform` folder, please add it to the ignore list (like in the example above), otherwise you may get some errors such as `workspace not supported` ## Auditing env zero UI can show you each remote plan deployment that has occurred, accesses its plan logs, and gives you visibility and audit on who actually trigged it from their local environment. ![env zero UI showing audit trail of remote plan deployments with user and commit information](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/remote-backend/ff2b45e-image_4.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=2496b102e557e75501df60da4ed15da5) ## Local Executions If you still wish to run a `plan` or `apply` locally, without a remote execution by env zero - you can do it by enabling terraform's `TF_FORCE_LOCAL_BACKEND` environment variable. ```shell theme={null} TF_FORCE_LOCAL_BACKEND=1 terraform apply ``` > [!WARNING] > > Local Execution > > When running `plan` or `apply` locally, those deployments are not audited in env zero and RBAC and policy control are not enforced. In addition since the code you are running is not commited, we can't attach that deployment to a certain commit or a branch. > > You should avoid using Local Execution as much as possible. ## Next steps When the plan output looks right, [run a remote apply](/guides/admin-guide/remote-backend/remote-apply) to deploy the change from your terminal. # Remote state data source Source: https://docs.envzero.com/guides/admin-guide/remote-backend/remote-state-data-source Use the terraform_remote_state data source to read outputs from env zero remote backend state, sharing VPC IDs and endpoints across Terraform stacks. Terraform allows you to utilize the remote state as a data source. This is particularly useful for retrieving dependent information from a parent resource. env zero's [remote state](/guides/admin-guide/remote-backend) can be used with [Terraform Remote State Data Source](https://developer.hashicorp.com/terraform/language/state/remote-state-data). ```hcl theme={null} data "terraform_remote_state" "example" { backend = "remote" config = { hostname = "backend.api.env0.com" organization = "[ORGANIZATION_ID]" workspaces = { name = "[WORKSPACE_NAME]" } } } ``` > [!NOTE] > > **The WORKSPACE\_NAME is unique per organization.** Here's an example of how its used: ```hcl theme={null} provider "aws" { region = "us-west-2" } data "terraform_remote_state" "vpc" { backend = "remote" config = { hostname = "backend.api.env0.com" organization = "aaaaaaaa-bbbb-cccc-dddd-8f43fe49db92" workspaces = { name = "acme-fitness-agent-vpc" } } } output "vpc_id" { value = data.terraform_remote_state.vpc.outputs.vpc_id } ``` ## Further reading * [Manage Terraform remote state with a remote backend](https://www.envzero.com/blog/terraform-remote-state-using-a-remote-backend) ## Next steps * [Allow the reading environment's project to access the state](/guides/admin-guide/remote-backend/state-access-control) * [Pass values through environment outputs](/guides/admin-guide/variables/environment-outputs) instead of reading the state directly # Using self-hosted remote state Source: https://docs.envzero.com/guides/admin-guide/remote-backend/self-hosted-remote-state Store env zero remote backend state in your own AWS S3 bucket using the env zero Terraform module for data residency and compliance requirements. env zero stores remote backend state securely by default, with encryption and SOC-II compliance. However, if you need to store state within your own AWS account (for example, for data residency or compliance requirements), you can configure env zero to use your own S3 bucket. This only affects environments using the env zero remote backend. Environments using a standard Terraform S3 backend are not affected. > [!NOTE] > > **We recommend using the env zero-provided module** to create the required S3 bucket and IAM resources. The module sets up the correct bucket configuration and a trust relationship that allows env zero's infrastructure to securely access your state. > > It is possible to use an existing S3 bucket, but the bucket configuration and IAM role must match what the module creates. Review the [module source code](https://github.com/env0/remote-state-bucket-module/tree/main/aws) to ensure your existing resources are configured correctly. ## Prerequisites * An AWS account with permissions to create S3 buckets and IAM roles * [AWS credentials configured](/guides/getting-started/connect-your-cloud-account) on the **project** where you will create the environment (if deploying through env zero) * Your env zero Organization ID (found in **Organization Settings**, where you can copy it directly) ## Setup **1. Deploy the remote state bucket module** Deploy the [env0/remote-state-bucket-module](https://github.com/env0/remote-state-bucket-module) to create the required S3 bucket and IAM role in your AWS account. ### Deploying through env zero (recommended) 1. [Create a new template](/guides/admin-guide/templates) with the following settings: * **Repository URL**: `https://github.com/env0/remote-state-bucket-module` * **Terraform folder path**: `aws` 2. Create a new environment from this template * Make sure the **Use env zero Remote Backend** option is **disabled** for this environment 3. Configure the following Terraform variables for the environment: | Variable | Description | | - | - | | `external_id` | Your env zero Organization ID | | `state_bucket_name` | The name for the S3 bucket to create | | `region` | The AWS region to deploy the bucket in | 4. Deploy the environment ### Deploying locally Alternatively, you can deploy the module from your local machine or any other CI/CD pipeline. Make sure you have valid AWS credentials configured (for example, via `aws configure` or environment variables). ```hcl main.tf theme={null} module "remote_state_bucket" { source = "github.com/env0/remote-state-bucket-module//aws" external_id = "" state_bucket_name = "" region = "" } ``` ```bash terraform theme={null} terraform init && terraform apply ``` ```bash opentofu theme={null} tofu init && tofu apply ``` **2. Collect the module outputs** After the apply completes, note the following outputs: | Output | Description | | - | - | | `role_arn` | The IAM role ARN that env zero will assume to access your bucket | | `external_id` | Your env zero Organization ID (used for secure role assumption) | | `region` | The AWS region of your bucket | | `bucket_name` | The name of the created S3 bucket | **3. Contact env zero support** Send the four output values to [env zero support](mailto:support@env0.com). The support team will configure your organization to use your bucket for remote state storage. > [!WARNING] > > **Before contacting support, be aware:** > > * Once configured, **all** env zero remote backend environments in your organization will use the new bucket > * Existing remote backend environments will require a state migration to the new bucket. The support team will guide you through this process. ## Next steps * Contact [env zero support](mailto:support@env0.com) to migrate existing environments into the new bucket * [Restrict which environments can read your state](/guides/admin-guide/remote-backend/state-access-control) # Configuring state access control Source: https://docs.envzero.com/guides/admin-guide/remote-backend/state-access-control Control which environments can access env zero remote state, restricting terraform_remote_state access to specific projects for secure state sharing. ## State Access Control Terraform allows accessing states stored on remote backends using its built in [terraform\_remote\_state](https://developer.hashicorp.com/terraform/language/state/remote-state-data) data resource, env zero allows specifying which environments would be allowed to access an environment's state on env zero triggered deployments. ## Setting Your Environment State Access To set your environment's state access, go to the Environment -> Settings tab and select which [projects](/guides/admin-guide/projects) are allowed to access the environment's state. You can choose to allow access to all environments in your organization or limit access to specific projects or their subprojects. ![Environment Settings page with state access controls listing project options for allowed access](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/remote-backend/5c9c358-image.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=a439ded099f406140ce26173896fe063) After saving these settings only environments in the selected projects or their subprojects will be allowed to fetch that environment's state. > [!NOTE] > > **Note:** > > These settings will only affect deployments that are running inside env zero, for local runs or state access that is from outside env zero the logged-in [API key](/guides/admin-guide/user-role-and-team-management/api-keys) / User personal key permissions will determine if they can access the state or not. ## Next steps * [Read the allowed state from another stack](/guides/admin-guide/remote-backend/remote-state-data-source) with `terraform_remote_state` * [Share environment outputs instead](/guides/admin-guide/variables/environment-outputs), if consumers need specific values rather than the full state # Migrating State Source: https://docs.envzero.com/guides/admin-guide/remote-backend/state-migration Migrate Terraform state to or from env zero remote backend using terraform init -migrate-state, including migrations from TFC, S3, and other backends. For State Migration to work, please make sure the following conditions are met: * if you're migrating the state from another Remote Backend, make sure you are logged in to the previous Remote Backend * Terraform is configured to run with the current backend - this can be done by running `terraform init` (this is needed for Terraform to detect the changes in the Backend configuration) * You're [logged in](/guides/admin-guide/remote-backend/login) to the env zero Remote Backend * You have your *Organization ID* and your *Project ID* To migrate the state: 1. Configure the Remote Backend in your Terraform code: ```hcl theme={null} terraform { cloud { hostname = "backend.api.env0.com" organization = "." workspaces { name = "" } } } ``` 2. Run: ```bash terraform theme={null} terraform init -migrate-state -force-copy ``` ```bash opentofu theme={null} tofu init -migrate-state -force-copy ``` The migration results with: * A new Environment in the given Project, its name is as the given Workspace Name * The Environment's current state will be exactly like the current state of your previous Backend > [!NOTE] > > **Insert Missing Definitions Into Your Generated Environment** > > Since Terraform sends limited data for creating the Environment, there are a few things the generated Environment and its matching Template are missing. > > The Environment is missing [Continuous Deployment configuration](/guides/admin-guide/environments/continuous-deployment). > > The Template is missing VCS configuration (repository, branch, terraform folder). > > We recommend filling in those missing definitions so you can deploy your Environment remotely in env zero and use all of its capabilities and features. ## Migrating from env zero local to env zero remote state env zero local means OpenTofu or Terraform code deployed in env zero with no backend configuration and env zero Remote Backend disabled. > [!WARNING] > > **Required permissions** > > You need **Edit Environment Settings** to enable Remote Backend, **Run Applies** to edit environment variables, and **Run Tasks** to run the migration task. Grant **Run Tasks** with a [custom role](/guides/admin-guide/user-role-and-team-management/custom-roles). Your Terraform version must be 1.x or above. **1. Enable Remote Backend** In the environment's **Settings** tab, select **Use env zero Remote Backend** and click **Save**. If the environment already has state, select **I understand that my existing state will not be migrated automatically** and click **Enable Remote Backend**. **2. Add the migration variable** In the **Variables** tab, add an environment variable named `TF_CLI_ARGS_init` with the value `-migrate-state -force-copy`, and save. **3. Migrate the state** From the environment's context menu, select [**Run a Task**](/guides/admin-guide/environments/ad-hoc-tasks), enter `terraform state list` (or `tofu state list` for OpenTofu), and run the task. env zero's own `init` step copies the existing state into the Remote Backend and logs `Successfully configured the backend "remote"`, and `terraform state list` prints the migrated resources. You can redeploy the environment instead of running a task. The deployment's `init` step migrates the state the same way. Don't run `terraform init -migrate-state` as the task command. env zero's own `init` step runs before your commands and fails with `Error asking for state migration action: input is disabled`. **4. Remove the migration variable** In the **Variables** tab, delete `TF_CLI_ARGS_init`. **5. Verify** Redeploy the environment. The plan shows no changes. To run this migration through the API, or on a workflow sub-environment, which has no **Settings** tab, see [Enable Remote Backend on a workflow sub-environment](/guides/admin-guide/remote-backend#enable-remote-backend-on-a-workflow-sub-environment). ## Migrating from TFC/TFE to env zero remote state ### Option 1: Using the env zero migration wizard (recommended) The built-in migration wizard automates workspace discovery, variable migration, state transfer, and controlled cutover - all from the env zero UI. This is the fastest and safest way to migrate from TFC/TFE. See the full guide: [Migrate from Terraform Cloud](/guides/admin-guide/tfc-migration). ### Option 2: Migrating the workspace manually 1. Update your TFC/TFE workspace settings from Execution mode to Local mode, and Save settings. Note: Before you change this setting, make a quick note of your variable configurations in TFC/E.\\ ![TFC workspace settings showing Execution mode changed to Local before migration](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/remote-backend/3388e13-cleanshot_2023-03-31_at_15.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=28c011e3bfb383691168936e99cdc73f) 2. In TFC/TFE, go to User Profile and head over to User Settings. Select Tokens, then Create an API token and hit Save to save the token for the next step. 3. Ensure the API token has the correct privileges. This typically means a User or Team token needs to be created, not an Organization token. 4. In env zero, create a new **env zero environment** (from VCS Environment) 1. IaC Type: Terraform 2. Under Advanced, Select the same Terraform Version used with TFC. Select **NEXT**\\ ![env zero new environment Advanced settings showing the Terraform version selector matching TFC](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/remote-backend/af936bb-cleanshot_2023-04-04_at_11.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=64797ce7c4db537d4e027183508ba4ab) 3. Under **VCS**: Select the same Git Repo, Branch (aka Revision), and Folder as configured for TFC/E. Select **NEXT** 4. Under **Variables**: Add any [variables](/guides/admin-guide/variables) used in your TFC/E workspace. 5. Add an environment variable: `TF_TOKEN_app_terraform_io` (or `TF_TOKEN_your_tfe_host` if you are using a custom hostname) and add the token created in step 3. This variable can be saved at the Organization or Project level if you are planning on migrating more than one workspace manually.\ Note: This configuration only works for TF v. 1.2+ 6. Add an environment variable:`ENV0_SKIP_WORKSPACE=true` This setting will avoid the error `workspaces not supported` - when using TFC/E remote backend. 7. Copy the existing workspace name you're using in TFC/E. e.g., my-prod-resource to the Environment Details - Workspace Name. Note: this is not the ws- ID, but the name you provided. ![Environment Details form with the Workspace Name field populated from the TFC workspace name](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/remote-backend/9c3e037-cleanshot_2023-05-18_at_21.jpg?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=dd5787e4bf9d21aa0c4159f808de64f8) 5. Do NOT select Use env zero remote Backend – we will do this later. 6. **Run** the environment. You should expect to see no changes (assuming you've made no other changes to the code or variables); TFC/E 7. Update the Remote Backend to use env zero's remote backend and then push the code to Git. This may start a new deployment. 8. Your Organization ID can be found under Organization Settings.\ You may receive a Deploy Failed (Error: Backend configuration changed) error which is to be expected. We will fix this in the next step. ```hcl theme={null} cloud { hostname = "backend.api.env0.com" organization = "." workspaces { name = "my-prod-resource" } } ``` 9. Under **Environment > Settings**: **Check** "Use env zero remote Backend" and "**SAVE**" ![Environment Settings with Use env zero Remote Backend checkbox enabled and saved](https://mintcdn.com/envzero-b61043c8/pvGFjFxaiqGDTFG3/images/guides/admin-guide/remote-backend/1acafe0-cleanshot_2023-03-30_at_13.png?fit=max\&auto=format\&n=pvGFjFxaiqGDTFG3\&q=85\&s=cad7438c6b79de67ef848d2336649e16) 10. **Re-deploy** with the following Environment Variables: * Add `TF_CLI_ARGS_init=-migrate-state -force-copy` * Delete `ENV0_SKIP_WORKSPACE=true` 11. Your deployment logs under Terraform Init should show this or a similar message: > [!NOTE] > > **Backend configuration changed!** > > Terraform has detected that the configuration specified for the backend has changed. Terraform will now check for existing state in the backends. > > Successfully configured the backend "remote"! Terraform will automatically use this backend unless the backend configuration changes. 12. **(Optional)** Redeploy and remove the `TF_TOKEN_app_terraform_io/TF_TOKEN_your_tfe_host` and `TF_CLI_ARGS_init` to clean up. 13. **(Optional)** The `backend remote` block can be removed if you are not using the remote plan feature. 14. **Your migration is now complete.** ### Option 3: Migrating the workspace using the env zero migration script The env zero migration tool is an open source CLI tool that allows migrating states from TFC, as well as the workspaces themselves, and other configuration from your TFC account. See the [env zero migration tool](https://github.com/env0/env0-migration-tool/tree/main/TFC) for instructions. ## Migrating from env zero remote backend to a third-party bucket 1. Add the remote backend code block to the environment you want to migrate. ```hcl theme={null} terraform { cloud { hostname = "backend.api.env0.com" organization = "." workspaces { name = "" } } } ``` 2. Remote login to env zero: 1. Run `terraform login backend.api.env0.com` 2. Enter `yes` when prompted 3. Insert your `token` (See [Generating a Token](/guides/admin-guide/remote-backend/login/#generating-a-token)) 3. Run `terraform plan` and ensure you are working in the correct environment. 1. You should see this trigger a plan in env zero 4. (Optional) Run `terraform state pull > backup.state` to pull the state to a local file. 5. Remove the remote backend code block from step 1. 6. Add a backend code block for the new remote backend of your choosing ([Terraform Backends](https://developer.hashicorp.com/terraform/language/settings/backends/configuration#backend-configuration)). 7. Run `terraform init -migrate-state`, respond to the prompt with `yes` 8. Run `terraform plan`. You should expect to see no or minimal changes. 9. (If necessary, in conjunction with step 4) Run `terraform state push backup.state` to push your state to your new remote backend. 10. The state has now been migrated to your configured backend. 1. If you are moving away from env zero, the environment can be [marked as inactive](/guides/admin-guide/environments#mark-an-environment-as-inactive), which leaves its resources in place. 2. If you are moving states between env zero, the old environment will need to be marked as inactive and a new environment will have to be created. ## Migrating from third-party bucket to env zero remote backend 1. (Optional) Run `terraform state pull > remote.state` to pull the state to a local file. 2. Swap the backend configuration with env zero's ```hcl theme={null} terraform { cloud { hostname = "backend.api.env0.com" organization = "." workspaces { name = "" } } } ``` 3. run `terraform init` and enter `yes` ```text theme={null} Initializing cloud backend... Migrating from backend "s3" to cloud backend. Do you wish to proceed? As part of migrating to cloud backend, Terraform can optionally copy your current workspace state to the configured cloud backend workspace. Answer "yes" to copy the latest state snapshot to the configured cloud backend workspace. Answer "no" to ignore the existing state and just activate the configured cloud backend workspace with its existing state, if any. Should Terraform migrate your existing state? Enter a value: yes ``` 4. env zero will detect the new state and create an environment for you - the name will be your workspace name. 1. Make sure to update the VCS details to point to your real VCS ## Troubleshooting Error: Backend configuration changed – make sure that you add an Environment Variable with`TF_CLI_ARGS_init=-migrate-state -force-copy` ## Further reading * [A guide to the Terraform state file](https://www.envzero.com/blog/a-guide-to-the-terraform-state-file) * [Manage Terraform remote state with a remote backend](https://www.envzero.com/blog/terraform-remote-state-using-a-remote-backend) ## Next steps * [Restrict which environments can read the migrated state](/guides/admin-guide/remote-backend/state-access-control) * [Read its outputs from other stacks](/guides/admin-guide/remote-backend/remote-state-data-source) with `terraform_remote_state` # Integrate with Terraform Cloud Remote Backend Source: https://docs.envzero.com/guides/admin-guide/remote-backend/working-with-terraform-cloud-remote-backend Use env zero with Terraform Cloud remote backend for state storage during evaluation or migration, requiring local execution mode and an API token. > [!WARNING] > > **Disclaimer** > > As a default when using env zero we don't recommend to store your state in Terraform Cloud, and if using env zero we would recommend using a different [remote backend](/guides/admin-guide/remote-backend). > > There are a few limitations to using this setup and it's hard to maintain. > > We recommend using this setup only for evaluating the env zero platform and if you are currently managing your state with Terraform Cloud. If you are currently working with Terraform Cloud remote backend and would like to use env zero with this setup you will need to do the following: 1. Local execution mode - First you need to change the workspace settings in Terraform Cloud to enable local runs, so you need to go to the `General Settings` of the workspace and change the `Execution Mode` to Local. 2. Generating a token for authentication - To authenticate to Terraform Cloud remote backend you need to generate an API token, so under the `User settings` under `Tokens` and create an API token. Please save the token, we will need it in the further steps. 3. If you are running terraform version 1.2.0 or up you will need to add the following [environment variables](/guides/admin-guide/variables#terraform-variables-and-environment-variables): | Variable Name | Value | | :- | :- | | `TF_TOKEN_app_terraform_io ` | The API token you've created in Terraform Cloud | | `ENV0_SKIP_WORKSPACE` | `true` | 4. If not you will need to add an `env0.yml` file - In your Terraform git repo you will need to add an `env0.yml` file in the Terraform folder and add the following code: ```text theme={null} version: 1 deploy: steps: setupVariables: after: - printf "credentials \"app.terraform.io\" {\n token = \"${TF_CLOUD_TOKEN}\"\n}" > ~/.terraformrc destroy: steps: setupVariables: after: - printf "credentials \"app.terraform.io\" {\n token = \"${TF_CLOUD_TOKEN}\"\n}" > ~/.terraformrc ``` In addition, you will need to add template variables - you'll need to add 2 variables in your env zero [template](/guides/admin-guide/templates): | Variable Name | Value | | :- | :- | | `TF_CLOUD_TOKEN` | The API token you've created in Terraform Cloud | | `ENV0_SKIP_WORKSPACE` | `true` | 5. Now you are ready to run your Template and the remote backend should be stored in Terraform Cloud. ## Further reading * [Terraform backend configuration: local and remote options](https://www.envzero.com/blog/a-guide-to-local-and-remote-backends-in-terraform) * [Manage Terraform remote state with a remote backend](https://www.envzero.com/blog/terraform-remote-state-using-a-remote-backend) ## Next steps When you are ready to move your workspaces off Terraform Cloud, use the [Terraform Cloud migration wizard](/guides/admin-guide/tfc-migration). # Authenticating the agent on AWS EKS Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/authenticating-the-agent-on-aws-eks Authenticate env zero self-hosted agents on AWS EKS using Pod Identity, IRSA, or Node Roles, with credential resolution order and service account setup. If your [env zero agent](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent) runs on an AWS EKS cluster, you can use any of these methods to assign an AWS IAM role to your deployments. > [!NOTE] > > **Credential Resolution Order** > > The env zero deployment agent resolves credentials in the following priority order: > > 1. Pod Identity > 2. IRSA (IAM Roles for Service Accounts) > 3. Node Role > > This order ensures that more granular and secure identity methods (like Pod Identity and IRSA) are preferred over the instance-level Node Role. ## Using EKS Pod Identity EKS Pod Identity simplifies the management of IAM permissions for applications on EKS clusters by allowing administrators to associate IAM roles directly with Kubernetes service accounts, eliminating the need for OIDC identity providers and enabling role reuse across multiple clusters. > [!WARNING] > > Version Support > > To use EKS Pod Identity with Terraform, you must be using: > > * Terraform AWS Provider version ≥ 5.27.0 > * if fetching credentials for the S3 backend - OpenTofu version ≥ 1.10.0 > > Earlier versions do not support EKS Pod Identity and will fall back to other credentials (IRSA, Node Roles, etc). For more details about EKS Pod identity and how to configure it, refer to the [EKS User Guide](https://docs.aws.amazon.com/eks/latest/userguide/pod-identities.html). ## Using IAM Roles for Service Accounts (IRSA) IAM Roles for Service Accounts (IRSA) in Amazon EKS allow Kubernetes pods to securely assume IAM roles, enabling fine-grained access to AWS services without managing AWS credentials within the pods. For more details about IRSA and how to configure it, refer to the [EKS User Guide](https://docs.aws.amazon.com/eks/latest/userguide/iam-roles-for-service-accounts.html). > [!NOTE] > > **Using a Custom Kubernetes Service Account** > > By default, env zero uses the default service account within the namespace where the agent is installed. > > To specify a different service account, set the `deploymentJobServiceAccountName` [Helm value](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration#deploymentjobserviceaccountname). > > For detailed steps on configuring a new service account, refer to this [AWS Guide](https://docs.aws.amazon.com/eks/latest/userguide/associate-service-account-role.html). > [!WARNING] > > IRSA & EKS Pod Identity Session Expiry > > Please note that when using IRSA or EKS Pod Identity, the assumed session is only valid for 1 hour. > > This limitation exists because these methods internally assume the role associated with the Kubernetes service account, and role chaining is restricted to 1-hour sessions. ## Using the Node Role The Node Role is the IAM Role assigned to the EC2 instances that serve as nodes in your EKS cluster. You can use this role directly by assigning the appropriate permissions required for your env zero deployments. For more details, refer to the [EKS User Guide](https://docs.aws.amazon.com/eks/latest/userguide/create-node-role.html). > [!WARNING] > > Restricting Access to the Node IAM Role > > If you are using AWS EKS and do not want to use the Node IAM Role, you must explicitly restrict access to it. > > More details can be [found here](https://aws.github.io/aws-eks-best-practices/security/docs/iam/#restrict-access-to-the-instance-profile-assigned-to-the-worker-node) # Authenticating the agent on Azure AKS Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/authenticating-the-agent-on-azure-aks Authenticate env zero self-hosted agents on Azure AKS using workload identity and federated tokens, with azurerm provider and Helm configuration. If your [agent](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent) runs on an Azure AKS cluster, you can use the following method to assign an Azure AD identity to your env zero deployments. ## Using workload identity You can associate an IAM role with a Kubernetes Service Account (KSA). The KSA that will be used by env zero is the `default` KSA under the `env0-agent` namespace. You'll need to follow the Azure guide - [Deploy and configure workload identity on an Azure Kubernetes Service (AKS) cluster](https://learn.microsoft.com/en-us/azure/aks/workload-identity-deploy-cluster) . The `SERVICE_ACCOUNT_NAMESPACE` will be `env0-agent` and the `SERVICE_ACCOUNT_NAME` will be `default`. If you override these parameters in your installation, make sure to use the correct values, i.e., pass the correct name of the service account to `deploymentJobServiceAccountName` within the [agent's helm values](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration#deploymentjobserviceaccountname). Now, in order for the pods to use the identity, they should be labeled with `azure.workload.identity/use: "true"`. To achieve this, you need to add into the `podAdditionalLabels` field of your agent's helm values those field and value. e.g., ```yaml values.customer.yaml theme={null} "podAdditionalLabels": "azure.workload.identity/use": "\"true\"" ``` ### Configuring Terraform Provider to use an AKS workload identity Follow this official azurerm provider guide - [terraform registry documentation](https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/guides/aks_workload_identity#configuring-terraform-to-use-an-aks-workload-identity). ### Configuring Azure Backend to use an AKS workload identity When configuring the Azure Backend, you need to make sure that the Client ID, Tenant ID, and OIDC are configured. You have to make sure to have the backend is configured as using OIDC, and with the OIDC token taken from the `AZURE_FEDERATED_TOKEN_FILE` The are a couple of ways to do that: 1. In the backend configuration itself, make sure to set the following values: ```hcl theme={null} terraform { backend "azurerm" { resource_group_name = "StorageAccount-ResourceGroup" # Can be passed via `-backend-config=`"resource_group_name="` in the `init` command. storage_account_name = "abcd1234" # Can be passed via `-backend-config=`"storage_account_name="` in the `init` command. container_name = "tfstate" # Can be passed via `-backend-config=`"container_name="` in the `init` command. key = "prod.terraform.tfstate" # Can be passed via `-backend-config=`"key="` in the `init` command. use_oidc = true # Can also be set via `ARM_USE_OIDC` environment variable. oidc_token_file_path = "/var/run/secrets/azure/tokens/azure-identity-token" # Should be set to the value of AZURE_FEDERATED_TOKEN_FILE, usually "/var/run/secrets/azure/tokens/azure-identity-token" client_id = "00000000-0000-0000-0000-000000000000" # Can also be set via `ARM_CLIENT_ID` environment variable. subscription_id = "00000000-0000-0000-0000-000000000000" # Can also be set via `ARM_SUBSCRIPTION_ID` environment variable. tenant_id = "00000000-0000-0000-0000-000000000000" # Can also be set via `ARM_TENANT_ID` environment variable. } } ``` 2. Use environment variables to set `ARM_CLIENT_ID`to the client ID, `ARM_TENANT_ID` to the tenant ID, `ARM_USE_OIDC` to true, and `ARM_OIDC_TOKEN_FILE_PATH` to the value of `AZURE_FEDERATED_TOKEN_FILE` (usually "/var/run/secrets/azure/tokens/azure-identity-token") Follow the official azure backend guide - [azure backend documentation](https://developer.hashicorp.com/terraform/language/settings/backends/azurerm#backend-azure-ad-service-principal-or-user-assigned-managed-identity-via-oidc-workload-identity-federation) > [!WARNING] > > You must set oidc\_token\_file\_path > > The official guide does not mention it, but if you do not provide the OIDC token explicitly, then the backend will ignore the `use_oidc` configuration. Unlike the azurerm Terraform Provider, which automatically picks up the token from `AZURE_FEDERATED_TOKEN_FILE` ### Access Key Vault secrets If accessing sensitive values stored in Azure Key Vault is required during your deployments, you should also accomplish this optional step from the AKS guide - [Grant permissions to access Azure Key Vault](https://learn.microsoft.com/en-us/azure/aks/workload-identity-deploy-cluster#optional---grant-permissions-to-access-azure-key-vault) ### Verifying the cluster is configured properly Once the cluster is configured for using the workload identity, you can run this command from a pod on it to validate all the correct parameters are exported correctly: `az login --service-principal -u $AZURE_CLIENT_ID -t $AZURE_TENANT_ID --federated-token $(cat $AZURE_FEDERATED_TOKEN_FILE)`. The pod will need the correct labels for the namespace, service account, and `azure.workload.identity/use: "true"`. If the command ran without error, you may also check the Key Vault access with the following command `az keyvault secret list --vault-name ` # Autoscaling self-hosted agents on Azure Container Apps Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/autoscaling-on-azure-container-apps Run env zero self-hosted agents as ephemeral Azure Container Apps Jobs that scale to zero when idle and spin up on demand, using KEDA autoscaling. Run env zero self-hosted agents as ephemeral Azure Container Apps (ACA) Jobs that scale to zero when idle and spin up automatically when deployments are queued. Scaling is driven by KEDA, which is built into the Azure Container Apps managed environment, so no separate KEDA installation is required. > [!NOTE] > > Self-hosted agents are available to Enterprise customers only. See [pricing](https://www.envzero.com/pricing) for details. ## How It Works KEDA polls the env zero agent queue state endpoint on a fixed interval and creates ACA job executions when deployment tasks are queued. Each container picks up one task, runs it to completion, and exits. When the queue is empty, no containers run. ## Prerequisites * Azure CLI installed and authenticated (`az login`) * Azure subscription with Contributor access * An env zero agent pool with a valid agent access token. See [Self-hosted agents overview](/guides/admin-guide/self-hosted-kubernetes-agent/overview) for how to create an agent pool and generate a secret. ## Setup **1. Create a resource group** ```bash theme={null} az group create -n env0-keda -l ``` **2. Create a Container Apps environment** ```bash theme={null} az containerapp env create \ -n env0-keda-env \ -g env0-keda \ -l ``` This creates a managed environment with KEDA built in. No KEDA installation is needed. **3. Create the job configuration file** Save the following as `env0-aca-job.yaml`. Replace `` with the agent access token generated for your agent pool, `` with a base64-encoded encryption key, and `` with the agent version you want to pin to. ```yaml env0-aca-job.yaml theme={null} properties: configuration: triggerType: Event replicaTimeout: 3600 replicaRetryLimit: 0 secrets: - name: agent-token value: "" eventTriggerConfig: parallelism: 1 replicaCompletionCount: 1 scale: minExecutions: 0 maxExecutions: 10 pollingInterval: 30 rules: - name: env0-pending-tasks type: metrics-api metadata: url: "https://agent.api.env0.com/deployment-tasks/queue-state" valueLocation: "pendingCount" targetValue: "1" activationTargetValue: "0" authMode: "apiKey" method: "header" keyParamName: "Authorization" auth: - secretRef: agent-token triggerParameter: apiKey template: containers: - name: env0-agent image: ghcr.io/env0/deployment-agent: command: ["/bin/sh", "-c"] args: ["update-ca-certificates; node --enable-source-maps start-agent.js;"] resources: cpu: 2 memory: 4Gi env: - name: AGENT_ACCESS_TOKEN secretRef: agent-token - name: ENV0_STATE_ENCRYPTION_KEY value: "" - name: ENV0_STAGE value: "prod" ``` **4. Create the job** ```bash theme={null} az containerapp job create \ -n env0-agent-job \ -g env0-keda \ --environment env0-keda-env \ --yaml env0-aca-job.yaml ``` > [!WARNING] > > `ENV0_STATE_ENCRYPTION_KEY` must be a base64-encoded value and identical across all agent replicas. Mismatched keys make encrypted deployment state unreadable, which results in data loss. > [!NOTE] > > Pin `image` to a specific agent version rather than `:latest` to avoid silent upgrades during a running deployment. See the [env0 deployment agent releases](https://github.com/env0/agent/releases) for current tags. ## Configuration Reference ### KEDA Scaling Parameters | Parameter | Default | Description | | - | - | - | | `pollingInterval` | `30` | Seconds between KEDA polls of the queue state endpoint. | | `maxExecutions` | `10` | Maximum concurrent agent containers. | | `minExecutions` | `0` | Set to 1 or higher to keep warm containers running. | | `replicaTimeout` | `3600` | Maximum seconds a container can run before forced termination. | | `targetValue` | `1` | Tasks per container. `1` means one container per pending task. | | `activationTargetValue` | `0` | Metric threshold that activates scaling from zero. | ### Container Resources | Parameter | Default | Description | | - | - | - | | `cpu` | `2` | CPU cores per container. | | `memory` | `4Gi` | Memory per container. | ### Environment Variables | Variable | Required | Description | | - | - | - | | `AGENT_ACCESS_TOKEN` | Yes | Agent authentication token. Stored as an ACA secret and referenced by `secretRef`. | | `ENV0_STAGE` | Yes | Determines which env zero API endpoint the agent connects to. Use `prod` for production. | | `ENV0_STATE_ENCRYPTION_KEY` | Yes | Base64-encoded encryption key for deployment state. Must be identical across all agent replicas. | | `DEPLOYMENT_LOGS_LOG_LEVEL` | No | Set to `debug` for verbose agent logging. | ## Monitoring List running and completed executions: ```bash theme={null} az containerapp job execution list -n env0-agent-job -g env0-keda -o table ``` View logs for a specific execution: ```bash theme={null} az containerapp job logs show \ -n env0-agent-job -g env0-keda \ --container env0-agent \ --execution \ --follow false ``` Stop a running execution: ```bash theme={null} az containerapp job stop \ -n env0-agent-job -g env0-keda \ --job-execution-name ``` ## Troubleshooting ### No containers start when deployments are queued Check the KEDA system logs for the Container Apps environment: ```bash theme={null} az containerapp env show -n env0-keda-env -g env0-keda \ --query 'properties.appLogsConfiguration.logAnalyticsConfiguration.customerId' -o tsv az monitor log-analytics query -w \ --analytics-query "ContainerAppSystemLogs_CL | order by TimeGenerated desc | take 20" \ -o table ``` Common causes: * `api returned 401`: the agent access token is incorrect or has been revoked. Generate a new secret and update the job configuration. * No KEDA activity logged: verify the job was created with `triggerType: Event`. ### A container starts but fails immediately Check the container logs for the specific error. Common causes: * Missing `ENV0_STAGE`: deployment commands build URLs from this variable and produce broken hosts when it is unset. Set it explicitly to `prod` for production. * Missing `ENV0_STATE_ENCRYPTION_KEY`: the agent exits immediately with an error. * Wrong `AGENT_ACCESS_TOKEN`: the agent starts but receives 401 on API calls. ## Cleanup To remove all resources created for this setup: ```bash theme={null} az group delete -n env0-keda -y ``` ## Next Steps * [Self-hosted agents overview](/guides/admin-guide/self-hosted-kubernetes-agent/overview) - Create agent pools and manage authentication secrets. * [Custom/optional configuration](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration) - Additional agent configuration options. * [Self-Hosted Agents Monitoring](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-agents-monitoring) - Monitor agent health and deployments. # Using cache with PVC Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/cache-with-pvc Enable plugin caching with Persistent Volume Claims on the env zero self-hosted Kubernetes agent to reduce provider download times for Terraform runs. This page explains how to enable plugin caching for OpenTofu (also applies to Terraform and Terragrunt) when using a Self-Hosted Kubernetes Agent with [Persistent Volume Claims (PVC)](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#persistent-volume/storage-class-optional). This feature is available for SHAG (Self-Hosted Agent on Kubernetes) customers only. ## Overview To improve performance in infrastructure-as-code environments, env zero supports an optional plugin cache. This cache stores previously downloaded provider plugins on a persistent volume, allowing reuse across runs within the same environment. The plugin cache can reduce run times and avoid redundant downloads when enabled. This caching mechanism is opt-in and requires specific environment variables. It is supported only for environments running with a self-hosted Kubernetes agent that uses PVC. ## Prerequisites Before enabling plugin caching, ensure that: * You are using Self-Hosted Kubernetes Agent (SHAG) v3.0.1082 or above * Your agent is already configured to use Persistent Volume Claims (PVC) * You are running OpenTofu, Terraform, or Terragrunt ## Enabling Plugin Cache There are two supported ways to use plugin caching with PVC: ### Option 1 - Agent’s Existing PVC (Recommended) If your agent is already configured with a PVC (e.g., for state, working directory, etc.), enable caching by setting: ```bash theme={null} ENV0_USE_TF_PLUGIN_CACHE=true ``` **Where to set this?** * As an Organization or Project [Environment Variable](/guides/admin-guide/variables) in env zero When this variable is set, env zero will use a persistent volume to cache provider plugins used by OpenTofu, Terraform, or Terragrunt. These plugins will then be reused in subsequent runs within the same environment ### **Option 2 – Using a Dedicated PVC for Terraform Plugin Cache (Advanced)** If you have multiple PVCs, and you want to explicitly choose which PVC is used for Terraform plugin cache, then do not set `ENV0_USE_TF_PLUGIN_CACHE=true` Instead, set the following in your [Helm values](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration#agentadditionalenvvars) under `agentAdditionalEnvVars` (or `podAdditionalEnvVars`): ```yaml theme={null} agentAdditionalEnvVars: - name: TF_PLUGIN_CACHE_DIR value: "/path/to/your/pvc/cache" - name: TF_PLUGIN_CACHE_MAY_BREAK_DEPENDENCY_LOCK_FILE value: "true" ``` ### Wiping the Cache If you need to wipe the plugin cache before a run (for example, to force re-downloading of providers or resolve potential cache issues), set the following additional environment variable: `ENV0_WIPE_TF_PLUGIN_CACHE=true` > [!NOTE] > > This variable only takes effect if `ENV0_USE_TF_PLUGIN_CACHE` is also set. When both variables are set, the plugin cache will be cleared before the run begins. > [!WARNING] > > Requirements > > * Self-Hosted Kubernetes Agent (SHAG) v3.0.1082 or above > * Use of Persistent Volume Claims (PVC) for storage > * Applies to environments using OpenTofu, Terraform, or Terragrunt # Using custom CA certificates Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/custom-ca-certificates Add custom or self-signed CA certificates to your env zero self-hosted Kubernetes agent using Kubernetes secrets and the customCertificates Helm value. If you use custom CA certificates in your deployment process, such as self-signed certificates, you can add them to env zero's [Self-Hosted Agent](/guides/admin-guide/self-hosted-kubernetes-agent). To do so, you can attach certificates using the `customCertificates` helm value that can be set in the [configuration](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration). Its value should be a list of Kubernetes Secret names. Each secret may contain one or more custom certificate files. For instance, you can add your CA file using the following command in your cluster: ```shell theme={null} kubectl create secret generic my-self-signed-cert --from-file=my-self-signed-cert.cer --namespace=env0-agent ``` Then, in your Helm values file, add the related config: ```yaml yaml theme={null} "customCertificates": - "my-self-signed-cert" ``` Now you can proceed with the agent [upgrade](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#upgrade)/[installation](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#installation). > [!NOTE] > > **Node.js scripts** > > During env zero deployment some customers may want to use Node.js scripts. > > > [!NOTE] > > > > To make sure your script using the custom certificates, please add the `NODE_EXTRA_CA_CERTS` environment variable with the value of `/etc/ssl/certs/ca-certificates.crt`. That file contains all the certificates in our agent's pod. > [!WARNING] > > Ignore CA Certs > > Set `gitSslNoVerify` to `true` in your helm values to ignore CA certs. ## Next steps For the full `customCertificates` reference, see its entry in [Custom/optional configuration](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration#customcertificates). # Custom/optional configuration Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration Helm values reference for the env zero self-hosted Kubernetes agent, covering authentication, Docker image, resource limits, and pod scheduling options. To install the agent, you provide the `agentAccessToken` value from the env zero UI (see [Creating an Agent Pool](/guides/admin-guide/self-hosted-kubernetes-agent/overview#creating-an-agent-pool)). For additional configuration, create a `values.customer.yaml` file with any of the following optional values: ## Authentication ### `agentAccessToken` * **Description:** The agent access token for authenticating with the env zero platform. Generated when you create an agent secret in the env zero UI. * **Required:** Yes. This is the only required value for agent installation. * **Can be provided via a Kubernetes Secret?** Yes:\ `AGENT_ACCESS_TOKEN` ## Image & container configuration ### `dockerImage` / `agentImagePullSecret` * **Description:** Custom Docker image URI and Base64 encoded `.dockerconfigjson` contents * **Required for feature:** Custom Docker image. See [Extending deployment image](/guides/admin-guide/self-hosted-kubernetes-agent/extending-deployment-image) * **Can be provided via a Kubernetes Secret?** No ### `agentImagePullSecretRef` * **Description:** A reference to a k8s secret name that holds a Docker pull image token * **Required for feature:** Custom Docker image that is hosted on a private Docker registry * **Can be provided via a Kubernetes Secret?** No ## Cost estimation & AWS deployment credentials ### `infracostApiKeyEncoded` * **Description:** Base64 encoded Infracost API key * **Required for feature:** Cost Estimation * **Can be provided via a Kubernetes Secret?** Yes:\ `INFRACOST_API_KEY` ### `assumerKeyIdEncoded` / `assumerSecretEncoded` * **Description:** Base64 encoded AWS Access Key ID & Secret * **Required for feature:** AWS Assume role for deploy credentials. Also, see [Authenticating the agent on AWS EKS](/guides/admin-guide/self-hosted-kubernetes-agent/authenticating-the-agent-on-aws-eks) * **Can be provided via a Kubernetes Secret?** Yes:\ `ASSUMER_ACCESS_KEY_ID`\ `ASSUMER_SECRET_ACCESS_KEY` ## Resources & pod scheduling ### `limits.cpu` / `limits.memory` * **Description:** Container resource limits\ [Read more about resource allocation](https://kubernetes.io/docs/concepts/configuration/manage-resources-containers/)\ Chart defaults: `cpu: 460m` and `memory: 1500Mi`. Recommended for production workloads: `cpu: 1.5` and `memory: 3Gi` * **Required for feature:** Custom deployment pod size * **Can be provided via a Kubernetes Secret?** No ### `requests.cpu` / `requests.memory` * **Description:** Container resource requests. Chart defaults: `cpu: 460m` and `memory: 1500Mi`. Recommended for production workloads: `cpu: 1.5` and `memory: 3Gi` * **Required for feature:** Custom deployment container resources * **Can be provided via a Kubernetes Secret?** No > [!NOTE] > > These values are recommended for production workloads. The chart default resource requests are `cpu: 460m` and `memory: 1500Mi`; resource limits are unset by default. Adjust based on your deployment frequency and concurrency requirements. ### `tolerations` * **Description:** An array of `toleration` objects to apply to all pods. see [docs](https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/) * **Required for feature:** Custom tolerations * **Can be provided via a Kubernetes Secret?** No ### `deploymentTolerations` * **Description:** An array of `toleration`objects - targeting the deployment pods. This will override the default `tolerations` for deployment pods. * **Required for feature:** Custom tolerations * **Can be provided via a Kubernetes Secret?** No ### `affinity` * **Description:** Allows you to constrain which nodes env zero pods are eligible to be scheduled on. see [docs](https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/) * **Required for feature:** Custom node affinity * **Can be provided via a Kubernetes Secret?** No ### `deploymentAffinity` * **Description:** Affinity for deployment pods. This will override the default `affinity` for deployment pods. * **Required for feature:** Custom node affinity * **Can be provided via a Kubernetes Secret?** No ## Cloud secret managers ### `customerAwsAccessKeyIdEncoded` / `customerAwsSecretAccessKeyEncoded` / `awsSecretsRegion` * **Description:** Base64 encoded AWS Access Key ID & Secret. Requires the `secretsmanager:GetSecretValue` permission * **Required for feature:** Using AWS Secrets Manager to store secrets for the agent * **Can be provided via a Kubernetes Secret?** Yes:\ `CUSTOMER_AWS_ACCESS_KEY_ID`\ `CUSTOMER_AWS_SECRET_ACCESS_KEY` ### `customerGoogleProject` / `customerGoogleCredentials` * **Description:** Base64 encoded GCP project name and JSON service-key contents. Requires the `Secret Manager Secret Access` role. * **Required for feature:** Using GCP Secret Manager to store secrets for the agent. These credentials are not used for the deployment itself. If `deploymentJobServiceAccountName` is set - Workload identity will override any supplied credentials. * **Can be provided via a Kubernetes Secret?** Yes:\ `CUSTOMER_GOOGLE_PROJECT`\ `CUSTOMER_GOOGLE_CREDENTIALS` ### `customerAzureClientId` / `customerAzureClientSecret` / `customerAzureTenantId` * **Description:** Base64 encoded Azure Credentials. * **Required for feature:** Using Azure Key Vault Secrets to store secrets for the agent * **Can be provided via a Kubernetes Secret?** Yes:\ `CUSTOMER_AZURE_CLIENT_ID`\ `CUSTOMER_AZURE_CLIENT_SECRET`\ `CUSTOMER_AZURE_TENANT_ID` ### `customerOracleCredentials.tenancyOCIDEncoded` / `customerOracleCredentials.userOCIDEncoded` / `customerOracleCredentials.apiKeyFingerprintEncoded` / `customerOracleCredentials.apiKeyPrivateKeyEncoded` / `customerOracleCredentials.secretsRegion` * **Description:** OCI credentials.\ All should be defined separately within the same object - `customerOracleCredentials`.\ Any field that ends with `Encoded` should be Base64 encoded. * **Required for feature:** Using OCI Vault to store secrets for the agent. These credentials are not used for the deployment itself. * **Can be provided via a Kubernetes Secret?** Yes:\ `CUSTOMER_ORACLE_TENANCY_OCID`\ `CUSTOMER_ORACLE_USER_OCID`\ `CUSTOMER_ORACLE_API_KEY_FINGERPRINT`\ `CUSTOMER_ORACLE_API_KEY_PRIVATE_KEY`\ `ORACLE_SECRETS_REGION` ## HashiCorp Vault ### `customerVaultTokenEncoded` / `customerVaultUrl` * **Description:** **(Deprecated)** Base64 encoded HCP Vault token, and the Vault's URL (also base64 encoded) * **Required for feature:** Using HCP Vault to store secrets for the agent * **Can be provided via a Kubernetes Secret?** Yes:\ `CUSTOMER_VAULT_TOKEN`\ `CUSTOMER_VAULT_ADDRESS` ### `vault` * **Description:** Set HCP Vault authentication.\ First, set the cluster's URL:\ `address:` (equivalent to VAULT\_ADDR)\ `loginPath: ""` - (Optional)\ Then, you should choose one of the following login method:\ \- [By Vault token](https://developer.hashicorp.com/vault/docs/auth/token)\ `method: "token"`\ `encodedToken: ""`\ \- [By Username & Password ](https://developer.hashicorp.com/vault/docs/auth/userpass)\ `method: "password"`\ `username: "" `\ `encodedPassword: ""`\ \- [By Certificate](https://developer.hashicorp.com/vault/docs/auth/cert)\ `method: "certificate"`\ `role: ""`\ `clientCertificateSecretName: ""`\ \*\* The secret must created in the same namespace with specify keys (client-cert, client-key) for example: `kubectl create secret generic -n env0-agent --from-file=client-key=client.key --from-file=client-cert=client.crt`\ `passphraseSecretName: ""` (Optional)\ \*\* The secret must created in the same namespace with specify keys (client-cert, client-key) for example: `kubectl create secret generic -n env0-agent --from-literal=passphrase=my-password`\ \*\* For Certification Authority (CA) you can choose between:\ ^ `caDisable: true`\ ^ `caCertificateSecretName: ""`with the key - `ca-cert`\ ^ Using CA certificate with `customCertificates`\ \- [By Role & Service Account Token(JWT)](https://developer.hashicorp.com/vault/docs/auth/jwt/oidc-providers/kubernetes)\ `method: "service_account"`\ `role: ""`\ \*\* The JWT is supposed to be supplied by kubernetes in the following path:\ `/var/run/secrets/kubernetes.io/serviceaccount/token`\ You can read more about service accounts [here](https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/). Communication is based on v1 [HTTP API](https://developer.hashicorp.com/vault/api-docs/v1.15.x) * **Required for feature:** Using HCP Vault to store secrets for the agent * **Can be provided via a Kubernetes Secret?** No ## VCS & Git configuration ### `bitbucketServerCredentialsEncoded` * **Description:** Base64 Bitbucket server credentials in the format \`username:token ([using a Personal Access token](https://confluence.atlassian.com/bitbucketserver076/personal-access-tokens-1026534797.html#Personalaccesstokens-usingpersonalaccesstokens)) * **Required for feature:** On-premise Bitbucket Server installation * **Can be provided via a Kubernetes Secret?** Yes:\ `BITBUCKET_SERVER_CREDENTIALS` ### `gitlabEnterpriseCredentialsEncoded` * **Description:** Base64 Gitlab Enterprise credentials in the form of a [Personal Access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) * **Required for feature:** On-premise Gitlab Enterprise installation * **Can be provided via a Kubernetes Secret?** Yes:\ `GITLAB_ENTERPRISE_CREDENTIALS` ### `gitlabEnterpriseBaseUrlSuffix` * **Description:** In cases where your GitLab instance base url is not at the root of the url, URL but on a separate path, e.g.,`https://gitlab.acme.com/prod` you should define that added suffix to this value\ `gitlabEnterpriseBaseUrlSuffix=prod` * **Required for feature:** On-premise Gitlab Enterprise installation * **Can be provided via a Kubernetes Secret?** No ### `githubEnterpriseAppId` / `githubEnterpriseAppInstallationId` / `githubEnterpriseAppPrivateKeyEncoded` * **Description:** [GitHub Enterprise integration](/guides/admin-guide/templates/github-enterprise-integration) (see step 3) * **Required for feature:** On-premise GitHub Enterprise installation * **Can be provided via a Kubernetes Secret?** Yes:\ `GITHUB_ENTERPRISE_APP_PRIVATE_KEY` ### `allowedVcsUrlRegex` * **Description:** When set, cloning a git repository will only be permitted if the git url matches the regular expression set. * **Required for feature:** VCS URL Whitelisting * **Can be provided via a Kubernetes Secret?** No ## Certificates & TLS ### `customCertificates ` * **Description:** An array of strings. Each represents a name of Kubernetes secret that contains custom CA certificates. Those certificates will be available during deployments. * **Required for feature:** Custom CA Certificates. More details [here](/guides/admin-guide/self-hosted-kubernetes-agent/custom-ca-certificates) * **Can be provided via a Kubernetes Secret?** No ### `gitSslNoVerify` * **Description:** When set to `true`, cloning a git repo will not verify SSL/TLS certs * **Required for feature:** Ignoring SSL/TLS certs for on-premise git servers * **Can be provided via a Kubernetes Secret?** No ## Storage & state configuration ### `storageClassName` * **Description:** Ability to change the default PVC storage class name for env zero self-hosted agent * **Required for feature:** the default is`env0-state-sc`\ When changing this, also update your [storage class](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#persistent-volume/storage-class-optional) name to match this configuration * **Can be provided via a Kubernetes Secret?** No ## Agent behavior & security ### `deploymentJobServiceAccountName` * **Description:** Customize the Kubernetes service account used by the deployment pod. Primarily for pod-level IAM permissions * **Required for feature:** the default is `default` * **Can be provided via a Kubernetes Secret?** No ### `jobHistoryLimitFailure` / `jobHistoryLimitSuccess` * **Description:** The number of successful and failed deployment jobs should be kept in the Kubernetes cluster history * **Required for feature:** The default is 10 for each value * **Can be provided via a Kubernetes Secret?** No ### `strictSecurityContext` * **Description:** When set to `true`, the pod operates under `node` user instead of `root` * **Required for feature:** Increased agent pod security * **Can be provided via a Kubernetes Secret?** No ### `env0StateEncryptionKey` * **Description:** A base64 encoded string (password). When set, deployment state and working directory will be encrypted and persisted on env zero's end * **Required for feature:** [env zero-Hosted Encrypted State](/guides/admin-guide/self-hosted-kubernetes-agent/env-zero-hosted-encrypted-state) * **Can be provided via a Kubernetes Secret?** Yes:\ `ENV0_STATE_ENCRYPTION_KEY` ### `environmentOutputEncryptionKey` * **Description:** A base64 encoded string (password). Used to enable the ["Environment Outputs"](/guides/admin-guide/variables/environment-outputs) feature * **Required for feature:** See notes in [Environment Outputs](/guides/admin-guide/variables/environment-outputs) * **Can be provided via a Kubernetes Secret?** No ## Logging ### `logger` * **Description:** Logger config\ `level` - **debug**/info/warn/error\ `format` - **json**/cli ### `agentImagePullPolicy` * **Description:** Set `imagePullPolicy` attribute - **Always**/Never/IfNotPresent ### `agentProxy` * **Description:** Agent's Proxy pod config:\ `install` - **true**/false\ `replicas` - how many replicas of the agent proxy to use. Default is **1**\ `maxConcurrentRequests` - how many concurrent requests each pod should handle. Default is **500**\ `limits` - k8s (cpu and memory) limits. Example values: **250m** and **500Mi** > [!NOTE] > > The `limits` values for `agentProxy` are not set in the chart defaults. The values shown (`250m` CPU, `500Mi` memory) are example overrides. Set these based on your proxy traffic requirements. ### `deploymentPodWarmPoolSize` * **Description:** A number of deployment pods that should be left "warm" (running & idle) and ready for new deployments ## Environment variables, labels & secrets ### `podAdditionalEnvVars` * **Description:** Additional Environment variables to be passed to the deployment pods, which will also be passed to the deployment process. These are set as a plain yaml object, i.e.:\ `"podAdditionalEnvVars":`\ ` "MY_SECRET": akeyless:/K8s/my_k8s_secret"` ### `podAdditionalLabels` * **Description:** Additional labels to be set on deployment pods. Those are set as a plain yaml object, i.e.:\ `"podAdditionalLabels":`\ ` "mykey": "myvalue"` ### `podAdditionalAnnotations` * **Description:** Additional annotations to be set on deployment pods. These are set as a plain yaml object, i.e.:\ `"podAdditionalAnnotations":`\ ` "mykey": "myvalue"` ### `agentAdditionalEnvVars` * **Description:** Additional Environment variables to be passed to the agent pods, which will also be passed to the agent proxy / trigger. These are set as a plain yaml object, i.e.:\ `"agentAdditionalEnvVars":`\ ` "MY_ENV": "MY_VALUE"` ### `agentAdditionalLabels` * **Description:** Additional annotations to be set on agent (trigger/proxy) pods. These are set as a plain yaml object, i.e.:\ `"agentAdditionalLabels":`\ ` "mykey": "myvalue"` ### `agentAdditionalAnnotations` * **Description:** Additional annotations to be set on agent (trigger/proxy) pods. Those are set plain yaml object i.e:\ `"agentAdditionalAnnotations":`\ ` "mykey": "myvalue"` ### `customSecrets` * **Description:** `customSecrets:`\ `- envVarName: MY_SECRET`\ ` secretName: my-secrets-1`\ ` key: db_password` * **Required for feature:** Mount custom secrets * **Can be provided via a Kubernetes Secret?** No ### `customSecretMounts` * **Description:** `customSecretMounts:`\ `- volumeName: my-secrets-1`\ ` secretName: my-secrets-1`\ ` mountPath: /opt/secret1` * **Required for feature:** Mount secret files to given a mountPath * **Can be provided via a Kubernetes Secret?** No ### `env0ConfigSecretName` * **Description:** A Kubernetes Secret name. Can be used to provide sensitive values listed in this table, instead of providing them in the Helm values files. ### `customRoleForOidcAwsSsm.duration` / `customRoleForOidcAwsSsm.arn` * **Description:** Custom role for AWS SSM secret fetching, Note: only used when useOidcForAwsSsm=true ### `useOidcForAwsSsm` * **Description:** When set to`true` the agent will be instructed to authenticate to AWS SSM using env zero OIDC. ### `useV2OidcForAwsSsm` * **Description:** When set to `true` the OIDC token used for AWS SSM secret fetching is requested with the v2 `sts.amazonaws.com` audience instead of the legacy env zero audience. The SSM role's trust policy must accept `sts.amazonaws.com`. Only used when `useOidcForAwsSsm=true`. See [OIDC token versions (v2 / v1)](/guides/integrations/oidc-integrations#token-versions-v2-per-provider-audience-and-v1-legacy). ## Network & proxy configuration ### `httpProxy` / `httpsProxy` / `noProxy` * **Description:** Using Internal Proxy for communication with env zero or your self hosted VCS\ For enable proxy for `http` /`https`requests use\ `httpProxy: "http://my-http-proxy-address"`\ `httpsProxy: "https://my-https-proxy-address"`\ If you want to exclude url from using the proxy use\ `noProxy: "https://env0.com,https://my-other-vcs"` ## Other advanced configuration ### `env0BlockDestroyAndTaskCommands` * **Description:** If set to "true", this agent will throw an error when any user tries to destroy any environment or run a custom "task" in it ### `additionalPodConfig` * **Description:** Additional configurations to be merged with the spec of deployment pods. Can be used to add hostAliases, dnsConfig, etc.\ Example:\ `additionalPodConfig:`\ ` hostAliases:`\ ` - ip: "192.168.1.100"`\ ` hostnames:`\ ` - "example.internal"`\ ` - "example.test"`\ ` dnsConfig:`\ ` nameservers:`\ ` - 1.1.1.1`\ ` - 8.8.8.8` ### `initContainer` * **Description:** An array of [init containers](https://kubernetes.io/docs/concepts/workloads/pods/init-containers/) to add to deployment pods, in Kubernetes container spec format. Set `restartPolicy: Always` on an item to run it as a sidecar for the whole deployment (Kubernetes 1.29 or later). See [Run Docker in custom flows](/guides/admin-guide/self-hosted-kubernetes-agent/docker-in-custom-flows) for an example. * **Can be provided via a Kubernetes Secret?** No ### `customVolumeMounts` * **Description:** An array of `emptyDir` volumes to mount in the deployment container, each with a `name` and a `mountPath`. Containers in `initContainer` can mount the same volume by `name`. * **Can be provided via a Kubernetes Secret?** No ### `additionalAgentConfig` * **Description:** Additional configurations to be merged with the spec of agent (trigger/proxy) pods. Can be used to add `hostAliases`, `dnsConfig`, etc.\ Example:\ `additionalAgentConfig:`\ ` hostAliases:`\ ` - ip: "192.168.1.100"`\ ` hostnames:`\ ` - "example.internal"`\ ` - "example.test"`\ ` dnsConfig:`\ ` nameservers:`\ ` - 1.1.1.1`\ ` - 8.8.8.8` > [!NOTE] > > **Base64 Encoding Values** > > To ensure no additional new line characters are being encoded, please use the following command in your terminal: > > ```bash theme={null} > echo -n $VALUE | base64 > ``` > [!NOTE] > > **Storing Secret Values as Kubernetes Secret** > > Some of the configuration values listed [above](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration) are sensitive. > > As an alternative to setting them in your `values.customer.yml`, you can provide sensitive keys and values from your own Kubernetes Secret prior to the agent's installation/upgrade. > > Setting the `env0ConfigSecretName` will instruct the agent to extract the needed values from the given Kubernetes Secret and will override values from the Helm value files. > > The Kubernetes Secret must be accessible from the agent, and sensitive values must be Base64 encoded. # Configuring deployment image Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/deployment-image Pre-installed tools and versions in the env zero deployment agent base image, built on alpine, with guidance on checking versions using ad hoc tasks. > [!WARNING] > > Tool versions > > env zero updates tool versions periodically for security or end-of-life (EOL) reasons. Customers will be notified before any update with **breaking changes**. > > To check the current version of any tool, run an [ad hoc task](/guides/admin-guide/environments/ad-hoc-tasks) with the relevant command, for example: > > ```bash theme={null} > tool-name --version > ``` ## The base image The deployment agent is based on `node:22.16.0-alpine3.20`. > [!NOTE] > > If you are using a [self-hosted agent](/guides/admin-guide/self-hosted-kubernetes-agent/overview), you can bring your own Docker image by extending env zero's default image. See [Extending the deployment image](/guides/admin-guide/self-hosted-kubernetes-agent/extending-deployment-image). ## Pre-installed tools ### OS utils | Tool | Version | | :- | :- | | bash | 5.2.26 | | curl | 8.12.1 | | file | 5.45 | | git | 2.45.3 | | grep | 3.11 | | jq | 1.7.1 | | ssh | 9.7p1 | | openssl | 3.3.3 | ### Package managers | Tool | Version | | :- | :- | | npm | 10.9.1 | | yarn | 1.22.22 | | pip | 25.0.1 | ### Software | Tool | Version | | :- | :- | | node | 22.16.0 | | python3 | 3.12.0 | | infracost | 0.10.42 | | pwsh (PowerShell) | 7.5 | ### Cloud | Tool | Version | | :- | :- | | aws (AWS CLI v2) | 2.15.30 | | awsv1 (AWS CLI v1) | 1.29.25 | | gcloud | 513.0.0 | | az (azure-cli) | 2.64.0 | | kubectl | 1.30.10 | | kustomize | 5.6.0 | | helm | 3.17.1 | ## Adding additional binaries on the fly You can download any binary using `curl` in any deployment step and place it under the `opt` folder if it needs to be in your PATH. `apk add`, `pip install`, and `npm install` are also accessible via `sudo`. ## Next steps * [Point the agent at a custom image](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration#dockerimage-/-agentimagepullsecret) * [Change the image's user ID](/guides/admin-guide/self-hosted-kubernetes-agent/using-a-custom-image-in-an-agent/change-user-id) # Run Docker in custom flows Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/docker-in-custom-flows Run docker build and docker push in custom flow steps on the env zero self-hosted Kubernetes agent by adding a Docker-in-Docker sidecar to the deployment pod. To run Docker commands such as `docker build` and `docker push` in [custom flow](/guides/admin-guide/custom-flows) steps, add a Docker-in-Docker (`docker:dind`) sidecar to the deployment pod through the agent's Helm values. The sidecar runs the Docker daemon, and your custom flow reaches it over TLS on `localhost`. ## Prerequisites * A self-hosted Kubernetes agent. env zero-hosted agents don't support this, because it requires changing the agent's Helm values. * Kubernetes 1.29 or later. The sidecar is a [native sidecar container](https://kubernetes.io/docs/concepts/workloads/pods/sidecar-containers/), which Kubernetes enables by default from 1.29. * A cluster policy that allows privileged pods in the agent's namespace. > [!WARNING] > > The `docker:dind` container runs privileged. Anyone who can change a custom flow that runs on this agent can use the Docker daemon to gain root access to the node. To limit the impact, schedule deployment pods on dedicated nodes with [`deploymentAffinity`](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration#deploymentaffinity) and [`deploymentTolerations`](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration#deploymenttolerations). If your cluster blocks privileged pods, build images with a tool that doesn't need a Docker daemon, such as [Buildah](https://buildah.io). ## Add the Docker sidecar **1. Add the sidecar to your Helm values** Add the following to your `values.customer.yaml`: ```yaml values.customer.yaml theme={null} podAdditionalEnvVars: DOCKER_HOST: tcp://localhost:2376 DOCKER_TLS_VERIFY: "1" DOCKER_CERT_PATH: /certs/client customVolumeMounts: - name: docker-certs mountPath: /certs/client - name: docker-data mountPath: /var/lib/docker initContainer: - name: dind image: docker:29.9.0-dind restartPolicy: Always securityContext: privileged: true resources: requests: cpu: 500m memory: 1Gi limits: cpu: "1" memory: 2Gi volumeMounts: - name: docker-certs mountPath: /certs/client - name: docker-data mountPath: /var/lib/docker startupProbe: tcpSocket: port: 2376 periodSeconds: 2 failureThreshold: 30 ``` * `restartPolicy: Always` makes the init container a sidecar. It starts before the deployment container, and Kubernetes stops it when the deployment ends. * The startup probe holds the deployment until the Docker daemon accepts connections. * At startup, `docker:dind` generates TLS certificates and writes the client certificates to `/certs/client`. `customVolumeMounts` shares that directory with the deployment container. * The `docker-data` volume holds the images Docker pulls and builds in an `emptyDir` instead of the container's filesystem. `customVolumeMounts` also mounts it in the deployment container, which doesn't use it. * Size `resources` for your builds. In a namespace with a `ResourceQuota`, Kubernetes rejects the pod if the sidecar doesn't set them. * `podAdditionalEnvVars` points the Docker CLI at the sidecar. Custom flow steps receive only allowlisted environment variables from the pod, and `podAdditionalEnvVars` adds these to the allowlist. `docker:29.9.0-dind` is the version this page was tested with. For current versions, see the [`docker` image tags on Docker Hub](https://hub.docker.com/_/docker/tags?name=dind). **2. Apply the values** Upgrade the release with the same flags you used to install it: ```shell theme={null} helm upgrade env0/env0-agent --namespace --set-string agentAccessToken='' -f values.customer.yaml ``` The change applies to deployments that start after the upgrade. **3. Install the Docker CLI** The deployment image doesn't include the Docker CLI. Install it in one of two ways: * **In the custom flow.** Run `sudo apk add docker-cli docker-cli-buildx` at the start of the step, as in the example below. The packages download on every deployment. * **In a custom image.** Add `RUN apk add --no-cache docker-cli docker-cli-buildx` to your Dockerfile and set `dockerImage` to the new image. See [Extending deployment image](/guides/admin-guide/self-hosted-kubernetes-agent/extending-deployment-image). If `strictSecurityContext` is `true`, `sudo` is blocked, so use a custom image. **4. Run Docker commands in your custom flow** This example builds an image from a `Dockerfile` next to `env0.yml` and pushes it to your registry before `terraform init`. Store the registry password in an env zero [sensitive environment variable](/guides/admin-guide/variables#secrets) named `REGISTRY_PASSWORD`. ```yaml env0.yml theme={null} version: 2 deploy: steps: terraformInit: before: - name: Build and push image run: | sudo apk add docker-cli docker-cli-buildx echo "$REGISTRY_PASSWORD" | docker login -u --password-stdin docker build -t /: . docker push /: ``` The step log shows the build output, followed by the pushed image digest. ## Troubleshooting | Error | Cause and fix | | - | - | | `helm upgrade` fails with `startupProbe: Forbidden: may not be set for init containers without restartPolicy=Always` | The cluster runs Kubernetes older than 1.29, which ignores `restartPolicy: Always` on init containers. Upgrade the cluster to 1.29 or later. | | `Cannot connect to the Docker daemon` | `DOCKER_HOST` is missing or doesn't point to `tcp://localhost:2376`. `docker:dind` listens with TLS on port 2376, not 2375. Set all three variables under `podAdditionalEnvVars` as shown above. | | `open /certs/client/ca.pem: no such file or directory` | The deployment container doesn't mount the certificates. Add the `customVolumeMounts` entry, and mount the same volume name in the `dind` container. | | `sudo: The "no new privileges" flag is set` | `strictSecurityContext` is `true`. Install the Docker CLI in a custom image instead. | # env zero Hosted Encrypted State Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/env-zero-hosted-encrypted-state Use env zero hosted encrypted state to avoid PVC configuration for the self-hosted Kubernetes agent, with a customer-provided base64 encryption key. env zero has removed the requirement for setting up [PersistentVolumeClaims](https://kubernetes.io/docs/concepts/storage/persistent-volumes/) (PVCs) when using env zero's [Self-Hosted Agents](/guides/admin-guide/self-hosted-kubernetes-agent/overview). env zero will encrypt (with a customer provided encryption key) the working directory and persist it in env zero's secure cloud native file system. ## How does it work 1. Add a `"env0StateEncryptionKey" = ""` key-value pair to your agent's `_values.yaml` configuration file. On existing agents, [upgrade helm](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#upgrade) to apply the changes made in your configuration file. **The encryption key can be any random string.** 2. When deploying an environment, the agent uses your encryption key to encrypt deployment state and working directory, and upload them to env zero's secure cloud native file system. > [!NOTE] > > **About Privacy** > > We don't have access to your state files or your encryption key. Your encryption key belongs to you and your agent. ## Key rotation In case you want to change the encryption key, edit the `env0StateEncryptionKey` value in your agent's configuration file, and replace it with a different base64 encoded string. > [!WARNING] > > Warning > > When using local state files, adding, removing or rotating the encryption key will result in state loss for existing environments. In such cases, Terraform resources will be re-created. > > To remedy this, we recommend using a remote backend (e.g., [env zero Remote Backend](/guides/admin-guide/remote-backend)). ## Next steps * [Store the key in a Kubernetes secret](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration#env0stateencryptionkey) instead of a plain Helm value * [Plan failover across clusters](/guides/admin-guide/self-hosted-kubernetes-agent/hadr-strategy-for-self-hosted-agents), where encrypted state lets deployments resume on the standby cluster # Extending deployment image Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/extending-deployment-image Extend the env zero deployment agent base image with custom tools and pre-installed CLIs using a Dockerfile for the self-hosted Kubernetes agent. The env zero [self-hosted Kubernetes agent](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent) allows you to run deployments on your own infrastructure, giving you more control and security. While the [default deployment image](/guides/admin-guide/self-hosted-kubernetes-agent/deployment-image) includes all the necessary tools for env zero's native features, you may need to install additional tools or specific versions of existing tools to support your custom workflows. This guide covers extending the default deployment image to meet your specific needs. ## Why Extend the Deployment Image? Extending the deployment image is necessary when you want to: * **Use custom tools**: If your deployment process relies on tools that are not included in the base image, such as specific CLI tools, testing frameworks, or security scanners. * **Pre-install env zero supported tools**: To save network bandwidth and reduce deployment times, you can pre-install tools that env zero supports but doesn't include in the base image. * **Standardize your environment**: Ensure that all your deployments run in a consistent environment with the exact tool versions your organization requires. ## Creating a Custom Dockerfile To extend the base image, you'll need to create a Dockerfile that uses the env zero deployment image as its base and then adds your custom tools and configurations. Here's an example of a Dockerfile that pre-installs the `aws` and `gcloud` CLIs with a specific version for gcloud: ```dockerfile Dockerfile theme={null} # Sets the base image to the latest version of the env zero deployment agent. FROM ghcr.io/env0/deployment-agent:latest # Sets an environment variable to specify the version of the Google Cloud CLI to be installed. If you omit this, the default version will be installed. ENV ENV0_GCLOUD_VERSION=532.0.0 # Executes env zero's "install-package-cli.js" utility, which is provided to pre-install # CLI tools (e.g., aws, gcloud) into the image before runtime. RUN node install-package-cli.js aws gcloud # Custom installtion of your package RUN curl -sSL "https://github.com/cli/cli/releases/download/v2.53.0/gh_2.53.0_linux_amd64.tar.gz" -o gh.tar.gz \ && tar -zxvf gh.tar.gz \ && mv gh_2.53.0_linux_amd64/bin/gh /usr/local/bin/ \ && rm -rf gh.tar.gz gh_2.53.0_linux_amd64 ``` > [!NOTE] > > If you are using strictSecurityContext mode, to install packages as a pre-installation you need to add the following variable to the command: > > ```dockerfile Dockerfile theme={null} > RUN STRICT_MODE=true node install-package-cli.js aws az > ``` You can add more `RUN` commands to install your own custom tools or perform other setup tasks. > [!WARNING] > > Do not set an `ENTRYPOINT` in your Dockerfile when extending the base image. The agent relies on the base image's startup command; overriding it prevents deployments from running. ### Available tools These tools can be pre-installed in your image using the install-package-cli.js script provided by env0. This script ensures that the specified CLI tools are available during runtime without requiring installation in your deployment steps. ## Build Your Own Image from a Custom Base Image For advanced use cases, you might want to use your own company's base image, which may already be hardened and configured according to your internal standards. This approach allows you to layer the env zero agent capabilities on top of your existing infrastructure. > [!WARNING] > > This is an experimental feature > > Building on a custom base image is not officially supported and may lead to unexpected behavior. While it can work, we cannot guarantee that all env zero features will function correctly. Proceed with caution and test thoroughly. Your base image must include the following tools for the env zero agent to function correctly: `curl` `git` `gnupg` `jq` `nodejs` ### Example Dockerfile using a Custom Base You can create a Dockerfile that uses your image as a base and copies the necessary env zero agent files from the official image. A multi-stage build is the recommended approach for this. The package installation commands (apt-get) in the example are for Debian-based systems and should be adapted for your image's specific package manager. ```dockerfile Dockerfile theme={null} # Example for using another image as a base - Only tested for terraform and basic resource # AWS CLI and Azure CLI not supported because we compile them fot alpine # Stage 1: Source Stage FROM ghcr.io/env0/deployment-agent:latest AS builder # Stage 2: Final Image FROM node:latest USER node RUN git config --global --add safe.directory "*" # Set a working directory for the application. WORKDIR /app # Copy the service files from the 'builder' stage into the current directory (/app). COPY --from=builder /usr/build/services/deployment-service . ENV HOME=/home/node RUN chown -R node /home/node USER root CMD [ "npm", "run", "start:docker-agent" ] ``` ## Updating the Agent Configuration After you have built your custom Docker image and pushed it to a container registry, you need to configure your env zero agent to use this new image. This is done by updating the [Helm chart values](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration#dockerimage-/-agentimagepullsecret) for your agent installation. You will need to modify the following values in your `values.yaml` file: * **`dockerImage`**: Set this to the URL of your custom Docker image in your container registry. * **`agentImagePullSecret`** *(Optional)*: If your container registry requires authentication, you'll need to create a Kubernetes secret with the credentials and specify the name of the secret here. Here's an example snippet from a `values.yaml` file: ```yaml values.yaml theme={null} dockerImage: "your-registry/your-custom-image:your-tag" agentImagePullSecret: "your-pull-secret" ``` Once you've updated the `values.yaml` file, apply the changes to your Helm release to update the agent with the new image. ## Summary By following these steps, you can create a custom deployment environment tailored to your organization's specific needs, allowing you to run [custom flows](/guides/admin-guide/custom-flows) in your env zero deployments. ## Next steps To give the `node` user a different UID and GID in your image, see [Changing user ID](/guides/admin-guide/self-hosted-kubernetes-agent/using-a-custom-image-in-an-agent/change-user-id). # HA/DR strategy for self-hosted agents Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/hadr-strategy-for-self-hosted-agents Configure high availability and disaster recovery for env zero self-hosted agents using active-passive Kubernetes clusters in separate availability zones. For a high-availability configuration of the env zero self-hosted agent, you can install the agent in two different K8s clusters in two different availability zones. You can configure the self-hosted agent in the following mode: ## Active-Passive * Setup the failover agent in a separate region or availability zone * Once you confirmed that the agent is live and running, scale the deployment to 0.\ `kubectl scale deploy .agent-trigger-deployment --replicas=0`\ if using the proxy pod, also scale the proxy deployment to 0.\ `kubectl scale deploy .agent-proxy-deployment --replicas=0` * When an outage has occurred in the primary cluster, scale the failover deployments back to 1\ `kubectl scale deploy .agent-trigger-deployment --replicas=1`\ if using the proxy pod, also scale the proxy deployment to 1.\ `kubectl scale deploy .agent-proxy-deployment --replicas=1` ## Things to consider ### Working Directory when failing over to a new cluster, the working directory may not be in sync or backed up. This will result in the high possibility that you cannot resume or approve a deployment that was waiting for approval. A simple redeployment will allow you to resume your deployments in the new cluster. * Alternatively you can use [env zero Hosted Encrypted State](/guides/admin-guide/self-hosted-kubernetes-agent/env-zero-hosted-encrypted-state) to resume deployments across multiple clusters. ### State File When implementing a failover strategy for self-hosted env zero agents, it is critical to ensure that Terraform state files remain accessible and consistent across clusters. > [!WARNING] > > Losing state sync > > If the state is lost or becomes unsynchronized, deployments may fail or lead to infrastructure drift. #### Remote state storage (recommended) For best reliability, state should be stored in a [Remote backend](/guides/admin-guide/remote-backend) that remains accessible regardless of cluster failures. This ensures that when a standby cluster is activated, it can resume deployments without losing state. The common use cases are: * [env zero's remote backend](/guides/admin-guide/remote-backend/login) as it is backed up across two AWS regions, providing built-in redundancy * Terraform’s remote backend * AWS S3 + DynamoDB (state locking) * Google Cloud Storage (GCS) * Azure Blob Storage #### State stored in the agent namespace (less ideal) If the Terraform state is stored within the env zero agent's Kubernetes namespace, read more about it [here](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#persistent-volume/storage-class-optional) . In this case, extra steps are needed to sync state between the primary and standby clusters. This may involve: * Persistent storage replication across clusters. * A manual or automated process to copy state from the failed cluster to the standby. ## Next steps To run separate agents side by side and assign each one to its own projects, see [Running multiple self-hosted agents](/guides/admin-guide/self-hosted-kubernetes-agent/multiple-self-hosted-agents). # Hosting deployment logs Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/hosting-the-deployment-logs Store env zero deployment logs in your own AWS DynamoDB table using the env zero log table Terraform module with IAM role ARN configuration. By default, [deployment logs](/guides/integrations/logs-forwarding#deployment-logs) are stored in env zero. You can store the logs in your own AWS account instead. Go to **Organization Settings** > **Agents** and click **Edit** on the [agent pool](/guides/admin-guide/self-hosted-kubernetes-agent/overview#editing-an-agent-pool) to change the logs configuration. ## AWS - Hosting Deployment Logs in DynamoDB **1. Deploy the log table** Deploy the [env zero log table terraform module](https://github.com/env0/k8s-modules/tree/main/log-storage/aws/dynamodb) on your AWS account. This module creates the DynamoDB table and the IAM role that env zero assumes when reading and writing logs. For the module variables, use the **Agent ID** and **External ID** shown in the Edit Agent modal. ![Edit Agent modal showing AWS log configuration fields](https://mintcdn.com/envzero-b61043c8/G6uQW-C5k8CwAvji/images/guides/admin-guide/self-hosted-kubernetes-agent/edit-agent-logs-config.png?fit=max\&auto=format\&n=G6uQW-C5k8CwAvji\&q=85\&s=2ab5cb58a2343c8b351a57b04190d3c0) **2. Configure the agent pool** In the logs configuration section, enter: * **AWS Account ID** - The account where you deployed the log table. * **Region** - The AWS region of the DynamoDB table. **3. Verify** Run a deployment and confirm that logs appear in your DynamoDB table. > [!WARNING] > > Changes to log configuration may take up to 60 minutes to take effect. During this period, logs may still be written to the previous location. ## Next steps * [Install a Kubernetes agent](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent) if the pool has no running agent yet * [Check agent health](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-agents-monitoring) # Running multiple self-hosted agents Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/multiple-self-hosted-agents Run multiple self-hosted and SaaS agents in a single env zero organization with per-project assignment for isolation and security boundary separation. With env zero, you can use both self-hosted and SaaS agents within the same organization, allowing for flexibility and smooth transitions between agent types. ## Hybrid Agent Setup A hybrid setup lets you configure the most suitable agent type for each project, optimizing scalability, resource management, and overall workflow efficiency. A common use case is utilizing the [env zero provider](https://search.opentofu.org/provider/env0/env0/latest) to provision all env zero resources. You can configure a single project with the env zero Cloud Agent to provision all other projects and resources through the env zero provider, while the remaining projects operate on a self-hosted agent to manage actual cloud infrastructure deployments. > [!NOTE] > > **You can also choose to keep working with the env zero Cloud Agent.** > > However, please note that it does not support certain version control systems (GitHub Enterprise, GitLab Enterprise and Bitbucket Server) and [secret variables for self hosted agents](/guides/admin-guide/variables/#secrets). Make sure to verify compatibility with your specific environment before selecting this option. ## Use Cases for Multiple Agents * **Environment isolation** - Separate agents for production and non-production workloads. * **Geographic distribution** - Run agents in different regions or cloud providers. * **Security boundaries** - Isolate agents that handle sensitive resources. * **Resource management** - Dedicate agents to projects with different resource requirements. ## Managing Agent Pools and Assignments To create agent pools, manage secrets, and assign agents to projects, see [Self-hosted agents overview](/guides/admin-guide/self-hosted-kubernetes-agent/overview). Projects not assigned to a specific agent use the organization’s default self-hosted agent. ## Next steps * [Install an agent on Kubernetes](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent) * [Run an agent as a standalone Docker container](/guides/admin-guide/self-hosted-kubernetes-agent/standalone-docker-agent) for simpler setups # Self-hosted agents overview Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/overview Create and manage self-hosted agent pools, authentication secrets, and project assignments in env zero for Kubernetes and Docker agents. ## What Are Self-Hosted Agents Self-hosted agents run env zero deployment workloads on your own infrastructure. * Execution is contained within your own servers and infrastructure. * The agent requires an internet connection but no inbound network access. * Secrets are stored on your own infrastructure. > [!NOTE] > > Self-hosted agents are available to Enterprise customers only. See [pricing](https://www.envzero.com/pricing) for details. env zero supports two agent types: * **Kubernetes agent** - Runs on your Kubernetes cluster using a Helm chart. See [Kubernetes Agent Installation](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent). * **Docker agent** - Runs as a standalone Docker container. See [Docker Agent Installation](/guides/admin-guide/self-hosted-kubernetes-agent/standalone-docker-agent). ## Agent Pools An agent pool is a logical grouping of one or more agent instances that share the same configuration and authentication. You can create and manage agent pools in the env zero UI. Each agent pool has: * A unique name within your organization * Up to two authentication secrets * Optional log hosting configuration ![Agent Pools page showing agent list with status, version, and actions](https://mintcdn.com/envzero-b61043c8/G6uQW-C5k8CwAvji/images/guides/admin-guide/self-hosted-kubernetes-agent/agents-list-page.png?fit=max\&auto=format\&n=G6uQW-C5k8CwAvji\&q=85\&s=156e622a7ace5eeb7e2d0eb78b4b54fe) ## Permissions Managing agent pools requires the **Edit Organization Settings** permission. This permission is required to: * Create, edit, and delete agent pools * Create and revoke agent secrets * Assign agents to projects ## Creating an Agent Pool **1. Navigate to Agents** Go to **Organization Settings** > **Agents**. **2. Create the agent pool** Click **Create Agent**. Enter a name for the agent pool (required, must be unique within your organization). **3. Create an authentication secret** After creating the agent pool, the secrets modal opens automatically. Click **Create Secret** to generate an authentication token. See [Managing Agent Secrets](#managing-agent-secrets) for details. ![Create Agent modal showing name input field](https://mintcdn.com/envzero-b61043c8/G6uQW-C5k8CwAvji/images/guides/admin-guide/self-hosted-kubernetes-agent/create-agent-modal.png?fit=max\&auto=format\&n=G6uQW-C5k8CwAvji\&q=85\&s=315653734d8002c21a27cc01cc2d25dc) ## Managing Agent Secrets Agent secrets are authentication tokens used to connect agent instances to env zero. Each agent pool supports up to two secrets, allowing you to rotate credentials without downtime. ### Creating a Secret **1. Open the secrets modal** From the Agents list, click **Manage Secrets** on the agent pool. **2. Generate the secret** Click **Create Secret** and enter a name. The secret value is displayed once. Copy it immediately. **3. Use the secret to install your agent** The modal displays ready-to-use install commands: **Helm (Kubernetes):** ```shell theme={null} helm install --create-namespace env0-agent env0/env0-agent --namespace env0-agent --set-string agentAccessToken='' ``` **Docker:** ```shell theme={null} docker run -e AGENT_ACCESS_TOKEN='' ghcr.io/env0/deployment-agent:latest ``` > [!WARNING] > > The secret value is shown only once at creation time. If you lose it, revoke the secret and create a new one. ![Create Secret modal showing the generated token and install commands](https://mintcdn.com/envzero-b61043c8/G6uQW-C5k8CwAvji/images/guides/admin-guide/self-hosted-kubernetes-agent/create-secret-modal.png?fit=max\&auto=format\&n=G6uQW-C5k8CwAvji\&q=85\&s=473b55913851703a9d901d62d99ad5ee) ### Revoking a Secret To revoke a secret, open the secrets modal and click **Revoke** next to the secret. Revocation is immediate and irreversible. > [!WARNING] > > Revoked secrets may remain valid for up to 60 minutes due to authentication caching. Plan secret rotations accordingly. ## Editing an Agent Pool To edit an agent pool, click **Edit** on the agent row in the Agents list. You can modify: * **Name** - The display name of the agent pool. * **Log configuration** - You can switch between env zero hosted and self-hosted deployment log storage. See [Hosting deployment logs](/guides/admin-guide/self-hosted-kubernetes-agent/hosting-the-deployment-logs) for details. ![Edit Agent Configuration modal showing name and deployment logs settings](https://mintcdn.com/envzero-b61043c8/G6uQW-C5k8CwAvji/images/guides/admin-guide/self-hosted-kubernetes-agent/edit-agent-modal.png?fit=max\&auto=format\&n=G6uQW-C5k8CwAvji\&q=85\&s=3b37d1b96126baffb28c441dad48bc1f) ## Deleting an Agent Pool To delete an agent pool, click **Delete** on the agent row. You must type the agent name to confirm deletion. > [!WARNING] > > You cannot delete an agent pool that is set as the organization default or is assigned to any projects. Reassign or remove the agent from all projects before deleting. ## Assigning Agents to Projects You can assign specific agent pools to individual projects. Projects not assigned to a specific agent use the organization's default agent. To assign agents to projects, go to **Organization Settings** > **Agents**. The agent assignment table shows each project and its assigned agent. Select an agent pool from the dropdown to change the assignment. ![Agent assignment table showing projects and their assigned agents](https://mintcdn.com/envzero-b61043c8/G6uQW-C5k8CwAvji/images/guides/admin-guide/self-hosted-kubernetes-agent/agent-assignment-table.png?fit=max\&auto=format\&n=G6uQW-C5k8CwAvji\&q=85\&s=fe2f24fe2ef81cf0a1a6e50df12a134b) For more information about running multiple agents, including hybrid setups with both self-hosted and SaaS agents, see [Running multiple self-hosted agents](/guides/admin-guide/self-hosted-kubernetes-agent/multiple-self-hosted-agents). ## Next steps * [Tune the Kubernetes agent's Helm values](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration) * [Connect your Git repository](/guides/admin-guide/manage-vcs) so the agent can deploy from it # Monitoring Self-Hosted Agents Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-agents-monitoring Monitor the health and version of env zero self-hosted Kubernetes agents, with active, inactive, and degraded status indicators for connectivity issues. The [self-hosted agent](/guides/admin-guide/self-hosted-kubernetes-agent/overview) monitoring feature in env zero enables you to gain valuable insights into the current state of your agents, facilitating better control and management of your infrastructure as code processes. ## Monitoring Agents State On the Agents page, you will find a comprehensive overview of all your self-hosted agents and their respective states. The states reflect the current operational status of each agent and provide valuable information about their behavior. ![Agents page listing all self-hosted agents with their current state (Active, Inactive, or Degraded) and version](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/self-hosted-kubernetes-agent/9dfa9a0-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=6a0b5ac74e63074758a93ea383b66bc8) The following agent states can be observed: * `Active`: Indicates that the agent is functioning properly and is ready to execute deployment jobs. * Active agents are waiting for jobs to be assigned. * 11 minutes of activity will mark the agent as Active. * `Inactive`: No agent has been detected. The agent might not have been installed or not been able to reach env zero. * 11 minutes of inactivity will mark the agent as Inactive. * `Degraded`: An agent that is able to poll env zero but not start jobs. The degraded state indicates that jobs are queueing up with no runners to execute them. * A job waiting in the queue for more than 5 minutes, while the agent runs no other job, triggers the degraded state. * Jobs waiting while the agent is running other jobs do not trigger the degraded state. The agent is at capacity, not unhealthy. In addition, you can also track the versions of your self-hosted agents, By displaying the agent version you can ensure that you are using the latest features and patches provided by env zero. > [!WARNING] > > Agent Version > > To view the agent versions, make sure you have [updated your agents](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#upgrade) to the `3.0.458` release or newer, which supports agent version monitoring. Keeping your agents up to date ensures compatibility with the latest features and optimizations offered by env zero. ## Next steps * [Troubleshoot agent crashes](/guides/admin-guide/self-hosted-kubernetes-agent/troubleshooting) * [Set up a failover agent](/guides/admin-guide/self-hosted-kubernetes-agent/hadr-strategy-for-self-hosted-agents) in case the primary cluster goes down # Self-hosted Kubernetes agent Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent Install and configure the env zero self-hosted Kubernetes agent using Helm, covering autoscaler, persistent volume setup, and upgrade procedures. For an overview of self-hosted agents, including how to create and manage agent pools, see [Self-hosted agents overview](/guides/admin-guide/self-hosted-kubernetes-agent/overview). ## Requirements * Kubernetes cluster at version >= 1.24 * [Autoscaler](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#autoscaler-recommended-but-optional) * [Persistent Volume/Storage Class](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#persistent-volume/storage-class-optional)(Optional) * AMD64 or ARM64-based nodes. * The agent will be installed using a [Helm chart](#installation). > [!NOTE] > > **Cluster Installation** > > The Agent can be run on an existing Kubernetes cluster in a dedicated namespace, or you can create a cluster just for the agent. > > Use the [k8s-modules](https://github.com/env0/k8s-modules) repository, which contains Terraform code for cluster installation. You can use the main provider folder for a complete installation, or a specific module to fulfill only certain requirements. > > To create an EKS cluster and install the agent from one Terraform configuration, see [Install the agent with Terraform](/guides/admin-guide/self-hosted-kubernetes-agent/terraform-bootstrap). ### Creating the cluster without an IAM OIDC provider By default the `aws` module creates an IAM OIDC provider for the cluster. Only the EFS CSI driver and the cluster autoscaler use it, through IRSA. The agent itself does not. If your security policy forbids creating IAM identity providers, copy the `aws` folder of [k8s-modules](https://github.com/env0/k8s-modules) into your own repository and adjust it: 1. In `aws/eks/main.tf`, set `enable_irsa = false`. The cluster is then created without an `aws_iam_openid_connect_provider`. 2. In `aws/main.tf`, remove the `autoscaler`, `efs` and `efs_csi_driver` modules. They assign IAM roles through IRSA and need the provider. If you want them, give their service accounts roles through [EKS Pod Identity](/guides/admin-guide/self-hosted-kubernetes-agent/authenticating-the-agent-on-aws-eks#using-eks-pod-identity) instead, which needs no OIDC provider. 3. Without EFS there is no `env0-state-sc` storage class, so set the `env0StateEncryptionKey` Helm value (see [PVC Alternative](#persistent-volume/storage-class-optional) below) and then follow [Installation](#installation). > [!NOTE] > > **Not the env zero OIDC provider** > > The cluster's IAM OIDC provider is unrelated to the env zero OIDC provider (`https://login.app.env0.com/`) that you register in each target AWS account for [deployment credentials](/guides/integrations/oidc-integrations/oidc-with-aws). Skipping the cluster provider does not affect how deployments authenticate. ## Autoscaler (recommended, but optional) * While optional, configuring horizontal auto-scaling will allow your cluster to adapt to the concurrency and deployment requirements based on your env zero usage. Otherwise, your deployment concurrency will be limited by the cluster's capacity. Please also see [Job Limits](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent/#job-limits) if you wish you to control the maximum concurrent deployment. * The env zero agent will create a new pod for each deployment you run on env zero.\ Pods are ephemeral and will be destroyed after a single deployment. * A pod running a single deployment requires *at least* `cpu: 460m` and `memory: 1500Mi`, so the cluster nodes must be able to provide this resource request. Limits can be adjusted by providing [custom configuration](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration) during chart installation. * Minimum node requirements: an instance with at least 2 CPU and 8GiB memory. For the EKS cluster, you can use this [TF example](https://github.com/env0/k8s-modules/blob/main/aws/autoscaler/main.tf). ## Persistent Volume/Storage Class (optional) * env zero will store the deployment state and working directory on a persistent volume in the cluster. * Must support Dynamic Provisioning and ReadWriteMany access mode. * The requested storage space is `300Gi`. * The cluster must include a `StorageClass` named `env0-state-sc`. * The Storage Class should be set up with `reclaimPolicy: Retain`, to prevent data loss in case the agent needs to be replaced or uninstalled. We recommend the current implementations for the major cloud providers: | Cloud | Solution | | - | - | | AWS | [EFS CSI](https://docs.aws.amazon.com/eks/latest/userguide/efs-csi.html) For the EKS cluster, you can use this TF example - [ EFS](https://github.com/env0/k8s-modules/blob/main/aws/efs/main.tf) [CSI-Driver/StorageClass](https://github.com/env0/k8s-modules/blob/main/aws/csi-driver/main.tf) | | GCP | [Filestore](https://cloud.google.com/filestore/docs), [OpenSource NFS](https://github.com/env0/k8s-modules/tree/main/gcp) | | Azure | [Azure Files](https://docs.microsoft.com/en-us/azure/aks/azure-files-dynamic-pv) | > [!NOTE] > > **PVC Alternative** > > By default, the deployment state and working directory is stored in a PV (Persistent Volume) which is configured on your Kubernetes cluster. Whenever PV creation or management is difficult, or not required, you can use [env zero-Hosted Encrypted State](/guides/admin-guide/self-hosted-kubernetes-agent/env-zero-hosted-encrypted-state) by setting the `env0StateEncryptionKey` Helm value. > > `env0StateEncryptionKey` is the base64 encoding of any string you choose — the value itself can be anything, it just has to be base64 encoded. The agent uses it to encrypt and decrypt the environment state and working directory before they are persisted, and env zero never has access to it. For example, generate one from a passphrase of your choice: > > ```shell theme={null} > echo -n 'your-passphrase' | base64 > ``` ## Sensitive Secrets * Using secrets stored on the env zero platform is not allowed for self-hosted agents, since self-hosted agents allow you to store secrets on your own infrastructure. * Customers using self-hosted agents may use their own Kubernetes Secret to store sensitive values - see *env0ConfigSecretName* below. * If you are migrating from SaaS to a self-hosted agent, deployments attempting to use these secrets will fail. * This includes sensitive configuration variables, SSH keys, and Cloud Deployment credentials. The values for these secrets should be replaced with references to your secret store, as detailed in the table below. * To use an external secret store, authentication to the secret store must be configured using a custom Helm values file. The required parameters are detailed in [Custom/optional configuration](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration). * Storing secrets is supported using these secret stores: | Secret store | Secret reference format | Secret Region & Permissions | | - | - | - | | AWS Secrets Manager (us-east-1) | `${ssm:}` | Set by the `awsSecretsRegion` helm value. Defaults to `us-east-1` Role must have permissions: `secretsmanager:GetSecretValue` | | GCP Secrets Manager | `${gcp:}` | Your GCP project's default region Access to the secret must be possible using the `customerGoogleCredentials` configuration or using GKE workload identity. The `customerGoogleProject` configuration must be supplied and will be used to access secrets in that project only. The permission 'secrets.versions.access' is required | | Azure Key Vault | `${azure:@}` | Your Azure subscription's default region | | HashiCorp Vault | `${vault:.@}` where `@` is optional | | | OCI Vault Secrets | `${oci:}` | The region defined in the credentials provided in the agent configuration. | > [!NOTE] > > **Allow storing secrets in env zero** > > Alternatively, you could explicitly allow env zero to store [secrets](/guides/admin-guide/variables/#secrets) on its platform, by opting-in in your organization's policy - For more info read [here](/guides/policies-governance/allow-env0-secrets) ## Custom/Optional Configuration You provide your `agentAccessToken` (from the env zero UI) along with an optional `values.customer.yaml` for additional configuration. For the complete list of configuration options, see [Custom/optional configuration](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration). ## Further Configuration The env zero agent externalizes a [wide array of values](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration) that may be set to configure the agent. We do our best to support all common configuration case scenarios, but sometimes a more exotic or pre-released configuration is required. For such advanced cases, see [this reference example](https://github.com/env0/self-hosted/tree/gh-pages/examples/kustomize) of utilizing [Kustomize](https://kustomize.io/) alongside [Helm Post Rendering](https://helm.sh/docs/topics/advanced/#post-rendering) to further customize our chart. ### Job Limits You may wish to add a limit on the number of concurrent runs. To do so, add a Resource Quota to the agent namespace with a parameter on `count/jobs.batch`. See [here](https://kubernetes.io/docs/concepts/policy/resource-quotas/) for more details. ## Installation 1. Add our Helm Repo ```shell theme={null} helm repo add env0 https://env0.github.io/self-hosted ``` 2. Update Helm Repo ```shell theme={null} helm repo update ``` 3. Get your agent access token by [creating an agent pool](/guides/admin-guide/self-hosted-kubernetes-agent/overview#creating-an-agent-pool) in the env zero UI. 4. Install the Helm Charts ```shell theme={null} helm install --create-namespace env0-agent env0/env0-agent --namespace env0-agent --set-string agentAccessToken='' -f values.customer.yaml # values.customer.yaml should contain any optional configuration options as detailed above ``` > [!NOTE] > > **Terraform example** > > For a complete configuration that also creates the EKS cluster, see [Install the agent with Terraform](/guides/admin-guide/self-hosted-kubernetes-agent/terraform-bootstrap). > > ```hcl theme={null} > # Create agent pool and install agent using helm chart > > variable "agent_custom_configuration" { > type = map(any) > description = "See https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration" > } > > resource "env0_agent_pool" "default" { > name = "default self-hosted agent" > } > > resource "env0_agent_secret" "first" { > agent_id = env0_agent_pool.default.id > } > > resource "helm_release" "this" { > repository = "https://env0.github.io/self-hosted" > chart = "env0-agent" > > namespace = "env0-agent-default" > name = "env0-agent-default" > > create_namespace = true > timeout = 600 > > set_sensitive { > name = "agentAccessToken" > value = env0_agent_secret.first.secret > } > > # Only non-secret values here. Terraform stores values unredacted and prints them in plans. > # Pass secrets with set_sensitive, like agentAccessToken above. > values = [ > yamlencode(var.agent_custom_configuration) > ] > } > ``` ## Upgrade ```shell theme={null} helm upgrade env0-agent env0/env0-agent --namespace env0-agent ``` > [!NOTE] > > **Upgrade Notes** > > Make sure to keep your `values.customer.yaml` file for use during upgrades. > [!WARNING] > > Custom Agent Docker Image > > If you [extended](/guides/admin-guide/self-hosted-kubernetes-agent/extending-deployment-image) the docker image on the agent, you should update the agent version in your custom image as well. ## Verify Installation/Upgrade After installing a new version of the env zero agent helm chart, it is highly recommended to verify the installation by running: ```shell theme={null} helm test env0-agent --namespace env0-agent --logs --timeout 1m ``` ## Using the `helm template` command Alternatively to using `helm` to install the agent directly, you could use `helm template` to generate the K8S yaml files for you. Then you'd be able to run these files with a different K8S pipeline, like running `kubectl apply` or using ArgoCD. To generate the yaml files using `helm template`, first add the env zero helm chart ```shell theme={null} helm repo add env0 https://env0.github.io/self-hosted helm repo update ``` Then, run the following command. **If your Kubernetes cluster is version 1.21 and up:** ```shell theme={null} helm template env0-agent env0/env0-agent --kube-version= --api-version=batch/v1/CronJob -n --set-string agentAccessToken='' -f values.customer.yaml ``` **If your Kubernetes cluster version is less than 1.21:** ```shell theme={null} helm template env0-agent env0/env0-agent --kube-version= -n --set-string agentAccessToken='' -f values.customer.yaml ``` * `` is the version of your kubernetes cluster * `` is the k8s namespace in which the agent will be installed * `values.customer.yaml` is your custom values file for additional configuration options. > [!WARNING] > > Using `env0ConfigSecretName` with the `helm template` command > > If using `helm template`, the feature that checks the Kubernetes secret defined by the env0ConfigSecretName Helm value to determine whether the PVC should be created will not function. This feature relies on an active connection to the cluster ### Required Outbound Domains | **Wildcard / Domain** | **Purpose / Used By** | | :- | :- | | `*.env0.com`, `*.amazonaws.com` | **env zero SaaS Platform** - Required for the agent to communicate with the env zero SaaS platform. | | `ghcr.io` | **GitHub Container Registry** - Hosts the Docker image of the env zero agent. | | `*.hashicorp.com` | **HashiCorp** - Used to download Terraform binaries. | | `registry.terraform.io`, `registry.opentofu.org` | **Module Registries** - Used to download public modules from the Terraform or OpenTofu registries. | | `github.com`, `gitlab.com`, `bitbucket.org` | **Version Control Systems (VCS)** - Used for Git operations over ports **22**, **9418**, **80**, and **443**. | | `*.infracost.io` | **Infracost** - Used for cost estimation functionality. | | `github.com` | **External Tools & Integrations** - Used to download external tools required for **custom flows** or **env zero native integrations**. | | `dl.k8s.io` | **Kubernetes** - Used to download and install `kubectl`. | | `get.helm.sh` | **Helm** - Used to download and install `helm`. | | `dl.google.com` | **Google Cloud SDK** - Used to download and install `gcloud`. | *** > **Note:** All domains listed above require **outbound HTTPS (port 443)** access from the env zero agent.\ > Only open access to the domains for the features you are actually using. > [!WARNING] > > Firewall Rules > > Note that if your cluster is behind a managed firewall, you might need to whitelist the Cluster's API server's FQDN and corresponding Public IP. # Running a standalone Docker agent Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/standalone-docker-agent Run the env zero self-hosted agent as a standalone Docker container using docker run with an agent access token and base64 state encryption key. Choosing the docker agent is the quickest way to start running the self-hosted agent. ## Running a deployment-agent 1. Create an agent pool and generate an authentication secret. See [Creating an Agent Pool](/guides/admin-guide/self-hosted-kubernetes-agent/overview#creating-an-agent-pool). 2. Create your **state encryption key**. This is the base64 encoding of any string you choose — the value itself can be anything, it just has to be base64 encoded. The agent uses it to encrypt and decrypt the environment state and working directory before they are persisted, and env zero never has access to it. For example, generate one from a passphrase of your choice: ```shell theme={null} echo -n 'your-passphrase' | base64 ``` Read more about the state encryption key [here](/guides/admin-guide/self-hosted-kubernetes-agent/env-zero-hosted-encrypted-state). 3. Run the agent: ```shell theme={null} docker run -e AGENT_ACCESS_TOKEN='' -e ENV0_STATE_ENCRYPTION_KEY='' ghcr.io/env0/deployment-agent:latest ``` The agent should be marked as `Active` and be ready to handle deployments. > [!NOTE] > > **Enabling Multi-Concurrency** > > Do you have multiple deployments waiting to run and you don't want to them to wait? > > Each container is designed to handle a single deployment at a time. > > **To run multiple deployments in parallel, create another deployment agent using the** `docker run command`. You can run any number of containers to satisfy your deployment needs. ## Cloud Credential Configurations These are optional configurations, and typically role authentication will be handled by native container service mechanisms. See note below regarding exposing Environment Variables for native authentication. | Keys | Description | | - | - | | `ASSUMER_ACCESS_KEY_ID` `ASSUMER_SECRET_ACCESS_KEY` | plaintext, access key and secret key user role that is used to assume the deployment credentials specified in the env zero project configurations. | For GCP, and Azure you can embed the Environment Variables for GCP and Azure and use ADDITIONAL\_ENV\_VARS to expose them to the runner environment. ## Secrets These are optional configurations, and typically will be handled by native authentication mechanisms in AWS, GCP, Azure if you're using the managed container services like ECS. | Keys | | | - | - | | `CUSTOMER_AWS_ACCESS_KEY_ID` `CUSTOMER_AWS_SECRET_ACCESS_KEY` `AWS_SECRETS_REGION` | plaintext, access key & secret key user role that has the following permission: `secretsmanager:GetSecretValue` `AWS_SECRETS_REGION`(optional) - default region is `us-east-1` | | `USE_OIDC_FOR_AWS_SSM` | When enabled, the agent will authenticate to AWS SSM using env zero OIDC | | `USE_V2_OIDC_FOR_AWS_SSM` | When enabled, the OIDC token for AWS SSM secret fetching is requested with the v2 `sts.amazonaws.com` audience instead of the legacy env zero audience. The SSM role's trust policy must accept `sts.amazonaws.com`. Only used when `USE_OIDC_FOR_AWS_SSM=true`. See [OIDC token versions (v2 / v1)](/guides/integrations/oidc-integrations#token-versions-v2-per-provider-audience-and-v1-legacy) | | `CUSTOM_ROLE_FOR_OIDC_AWS_SSM` `CUSTOM_DURATION_FOR_OIDC_AWS_SSM` | Custom role for AWS SSM secret fetching, Note: only used when `USE_OIDC_FOR_AWS_SSM=true` | | `CUSTOMER_VAULT_TOKEN` `CUSTOMER_VAULT_ADDRESS` | plaintext, using HashiCorp Vault to store secrets Token should be a long lived token. | | `CUSTOMER_GOOGLE_PROJECT` `CUSTOMER_GOOGLE_CREDENTIALS` | plaintext, Google service account credentials to fetch GCP secrets requires `Secret Manager Secret Access role` | | `CUSTOMER_AZURE_CLIENT_ID` `CUSTOMER_AZURE_CLIENT_SECRET` `CUSTOMER_AZURE_TENANT_ID` | plaintext, using Azure Key Vault Secrets to store secrets for the agent | ## Cost Estimation | Key | Description | | :- | :- | | `INFRACOST_API_KEY` | Infracost API Key, create a personal / organizational key at infracost.io | ## Running a vcs-agent (for on-prem / self-hosted VCS) In the case that you are using a self-hosted version control such as Bitbucket Server, GitLab Enterprise, GitHub Enterprise, you will need to run the `vcs-agent`. It has to run **in parallel** with the `deployment-agent` to interact with private VCS. 1. Set credentials for the relevant VCS as environment variables (see variables table below) 2. Run docker: `docker run -e AGENT_ACCESS_TOKEN='' ghcr.io/env0/vcs-agent:latest`\ env zero has a public docker registry on GitHub which is maintained [here](https://github.com/orgs/env0/packages/container/package/vcs-agent). | Keys | Description | Required for feature | | :- | :- | :- | | `BITBUCKET_SERVER_CREDENTIALS` | Bitbucket server credentials in the format `username:token` ([using a Personal Access token](https://confluence.atlassian.com/bitbucketserver076/personal-access-tokens-1026534797.html#Personalaccesstokens-usingpersonalaccesstokens)). | On-premise Bitbucket Server installation. | | `GITLAB_ENTERPRISE_CREDENTIALS` | Gitlab Enterprise credentials in the form of a [Personal Access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token). | On-premise Gitlab Enterprise installation | | `GITLAB_ENTERPRISE_BASE_URL_SUFFIX` | In cases where your GitLab instance base url is not at the root of the url, and in a separate path, e.g `https://gitlab.acme.com/prod` you should define that added suffix to this value `GITLAB_ENTERPRISE_BASE_URL_SUFFIX=prod` | On-premise Gitlab Enterprise installation | | `GITHUB_ENTERPRISE_APP_ID` `GITHUB_ENTERPRISE_APP_CLIENT_ID` `GITHUB_ENTERPRISE_APP_INSTALLATION_ID` `GITHUB_ENTERPRISE_APP_CLIENT_SECRET` `GITHUB_ENTERPRISE_APP_PRIVATE_KEY` | [GitHub Enterprise integration](/guides/admin-guide/templates/github-enterprise-integration) (see step 3) | On-premise GitHub Enterprise installation | ## Exposing Custom Environment Variables By default, env zero's runner will not expose all the environment variables defined in the container. This is to help ensure some safety, and isolating the container environment from the runner's environment. However, in certain scenarios, you may still want to expose environment variables defined in the container. For example, if you're running in AWS ECS, and you want to use the cluster role for authorization purposes. | Key | Description | | :- | :- | | `ADDITIONAL_ENV_VARS` | `["ENV_VAR_A", "ENV_VAR_B","ENV_VAR_C"]` This single-quoted array will allow the runner environment to see the three environment variables listed in the list. This assume those environment variables were defined with the docker configuration itself. | ### AWS ECS When defining a role for the container, AWS sets an environment `AWS_CONTAINER_CREDENTIALS_RELATIVE_URI` this variable should be added to the `ADDITIONAL_ENV_VARS` to be exposed to the runner environment. For example, `ADDITIONAL_ENV_VARS=["AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"]` # Install the agent with Terraform Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/terraform-bootstrap Create an EKS cluster, an agent pool, an agent secret, and the env zero self-hosted Kubernetes agent from one Terraform or OpenTofu configuration. Use one Terraform or OpenTofu configuration to create an AWS EKS cluster and install the env zero self-hosted Kubernetes agent on it. The configuration combines the [k8s-modules](https://github.com/env0/k8s-modules) `aws` module with the [env zero provider](https://registry.terraform.io/providers/env0/env0/latest/docs) and the [Helm provider](https://registry.terraform.io/providers/hashicorp/helm/latest/docs). The configuration creates: * A VPC, an EKS cluster with a managed node group, and the cluster autoscaler * An agent pool and an agent secret in env zero * The `env0-agent` Helm release, configured with [env zero hosted encrypted state](/guides/admin-guide/self-hosted-kubernetes-agent/env-zero-hosted-encrypted-state), so the cluster needs no persistent volume To install the agent on an EKS cluster you already have, see [Use an existing EKS cluster](#use-an-existing-eks-cluster). ## Prerequisites > [!WARNING] > > Creating agent pools and agent secrets requires an API key with the **Edit Organization Settings** permission. Self-hosted agents are available to Enterprise customers only. * Terraform 1.3.2 or later, or OpenTofu * AWS credentials that can create a VPC, an EKS cluster, IAM roles, and Auto Scaling group settings * AWS CLI v2 and `bash` on the machine that runs Terraform or OpenTofu. The Helm provider authenticates with `aws eks get-token`, and the `aws` module runs `aws autoscaling` commands. * The Helm CLI, to run the chart tests in [Verify the installation](#verify-the-installation) * An env zero [API key](/guides/admin-guide/user-role-and-team-management/api-keys), exported as environment variables: ```shell theme={null} export ENV0_API_KEY= export ENV0_API_SECRET= ``` ## Create the configuration Save the configuration below as `main.tf` in an empty directory. The example pins the module to `v1.2.0`. Check the [k8s-modules releases](https://github.com/env0/k8s-modules/releases) and use the latest tag. ```hcl main.tf theme={null} terraform { required_providers { env0 = { source = "env0/env0" version = "~> 1.33" } helm = { source = "hashicorp/helm" version = ">= 2.13.0, < 3.0.0" } random = { source = "hashicorp/random" version = "~> 3.6" } } } variable "region" { default = "us-east-1" } variable "cluster_name" { default = "env0-agent" } module "cluster" { source = "github.com/env0/k8s-modules//aws?ref=v1.2.0" region = var.region cluster_name = var.cluster_name create_efs_storage = false } provider "env0" {} provider "helm" { kubernetes { host = module.cluster.cluster_endpoint cluster_ca_certificate = base64decode(module.cluster.cluster_certificate_authority_data) exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" args = ["eks", "get-token", "--cluster-name", module.cluster.cluster_name, "--region", var.region] } } } resource "env0_agent_pool" "this" { name = var.cluster_name } resource "env0_agent_secret" "this" { agent_id = env0_agent_pool.this.id } # Encrypts the deployment state and working directory before the agent uploads them. resource "random_password" "state_encryption_key" { length = 32 special = false } resource "helm_release" "env0_agent" { repository = "https://env0.github.io/self-hosted" chart = "env0-agent" # Latest chart: https://github.com/env0/self-hosted/releases version = "v5.5.6" # Wait for the node group and the addons, so the agent pods can start depends_on = [module.cluster] name = "env0-agent" namespace = "env0-agent" create_namespace = true timeout = 600 set_sensitive { name = "agentAccessToken" value = env0_agent_secret.this.secret } set_sensitive { name = "env0StateEncryptionKey" value = base64encode(random_password.state_encryption_key.result) } } ``` > [!WARNING] > > Pass secret Helm values, such as `agentAccessToken`, `env0StateEncryptionKey`, or cloud credentials, with `set_sensitive`. Do not put them in `values`: the Helm provider stores `values` unredacted in the `helm_release` metadata, and `terraform plan` prints that metadata when the release changes. > > The state stores the agent secret and the state encryption key. Use an encrypted remote backend for this configuration. If the encryption key changes, existing environments that use local state lose their state. See [Key rotation](/guides/admin-guide/self-hosted-kubernetes-agent/env-zero-hosted-encrypted-state#key-rotation). The `aws` module accepts more inputs, such as `kubernetes_version`, `instance_types`, and `max_capacity`. See the [aws module reference](https://github.com/env0/k8s-modules#aws-module-reference). ## Apply the configuration 1. Initialize the working directory: ```shell theme={null} terraform init ``` 2. Apply the configuration: ```shell theme={null} terraform apply ``` For OpenTofu, run `tofu init` and `tofu apply`. ## Verify the installation 1. Configure `kubectl` for the new cluster. If you changed `cluster_name` or `region`, use your values: ```shell theme={null} aws eks update-kubeconfig --name env0-agent --region us-east-1 ``` 2. Run the chart tests: ```shell theme={null} helm test env0-agent --namespace env0-agent --logs --timeout 1m ``` 3. In env zero, go to **Organization Settings** > **Agents**. The agent pool named after `cluster_name` (`env0-agent` by default) shows **Active**. ## Assign the agent to a project Add an `env0_agent_project_assignment` resource to run a project's deployments on the new agent: ```hcl main.tf theme={null} resource "env0_agent_project_assignment" "this" { agent_id = env0_agent_pool.this.id project_id = "" } ``` Projects without an assignment use the organization default agent. See [Running multiple self-hosted agents](/guides/admin-guide/self-hosted-kubernetes-agent/multiple-self-hosted-agents). ## Use an existing EKS cluster To install the agent on an EKS cluster that already exists, read the cluster with a data source instead of creating it: 1. Remove the `module "cluster"` block, and the `depends_on` line from `helm_release`. 2. Add the `aws` provider to `required_providers`: ```hcl main.tf theme={null} aws = { source = "hashicorp/aws" version = ">= 5.95.0" } ``` 3. Replace the `provider "helm"` block with: ```hcl main.tf theme={null} provider "aws" { region = var.region } data "aws_eks_cluster" "this" { name = var.cluster_name } provider "helm" { kubernetes { host = data.aws_eks_cluster.this.endpoint cluster_ca_certificate = base64decode(data.aws_eks_cluster.this.certificate_authority[0].data) exec { api_version = "client.authentication.k8s.io/v1beta1" command = "aws" args = ["eks", "get-token", "--cluster-name", data.aws_eks_cluster.this.name, "--region", var.region] } } } ``` 4. Set the `cluster_name` variable default to the name of your cluster. The cluster must meet the [Self-Hosted Kubernetes Agent requirements](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#requirements). With env zero hosted encrypted state, the cluster needs no `env0-state-sc` StorageClass. ## Keep the state in your AWS account If the deployment state and working directory must stay in your AWS account, store them on EFS instead of env zero hosted encrypted state. Make this choice before the first deployment runs on the agent. > [!WARNING] > > On an agent that already ran deployments, removing `env0StateEncryptionKey` loses the local state of existing environments, and Terraform re-creates their resources. Move those environments to a remote backend first. See [Key rotation](/guides/admin-guide/self-hosted-kubernetes-agent/env-zero-hosted-encrypted-state#key-rotation). 1. In `module "cluster"`, remove `create_efs_storage = false`. The module then creates an EFS file system, the EFS CSI driver, and the `env0-state-sc` StorageClass. 2. Remove the `random_password` resource and the `env0StateEncryptionKey` block from `helm_release`. Without the key, the agent chart creates a persistent volume claim on `env0-state-sc`. ## Next steps * [Customize the agent's Helm values](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration) in `helm_release.env0_agent` * [Give deployments an IAM role](/guides/admin-guide/self-hosted-kubernetes-agent/authenticating-the-agent-on-aws-eks), using the `oidc_provider_arn` module output in the role's trust policy * [Store deployment logs in your AWS account](/guides/admin-guide/self-hosted-kubernetes-agent/hosting-the-deployment-logs) # Troubleshooting Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/troubleshooting Troubleshoot common env zero self-hosted Kubernetes agent issues, including SIGKILL and SIGABRT errors caused by pod memory limits or the Node.js heap limit. ## Deploy failed with signal SIGKILL or exit code 137 If your deployment failed with `deploy failed with signal SIGKILL` or exit code `137`, the deployment pod most likely ran out of memory. When a container exceeds its memory limit, Kubernetes kills it with `SIGKILL` and marks the pod `OOMKilled`. Run `kubectl describe pod ` and check the last state's reason to confirm. In this case, define `requests` and `limits` for the pod size as described in [Custom/optional configuration](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration). ## Deploy failed with signal SIGABRT If your deployment failed with `deploy failed with signal SIGABRT`, the deployment process most likely ran out of Node.js heap memory. The pod is not `OOMKilled` in this case, so `kubectl describe pod` doesn't show it. Run `kubectl logs ` and look for `Reached heap limit` or `JavaScript heap out of memory` to confirm. Raising the pod's memory `limits` helps only if the pod limit, not the Node.js heap limit, is the one being reached. ## Next steps * [Check the agent's status](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-agents-monitoring) * [Upgrade the agent release](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#upgrade) after changing its resource values # Changing user ID Source: https://docs.envzero.com/guides/admin-guide/self-hosted-kubernetes-agent/using-a-custom-image-in-an-agent/change-user-id Change the default user ID and group ID in the env zero self-hosted agent Docker image using a custom Dockerfile and Helm strictSecurityContext settings. Our default image use `node` user with `uid` and `gid` 1000. If you want to change them, create a [custom image](/guides/admin-guide/self-hosted-kubernetes-agent/extending-deployment-image) with following commands: ```dockerfile Dockerfile theme={null} FROM : # choose your base image ARG USER_ID=1001210001 ARG GROUP_ID=2001210001 ENV USER_UID=${USER_ID} ENV USER_GID=${GROUP_ID} RUN apk add -U shadow \ && usermod -u ${USER_ID} node \ && groupmod -g ${GROUP_ID} node \ && apk del -U shadow ``` When [installing the agent](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#installation), add `runAsUser` and `runAsGroup` to helm `values.customer.yml`. `strictSecurityContext` must also be enabled to modify the `uid` and `gid`. ```yaml values.customer.yaml theme={null} ... strictSecurityContext: true runAsUser: "1002810011" runAsGroup: "1002810011" ``` ## Next steps To see what `strictSecurityContext` changes on the deployment pod, see [Custom/optional configuration](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration#strictsecuritycontext). # Template overview Source: https://docs.envzero.com/guides/admin-guide/templates Learn how env zero templates define reusable environment configurations for IaC, supporting Terraform, OpenTofu, Terragrunt, Pulumi, and CloudFormation. ## What is a template? In env zero, a template defines the type of environment that can be deployed. Environments are created based on templates. A template includes a name, a description, a valid set of configuration files that describe the deployment, and a set of [variables and secrets](/guides/admin-guide/variables). ## Why templates are useful * **Reusability:** A template can be reused across many environments, all pointing to the same code. This supports DRY (Don't Repeat Yourself) architecture and reduces configuration drift. * **Self-service with control:** Templates let engineers deploy cloud resources while giving admins control over what can and cannot be configured. * **Centralized variable management:** Variables defined at the template level are automatically inherited by all environments created from that template. ## Template types Templates reference specific IaC tools, and the type of template defines the required tool. **Terraform/OpenTofu**: Requires relevant `.tf` files in your Git repository. Either the `terraform` or `tofu` executable handles deployment, depending on the template type selected. **Terragrunt**: Requires [Terragrunt configurations](https://terragrunt.gruntwork.io/docs/getting-started/configuration/) and the correct folder hierarchy with `.tf` files. The `terragrunt` executable manages deployment. **Pulumi**: Requires code that describes your environment in the repository. The `pulumi` executable handles deployment. **CloudFormation**: Requires JSON or YAML CloudFormation templates. Managed by `aws cloudformation` commands. **Kubernetes**: Requires YAML or JSON files describing cluster resources. `Kustomize` labels resources, and `kubectl` manages them. **Helm**: Configurable via a Helm repo or Git repository with the chart definition. The `helm` executable and `helm diff` plugin handle deployment. ## Create a template To create a new template, click **CREATE NEW TEMPLATE** in the top right of the Templates screen (found in the Organization menu). Enter the Git repository details: the repository URL, a branch or tag name, and the path to the root directory of the IaC files. > [!NOTE] > > Templates can only be created at the Organization level, not at the Project level. > [!NOTE] > > **If your VCS is not GitHub, GitLab, Bitbucket, or Azure DevOps** > > Select the **Other VCS** option. You can enter the details manually or paste the full URL and let env zero extract the values. Auto-extraction works for HTTP/S repositories only. For SSH repositories, enter the URL manually. > > To access a private repository, select a Git access token from the **Select Token** field. To define tokens in env zero, see [Manage Git connectivity](#manage-git-connectivity) below. After creating the template, configure its [variables](/guides/admin-guide/variables) by clicking **Settings** and selecting the **Variables** tab. By default, environments inherit variables set at the Organization level, but you can override or add new ones. If your repository URL uses SSH, the token field is replaced by an SSH key field. ## Manage templates Templates can only be added, deleted, or edited at the Organization level. At the Project level, you can only associate or disassociate a template with the project. You can view all templates in the **Templates** tab, view the template code, and create new environments from templates. If you have the appropriate permissions, you can edit a template's settings, for example, changing the repository, branch, tag, or variables. You can delete a template. Deleted templates can no longer create new environments, but existing environments based on the deleted template are unaffected. > [!NOTE] > > Changes to a template only affect new deployments. To apply template changes to an active environment, you must redeploy it. ## On-premises Git server support Full GitOps support is available for GitHub Enterprise, GitLab Enterprise, and Bitbucket Server. Communication with these VCS providers is done through a self-hosted agent, so you do not need to expose your VCS to external networks. If you use the **Other VCS** type to access a Git server on a private network, you need to enable port forwarding with a public IP and a high port number. Open that port in your firewall for incoming traffic only from env zero's IP addresses. See [Security overview: IP addresses](/guides/overview/security-overview/ip-addresses). ## Manage Git connectivity ### Tokens (HTTP/S) To access a private Git repository via HTTP/S, env zero needs a read-only access token. Only Organization Admins can manage Git tokens. To view or add tokens, open **Organization Settings** and select the **Credentials** tab. To add a token, click **Add Token** and enter a name and the token value from your Git hosting service. If your service requires a username (such as Bitbucket or GitLab), enter the value as `username:token`. Token generation docs for each provider: * [GitHub personal access tokens](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) * [GitLab personal access tokens](https://docs.gitlab.com/ee/user/profile/personal_access_tokens) * [Bitbucket app passwords](https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html) * [Azure DevOps personal access tokens](https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate) ### SSH keys To access a private Git repository via SSH, env zero needs a private SSH key that has access to the repository. SSH keys are configured at the Organization level by Admins. To enable SSH connectivity, [associate an SSH key with your template](/guides/admin-guide/variables/ssh-keys). ## Automatic retry policy You can configure env zero to automatically retry a template after a failed deployment. Retries apply only to the apply or destroy step, not the plan step. To enable automatic retry: 1. Open the template's **Settings** page and find **Retry on failure** in the **Advanced** section. 2. Choose whether to retry on Deploy, Destroy, or both, and set the number of retry attempts. 3. Optionally define a regex pattern to retry only on specific errors. If no pattern is provided, all errors trigger a retry. ## Finding a template ID You may need the template ID when using the [Terraform provider](https://registry.terraform.io/providers/env0/env0/latest) or making [API calls](/api-reference). Find it in the Template Card on the **Templates** tab. ![Template card in the Templates tab showing the template ID location](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/4bdc4bd-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=72441fab2e0f69b127bc4afad3bab249) ## Best practices * Design templates for reuse across multiple environments. * Use consistent naming and structure across templates. * Define shared variables at the Organization level; override only when necessary. * Use secrets for sensitive configuration values. * Rotate Git access tokens and SSH keys regularly. ## Next steps * [Create an environment from your template](/guides/admin-guide/environments/setting-up-a-new-environment) * [Pin the IaC tool version](/guides/admin-guide/templates/iac-binaries-versions) each template runs * [Connect a self-hosted VCS](/guides/admin-guide/templates/self-hosted-vcs) if your code lives on GitHub Enterprise, Bitbucket Data Center, or self-managed GitLab # Ansible integration Source: https://docs.envzero.com/guides/admin-guide/templates/ansible Configure and deploy Ansible playbooks with env zero for automated configuration management, supporting standard Ansible versions with custom flows. [Ansible](https://www.ansible.com/) is an open-source automation tool for IT tasks such as configuration management, application deployment, and orchestration. Ansible uses simple YAML-based playbooks to define tasks, making it easy to automate complex processes. > [!NOTE] > > **Supported Versions** > > env zero supports all standard Ansible versions from `3.0.0` and above. ## Environment Deployment To manage your Ansible runs in env zero, follow these steps: 1. Create an Ansible [Template](/guides/admin-guide/templates) first 2. Optionally - Create [`env0.yml`](/guides/admin-guide/custom-flows) file in the target repository to run any custom command (ansible or otherwise). This is also needed to run commands during the destroy process 3. [Connect your cloud account](/guides/getting-started/connect-your-cloud-account) 4. Create an environment ## Execution Steps Beyond the common steps such as Clone, Loading variables, Deploy/Destroy, etc., Ansible environments offers the following execution steps: 1. Ansible Galaxy - `ansible-galaxy install -r requirements.yml` 2. Ansible Check Playbook - `ansible-playbook --check --diff` > [!WARNING] > > Note > > Using [check\_mode: false](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_checkmode.html#enforcing-or-preventing-check-mode-on-tasks) will cause Ansible code to be deployed prematurely. > It can cause regular Deployments still pending approval, Plans, and Drift Detection to deploy Ansible code. 3. Ansible Playbook - `ansible-playbook` > [!WARNING] > > Destroying Ansible Environments > > Please note that env zero does not execute any Ansible commands for destroying Ansible environments. > > It serves solely to attach [custom flows](/guides/admin-guide/custom-flows). > > Another thing to note - is that when Destroying Ansible Environments, there's no approval flow, unless you set [Approval Policies](/guides/policies-governance/approval-policies). ## Additional Controls ### Setting a custom Playbook file By default, env zero will run the `ansible-playbook` commands with `playbook.yml` or `playbook.yaml` (whichever is present). If you want to set a custom playbook file name, you can set the `ENV0_ANSIBLE_PLAYBOOK` variable with whichever value you desire. ### Setting custom flags To set any `ansible-playbook` flag, you can set an `ANSIBLE_CLI_flagName` environment variable. The flagName is always preceded by a `--`, like so: `--flagName` If a value is set to the variable, it will be appended to the flag with a space after the flag name, like so: `--flagName value` For example: 1. `ANSIBLE_CLI_become` would add the `--become` flag. 2. `ANSIBLE_CLI_inventory`, and setting its value to `hosts` would add the `--inventory hosts` flag. ### Setting extra variables To set any extra variable for `ansible-playbook`, you can set an `ANSIBLE_VAR_varName` variable. Any variable you add here will be parsed and added to the `--extra-vars` flag. For example, setting a `ANSIBLE_VAR_myVar` with a value `my-value`, would add the `--extra-vars 'myVar="my-value"'` flag. Multiple variables are supported, so setting `ANSIBLE_VAR_firstVar`=`value-one` and `ANSIBLE_VAR_secondVar`=`value-two`, would add `--extra-vars 'firstVar="value-one" secondVar="value-two"'`. ### Skipping Ansible Check Step In some cases, Ansible checks might fail but for a good reason, and in those cases you might want to skip those checks during the deployment. For this use case, you can set an environment variable named `ENV0_SKIP_ANSIBLE_CHECK` and set the value to be `true` - This will cause the deployment to skip that step and mark the step as `Skipped` and continue to the next steps in the deployment flow. ## Further reading * [Ansible conditionals: complete guide to when statements](https://www.envzero.com/blog/the-ultimate-guide-to-ansible-conditionals-for-smarter-automation) * [Mastering Ansible variables: practical guide with examples](https://www.envzero.com/blog/mastering-ansible-variables-practical-guide-with-examples) * [Protect secrets and passwords with Ansible Vault](https://www.envzero.com/blog/protecting-secrets-with-ansible-vault) ## Next steps [Connect the VCS provider](/guides/admin-guide/manage-vcs) that hosts your playbooks so env zero can clone them during deployment. # Azure DevOps integration Source: https://docs.envzero.com/guides/admin-guide/templates/azure-devops-integration Connect Azure DevOps repositories to env zero for IaC template creation, requiring Basic access level and View permissions for the organization. > [!WARNING] > > To integrate with Azure DevOps, you need an Azure DevOps user with `Basic` access level on the necessary Azure DevOps organization and `View permissions for this node` permission for the project. We recommend that this user be a designated shared bot user, as env zero will perform actions as this user on the project/repository. > > If you do not have the correct permissions, ask an administrator or a different user with those permissions to create the template. ## Prerequisites Before creating an Azure DevOps [template](/guides/admin-guide/templates), you need an Azure DevOps VCS connection configured in your organization. To set one up, go to **Organization Settings > VCS** and create a new Azure DevOps connection. Learn more: [Managing VCS Connections](/guides/admin-guide/manage-vcs#centralized-management) ## Microsoft Entra ID authentication Microsoft is [retiring Azure DevOps OAuth apps](https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/azure-devops-oauth) in 2026. env zero connects to Azure DevOps through Microsoft Entra ID instead. New Azure DevOps connections use Microsoft Entra ID by default. Connections created before the change use Azure DevOps OAuth until you switch them. > [!WARNING] > > Microsoft Entra ID supports work or school accounts only. Personal Microsoft accounts, such as `outlook.com` or `live.com` accounts, cannot authorize a connection. ### Switch an existing connection **Required permission:** Edit Organization Settings. **1. Find connections that need to switch** Go to **Organization Settings > VCS**. Azure DevOps connections that still use Azure DevOps OAuth show an exclamation mark next to the provider logo. In the **Configure VCS Connection** window, the **Deployment** card shows a **Needs attention** tag. **2. Open the connection details** Open the connection and click **Edit**. The method the connection uses is tagged **In use**. **3. Select Microsoft Entra ID** Select **Microsoft Entra ID (recommended)** and click **Grant Access**. **4. Sign in as the same user** Sign in with the Azure DevOps user who created the connection. If you sign in as a different user, env zero shows "Sign in as `` to switch this connection." and the connection does not change. Microsoft can sign you in with the account your browser is already signed in to. If that is a different user, retry from a private browser window. **5. Finish the switch** After the sign-in, env zero shows "Switched to Microsoft Entra ID." Click **Done**. The connection keeps its ID, so templates, environments, and webhooks that use it keep working. The previous Azure DevOps OAuth credentials are replaced. ### Admin consent If your Microsoft Entra tenant does not let users consent to apps, the sign-in fails with "Your Microsoft Entra administrator must grant consent to env0 before you can connect Azure DevOps." A tenant administrator grants consent once for the whole tenant. Send them this link: ```text theme={null} https://login.microsoftonline.com/organizations/v2.0/adminconsent?client_id=ace5b564-6a75-4df7-9309-9bd93f0969a4&scope=499b84ac-1321-427f-aa17-267ca6975798/vso.code%20499b84ac-1321-427f-aa17-267ca6975798/vso.code_status%20499b84ac-1321-427f-aa17-267ca6975798/vso.notification_write%20499b84ac-1321-427f-aa17-267ca6975798/vso.threads_full%20offline_access&redirect_uri=https://webhooks.api.env0.com/vcs-authorize/oauth/redirect ``` The administrator signs in, reviews the permissions, and clicks **Accept**. env zero then shows "Microsoft Entra admin consent was granted to env0. You can close this tab." After that, retry the switch. The link requests these Azure DevOps permissions: | Permission | Used for | | - | - | | `vso.code` | Read repositories and code | | `vso.code_status` | Report commit and pull request statuses | | `vso.notification_write` | Manage service hooks for webhooks | | `vso.threads_full` | Comment on pull requests | | `offline_access` | Keep the connection authorized without signing in again | ### Reauthorization If env zero does not use a Microsoft Entra ID connection for 90 days, Microsoft expires its authorization, and actions that use the connection fail. To authorize it again, open the connection, select **Microsoft Entra ID (recommended)**, and click **Grant Access** with the same user. ### FAQ > [accordion] Why is my connection marked? > > The connection uses Azure DevOps OAuth, which Microsoft is retiring. [Switch it to Microsoft Entra ID](#switch-an-existing-connection). > [accordion] What happens if I don't switch? > > The connection keeps using Azure DevOps OAuth, and env zero can't guarantee it keeps working. Microsoft [scheduled Azure DevOps OAuth for removal in 2026](https://learn.microsoft.com/en-us/azure/devops/integrate/get-started/authentication/azure-devops-oauth) and can stop it on its own schedule. When that happens, templates and environments that use the connection stop working until you switch. > [accordion] Can I switch using a different Azure DevOps user? > > No. Sign in as the user who created the connection. To use a different user, create a new connection and update your templates to use it. > [accordion] Why is the sign-in rejected when I use the right user? > > env zero matches the user by the Azure DevOps display name saved when the connection was created. If that user changed their display name since, the switch is rejected. Change the display name back to the one shown in the error, or contact env zero support. > [accordion] Why does the connection still show the mark after I switched? > > If env zero shows "Connection status not refreshed", the switch worked but the connection still shows its old method. Click **Grant Access** again with the same user. > [accordion] What if my administrator blocks the sign-in? > > Your tenant requires admin consent. Send your Microsoft Entra administrator the [admin consent link](#admin-consent). ## New Template **1. Create Template** Click **ADD A NEW TEMPLATE** on the top right in the *Templates* screen. Pick your template type, enter a name for the template, and click **NEXT**. **2. Select Azure DevOps** Click on the **Azure DevOps** button. **3. Select VCS Connection** Select a pre-configured Azure DevOps VCS connection from the dropdown. If no connection exists, click **Add VCS Connection** to create one. **4. Select Repository** Pick the repository from the list of accessible Azure DevOps projects. **5. Configure Source** If you would like to pull the code from a specific revision or branch, enter that in the `Branch` field. Leaving this field empty will use your default branch, which is usually "master"/"main". Enter the folder your IaC files are located in under the IaC type folder. If your IaC files are in the root of the repository, leave this empty. **6. Configure Variables** Click **NEXT** to proceed to the variables section. Add [environment and Terraform variables](/guides/admin-guide/variables#terraform-variables-and-environment-variables) that you'd like to be used during deployment, and then click **NEXT** to go to the final "Projects" section. **7. Assign Projects** Pick the [projects](/guides/admin-guide/projects) that you'd like to have access to deploy this template, and then click **DONE** to create the template. > [!WARNING] > > Troubleshoot > > * Can't find your repository? Verify that the VCS connection has access to the necessary Azure DevOps organization/project. You can check the available repositories in **Organization Settings > VCS** by selecting the relevant connection. > [!WARNING] > > **Azure DevOps old domain name URLs** > > Repositories using the old domain name URLs are not supported, i.e., if the URL for your git repository is in the format of `.visualstudio...` an environment won't be created. > > For more information about old domain name URLs and how to resolve the issue, read [here](https://learn.microsoft.com/en-us/azure/devops/release-notes/2018/sep-10-azure-devops-launch#switch-existing-organizations-to-use-the-new-domain-name-url). ## Existing Template If you would like to integrate an existing template with Azure DevOps: 1. From the **Templates** screen, click on **Settings** for the appropriate template you would like to integrate with Azure DevOps. 2. Click on the **VCS** step. From there you can click on the **Azure DevOps** button, and integrate with Azure DevOps as you would for a new template. > [!NOTE] > > Additional Content > > * [Managing Terraform variable hierarchy](https://www.envzero.com/blog/managing-terraform-variable-hierarchy) > * [Why env zero is a Terraform Cloud alternative?](https://www.envzero.com/alternatives/terraform-cloud-vs-envzero) ## Next steps Once environments deploy from your Azure DevOps template, you can [run a plan on each pull request](/guides/admin-guide/environments/plan-on-pull-request) before merging. # Standard Bitbucket integration Source: https://docs.envzero.com/guides/admin-guide/templates/bitbucket-integration Connect Bitbucket Cloud repositories to env zero to create templates and manage deployments using the Bitbucket App for repository access. > [!WARNING] > > To integrate with Bitbucket, you need the necessary permissions on your Bitbucket workspace/repository. If you do not have those permissions, ask an admin or a different user with those permissions to create the template. ## Prerequisites Before creating a Bitbucket [template](/guides/admin-guide/templates), you need a Bitbucket VCS connection configured in your organization. To set one up, go to **Organization Settings > VCS** and create a new Bitbucket connection. Learn more: [Managing VCS Connections](/guides/admin-guide/manage-vcs#centralized-management) ## New Template If you would like to create your first Bitbucket Integrated Template in this env zero organization, please see **[Create your first template](/guides/getting-started/create-your-first-template)** instead. **1. Create Template** Click **ADD A NEW TEMPLATE** on the top right in the *Templates* screen. Pick your template type, enter a name for the template, and then click **NEXT**. **2. Select Bitbucket** Click on the **Bitbucket.org** button. **3. Select VCS Connection** Select a pre-configured Bitbucket VCS connection from the dropdown. If no connection exists, click **Add VCS Connection** to create one. **4. Select Repository** Pick the repository containing your IaC configuration. **5. Configure Source** If you would like to pull the code from a specific revision or branch, enter that in the `Revision` field. Leaving this field empty will use your default branch, which is usually "master"/"main". Enter the folder your IaC files are located in under `Terraform Folder` or `Terragrunt Folder`. If your IaC files are in the root of the repository, leave this empty. **6. Configure Variables** Click **NEXT** to proceed to the variables section. Add environment and IaC variables that you'd like to be used during deployment, and then click **NEXT** to go to the final "Projects" section. **7. Assign Projects** Pick the projects that you'd like to have access to deploy this template, and then click **DONE** to create the template. > [!WARNING] > > Troubleshooting > > * Can't find your repository? Verify that the VCS connection has access to the necessary Bitbucket workspace/repository. You can check the available repositories in **Organization Settings > VCS** by selecting the relevant connection. ## Existing Template If you would like to integrate an existing template with Bitbucket: 1. Go to the **Templates** screen, and click on **Settings** for the template you would like to integrate with Bitbucket. 2. Click on the **VCS** step. From there you can click on the **Bitbucket.org** button, and integrate with Bitbucket as you would for a new template. # Bitbucket Server integration Source: https://docs.envzero.com/guides/admin-guide/templates/bitbucket-server-integration Integrate Bitbucket Server or Data Center with env zero using a self-hosted agent and a personal access token with Repository write permissions. > [!NOTE] > > Note > > Bitbucket Server is only supported on env zero Organizations signed up for our [Self-Hosted Agent](/guides/overview/security-overview/#self-hosted-agents). > > Minimum supported version: BitBucket Server v7.6 ## Initial Bitbucket Server Setup For env zero to be able to clone your code and post back commit statuses when running [Plan on Pull Request](/guides/admin-guide/environments/plan-on-pull-request) you need to provide it with an access token with write permissions. This only needs to be done once for your Organization. 1. Create a [Personal access token](https://confluence.atlassian.com/bitbucketserver076/personal-access-tokens-1026534797.html#Personalaccesstokens-usingpersonalaccesstokens) on your Bitbucket Server. * We recommend creating the token for a bot user - as that is the user that will post back commit statuses and comments. * The user must have access to each repository you would like to be able to use with env zero. * The token must have "Repository write" permissions. 2. Encode the personal access token, and the username it was generated for, in the format of `username:token` - in base64. The encoded value should be used in the agent installation process as a helm value - `bitbucketServerCredentialsEncoded`. Check out our [Self-Hosted K8S agent docs](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration) for more information. 3. Install/update the agent with the new value ## Webhooks Integration Adding Webhooks is required to support [Continuous Deployment](/guides/admin-guide/environments/continuous-deployment) and our [Plan on Pull Request](/guides/admin-guide/environments/plan-on-pull-request) features on Bitbucket Server. 1. Open your repository page in Bitbucket Server. 2. Click on the settings icon. 3. Enter the **Webhooks** page. 4. Click on the "Create webhook" button. 5. Give it a name, like "env zero integration". 6. Copy & Paste the URL and Secret values from the env zero Template creation page. 7. Mark **ONLY** Repository **Push** and Pull Request **Opened** and **Source branch updated**, as shown in the picture below. 8. Make sure the webhook is marked as Active. 9. Click on the **Create** button. ![Bitbucket Server webhook creation interface](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/bitbucket_server_webhook_creation_interface.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=cab084088bb443d95b170e779ff9c2cf) BBS webhook creation ## Next steps * [Deploy the self-hosted agent](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent), passing `bitbucketServerCredentialsEncoded` as a Helm value * [Manage the Bitbucket Server connection](/guides/admin-guide/manage-vcs) from Organization Settings # AWS CloudFormation integration Source: https://docs.envzero.com/guides/admin-guide/templates/cloudformation Manage AWS CloudFormation stacks with env zero for automated provisioning, drift detection, and change set review using ENV0_CF_PARAM_ variables. AWS CloudFormation lets you model, provision, and manage AWS and third-party resources by treating Infrastructure as Code. With CloudFormation, you declare all your resources and dependencies in a template file, which defines a collection of resources as a single unit called a stack. CloudFormation creates and deletes all member resources of the stack together and manages all dependencies between the resources. Manage your CloudFormation stack within env zero to enjoy features such as [Continuous Deployment](/guides/admin-guide/environments/continuous-deployment), [Policies](/guides/policies-governance/policies) and [RBAC](/guides/admin-guide/user-role-and-team-management/rbac). You can also use [Custom Flows](/guides/admin-guide/custom-flows) to alter the deployment by running commands, or [Workflows](/guides/admin-guide/workflows) to orchestrate multiple IaC stacks and dependencies between them. ## Environment Deployment 1. Create a CloudFormation [template](/guides/admin-guide/templates). 2. Create an [Environment](/guides/admin-guide/environments). You can set the stack name or env zero can generate a random name for you. ## CloudFormation Stack Parameters To provide parameters to a CloudFormation stack, use [env zero Variables](/guides/admin-guide/variables). Any environment variable prefixed with `ENV0_CF_PARAM_` will be passed as a parameter to the CloudFormation stack. For example, if you set the environment variable `ENV0_CF_PARAM_STAGE=dev`, the CloudFormation stack will receive the parameter `STAGE=dev`. env zero creates a file containing all the parameters and their values, and passes it to the deploy command (`--parameter-overrides file://`. You can control the name of the parameters file by setting the `ENV0_CF_PARAMETERS_FILE` environment variable. This can be helpful if you already have a parameters file (from VCS or generated using [Custom Flows](/guides/admin-guide/custom-flows)). env zero will merge it with parameters from any `ENV0_CF_PARAM_XXX` environment variables. See the section below for an example of a parameters file. ## Execution Steps Other than common steps such as Clone, Loading Variables, etc., env zero executes the following steps for CloudFormation environments: * On Deploy: 1. CloudFormation Describe Change Set\ `awsv2 cloudformation deploy --stack-name --template-file --no-execute-changeset --parameter-overrides file://`\ `awsv2 cloudformation describe-change-set --change-set-name ` 2. CloudFormation deploy\ `awsv2 cloudformation deploy --stack-name --template-file --parameter-overrides file://` 3. CloudFormation Stack Outputs\ `awsv2 cloudformation describe-stacks --stack-name ` * On Destroy: 1. CloudFormation List Stack Resources (to list resources that will be destroyed)\ `awsv2 cloudformation list-stack-resources --stack-name ` 2. CloudFormation Delete Stack\ `awsv2 cloudformation delete-stack --stack-name `\ `awsv2 cloudformation wait stack-delete-complete --stack-name ` * Drift Detection: 1. Cloudformation - Detect stack drift (To trigger Drift detection)\ `awsv2 cloudformation detect-stack-drift --stack-name ` 2. Cloudformation - Describe stack drift detection status\ `awsv2 cloudformation describe-stack-drift-detection-status --stack-drift-detection-id ` 3. CloudFormation - Describe stack resources drift\ `awsv2 cloudformation describe-stack-resource-drifts --stack-name --stack-resource-drift-status-filters MODIFIED DELETED NOT_CHECKED` > [!NOTE] > > **Drift Detection** > > Not all CloudFormation resources support Drift Detection. > > * You can find a complete list of supported resources [here](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/resource-import-supported-resources.html). > * For Drift Detection to function properly you might need to have certain permissions in place. You can find further information [here](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/using-cfn-stack-drift.html#drift-considerations). ## Providing custom CloudFormation CLI Arguments Occasionally, you may need to pass CLI arguments as CloudFormation commands. These can be passed to CloudFormation by setting Environment Variables on env zero, prefixed by `ENV0_CF_CLI_ARGS_`. An example of a CloudFormation command (with an underscore for dashes) would look like this: `ENV0_CF_CLI_ARGS_deploy`, `ENV0_CF_CLI_ARGS_delete_stack` etc. A common use case is when trying to create IAM resources. CloudFormation [may require you](https://docs.aws.amazon.com/AWSCloudFormation/latest/APIReference/API_CreateStack.html) to explicitly acknowledge that your stack template contains certain capabilities in order for AWS CloudFormation to create the stack. In that case, you could set `ENV0_CF_CLI_ARGS_deploy` to `--capabilities CAPABILITY_NAMED_IAM`.\ Multiple arguments may be set, separated by a blank space (` `). ### Templates exceeding 51,200 bytes must be deployed via an S3 Bucket If your templates exceed the size limit, you must specify a bucket to store the template. In env zero set `ENV0_CF_CLI_ARGS_deploy=--s3-bucket=` where `bucket` is an s3 bucket to store the template. ## Import existing CloudFormation Stacks env zero can manage existing CloudFormation stacks. To import an existing stack into env zero, please follow the instructions below: 1. Commit the template used to create the stack into a Git repository 2. Prepare any parameters you've used to configure the stack 3. Create an Environment from VCS or template. If using a template, see the [template docs](/guides/admin-guide/templates) for creating a CloudFormation template in env zero 4. Add the parameters as described above (ENV0\_CF\_PARAM\_\*) 5. Specify the Stack Name, exactly as listed in the AWS console ## Example of a CloudFormation parameters file Here's an example of a parameters JSON file you could either create or use with your CloudFormation stack: ```json theme={null} [ { "ParameterKey": "BucketName", "ParameterValue": "hello-world" }, { "ParameterKey": "Description", "ParameterValue": "This is my description." } ] ``` ## Adding Custom Tags Using `ENV0_CUSTOM_TAGS` you can add additional tags to your CloudFormation stack. Read more [here](/guides/admin-guide/additional-controls/#adding-custom-resource-tagging). ## Next steps * [Set up drift detection](/guides/admin-guide/environments/drift-detection) to catch changes made to your stacks outside env zero * [Connect the Git provider](/guides/admin-guide/manage-vcs) that stores your CloudFormation templates # GitHub Enterprise integration Source: https://docs.envzero.com/guides/admin-guide/templates/github-enterprise-integration Integrate GitHub Enterprise Server with env zero using a self-hosted agent and a custom GitHub App for code cloning and PR plan status posting. [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server) allows you to host GitHub on your own infrastructure, giving you full control over your version control system (VCS). [By integrating GHE with env zero](/guides/admin-guide/templates/self-hosted-vcs), you can use all of env zero's capabilities, including infrastructure as code (IaC) automation, governance, and cost management, while maintaining a self-hosted and secure environment for your repositories. This integration ensures that teams using GHE can manage and automate their cloud infrastructure with env zero, without compromising security or compliance requirements. > [!NOTE] > > **Note** > > GitHub Enterprise is only supported on env zero Organizations signed up for our [Self-Hosted Agent](/guides/overview/security-overview/#self-hosted-agents). > > Supported GitHub Enterprise Server versions are: > > * 2.21.13 and above > * 3.x ## GitHub Enterprise Setup For env zero to be able to clone your code and post back commit statuses when running [Plan on Pull Request](/guides/admin-guide/environments/plan-on-pull-request) you need to create and install a personal env zero GitHub App on your organization. This only needs to be done once per GitHub Server. 1. [Create GitHub App](https://docs.github.com/en/developers/apps/building-github-apps/creating-a-github-app) 1. Name your GitHub app env zero 2. Set Homepage URL to [https://env0.com](https://env0.com) 3. Skip ahead to the **Webhooks section** * Make sure **Active** is checked * You will now need to set the Webhook URL and Secret. * To fetch these, go to the [VCS Create Connection](/guides/admin-guide/templates/self-hosted-vcs/#configure-webhook-integration). 4. Skip ahead to the **Repository permissions section** and grant the following permissions: * Checks - Read and write * Contents - Read-only (For "Code Write", select Read and Write. If you changed this after the initial installation, you must reinstall the GitHub application). * Deployments - Read and Write * Metadata - Read-only * Pull requests - Read and Write 5. Skip ahead to the **Subscribe to events section** and check the following: * Push * Pull Request * Pull request review comment - In case you want to enable [Plan and Apply from PR comments](/guides/admin-guide/environments/plan-and-apply-from-pr-comments) 6. On "Where can this GitHub App be installed?" Check "Any account - Allow this GitHub App to be installed by any user or organization.". **Note however - currently you may only install the app on a single organization of your choice on your GitHub Enterprise instance** 7. Click "Create GitHub App" 8. Make a note of the App ID 9. Scroll all the way down and "Click the Generate a private key". A pem file will be downloaded and saved on your computer. You'll need it later. 10. Under the "Display information", click the "Upload a logo..." button and upload a logo (Optional) 2. On the lefthand side menu, click on Install App to install the app on any organization of your choice 1. Grant env zero access to all or selected repositories in the organization. 2. Ensure you have granted permission for any organization's repository you need access to. If permission is not granted for a specific repository, you may encounter a 'Not Found' error at certain points. ![GitHub App installation page showing organization selection for granting repository access](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/067780fe0d3b5c5c1c4925d3388635a465e83a08743a709f0ba2074336bc4008-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=340c2852badb36fed0eaee4a4f69ef09) ![GitHub App repository permissions screen for selecting which repos env zero can access](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/39c4b3b02629f009555ec0891a3f5f5915e96464a6dc91b6258e01131e078906-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=36b9a4bc3111ad3a3f3c15995c294235) 3. You'll need the following set as Helm values when installing the env zero agent: * `githubEnterpriseAppId` - The App ID from step 1.8 * `githubEnterpriseAppPrivateKeyEncoded` - The content of the pem file downloaded in step 1.9 **Please base64 encode it before setting it** * `githubEnterpriseAppInstallationId` - (Optional) You can restrict permissions to a single installation ID through this configuration. > [!WARNING] > > **Note** > > If deploying via Docker, **DO NOT** base64 encode the following keys: > > * `githubEnterpriseAppClientSecretEncoded` > * `githubEnterpriseAppPrivateKeyEncoded` > [!NOTE] > > **Encode to Base64** > > You can open browser Dev Tools - go to console and use > > ```javascript theme={null} > btoa("secret") > ``` > > to encode the string to base 64 > > **On Mac** > > ```bash theme={null} > base64 -i private.pem > ``` ```yaml values.yml theme={null} githubEnterpriseAppId: 111 githubEnterpriseAppPrivateKeyEncoded: aa== githubEnterpriseAppInstallationId: 222 # Optional ``` ```yaml .env theme={null} GITHUB_ENTERPRISE_APP_ID=111 GITHUB_ENTERPRISE_APP_PRIVATE_KEY=aa== # optional GITHUB_ENTERPRISE_APP_INSTALLATION_ID=222 ``` 4. [Install the agent](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#installation) Now you can create templates for **GitHub Enterprise** ## Next steps With the agent running, you can review and edit the GitHub Enterprise connection from the [VCS integrations page](/guides/admin-guide/manage-vcs#centralized-management). # Standard GitHub integration Source: https://docs.envzero.com/guides/admin-guide/templates/github-templates Connect GitHub repositories to env zero using the GitHub App for template creation, deployments, and PR plans with branch or revision selection. > [!NOTE] > > **Note** > > To integrate with GitHub, you need permission to install the GitHub App on your GitHub organization or repository. If you do not have these permissions, ask an admin or an authorized user to create the template. ## New Template To create your first GitHub Integrated Template, see **[Create your first template](/guides/getting-started/create-your-first-template)** instead. 1. In the top right corner of the [Templates](/guides/admin-guide/templates) screen, click ‘ADD A NEW TEMPLATE’ 2. Pick your template type, name it, and then click ‘NEXT’ 3. Click on the GitHub.com button 4. Pick the repository containing your IaC configuration 5. If you would like to pull the code from a specific revision or branch, enter it in the Revision field. Leaving this field empty will use your default branch, which is usually master/main 6. Under Terraform Folder, enter the folder your Terraform files are located in. If your Terraform files are in the repository’s root, leave this field empty 7. Click on ‘NEXT’ to proceed to the Variables section 8. Add the [Environment and Terraform variables](/guides/admin-guide/variables#terraform-variables-and-environment-variables) that you'd like to be used during deployment, then click ‘NEXT’ to go to the final Projects section 9. Pick the [projects](/guides/admin-guide/projects) that you'd like to have access to deploy this template, then click on 'DONE' to create the template ![GitHub template creation interface](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/github_template_creation_interface.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=7f9a4c95232b1e6953c005f35cedeae8) > [!WARNING] > > Troubleshooting > > * Can't find your repository? Check if your GitHub organization has the env zero GitHub App installed and that the App is allowed access to your repository. > * GitHub App is not installed: Click on the 'add another organization' link in the GitHub Repository field. You will get a popup allowing you to install the env zero GitHub app on another GitHub organization. > * GitHub App is installed and has access to the repository, but you still can't find your repository: Click on the 'add another organization' link and pick your GitHub organization, even though it already has the GitHub App installed. You will now see the env zero GitHub App settings page in GitHub. Edit the repositories that env zero App should have access to (you may also remove and re-pick a repository), then save your changes. Note: You can only do this if you are an organization admin for your GitHub organization. > * Got the following error: "GitHub App was not installed because you do not have permissions to install our GitHub App on your organization"? This means that you do not have permissions to install the GitHub App, and instead have sent a request to another user to install the App. Cancel that request in GitHub and ask a different user with permissions to install the GitHub App and create the template. > * A user already accepted your request to install the GitHub App? If so, follow the instructions in the GitHub App is installed and has access to the repository, but you still can't find your repository section above. ![GitHub App settings page](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/github_app_settings_page.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=ea03082189fd2f82b21b9a77004a0a42) Edit GitHub App Settings ## Existing Template If you would like to integrate an existing template with GitHub via a GitHub App: 1. Go to the Templates screen, and click on ‘Settings’ for the template you would like to integrate with GitHub 2. Click on ‘VCS’. From there you can click on the ‘GitHub.com’ button, and integrate with GitHub as you would for a new template ## Multi-Org Configuration 1. Click on ‘GitHub.com’ to create a new template 2. You will get a GitHub popup. Login if you're not already logged in 3. In the popup, pick the organization you would like to authorize ![GitHub organization selection popup for authorizing env zero multi-org access](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/395b45f-image_3.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=51ca6e2794e6ed560ec8c843ee3512ff) 4. After selecting the GitHub organization, you will be transferred to the GitHub App settings page for that organization ![GitHub App settings page for selecting repository access after organization authorization](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/11a1a2c-image_4.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=981e6c8a1bdaef913cb70cecdb63865b) 5. Here, you need to change something so that the GitHub dialogue will let you save. If ‘Only select repositories’ is already enabled, click on ‘All repositories’ and then re-click on ‘Only select repositories.’ You will then be able to save without changing any GitHub App permissions 6. Upon saving, env zero UI should be able to list the repositories. Once the template is saved, the env zero organization is integrated with GitHub > [!NOTE] > > Additional Content > > * [Managing Terraform variable hierarchy](https://www.envzero.com/blog/managing-terraform-variable-hierarchy) > * [Why env zero is a Terraform Cloud alternative?](https://www.envzero.com/alternatives/terraform-cloud-vs-envzero) ## Next steps * [Run a plan on every pull request](/guides/admin-guide/environments/plan-on-pull-request) in your GitHub repository * [Manage your VCS connections](/guides/admin-guide/manage-vcs) for every provider in one place # GitLab Enterprise integration Source: https://docs.envzero.com/guides/admin-guide/templates/gitlab-enterprise-integration Integrate GitLab Enterprise with env zero using a self-hosted agent and a personal access token with read_repository and api scopes. > [!NOTE] > > Note > > Gitlab Enterprise is only supported on env zero Organizations signed up for our [Self-Hosted Agent](/guides/overview/security-overview/#self-hosted-agents). ## Initial GitLab Enterprise Setup For env zero to be able to clone your code and post back commit statuses when running [Plan on Pull Request](/guides/admin-guide/environments/plan-on-pull-request) you need to provide it with an access token with write permissions. This only needs to be done once for your Organization. 1. Create a [Personal access token](https://docs.gitlab.com/ee/user/profile/personal_access_tokens.html#create-a-personal-access-token) on your GitLab Enterprise. * We recommend creating the token for a bot user - as that is the user that will post back commit statuses and comments. * The user must have access to each repository you would like to be able to use with env zero. For each project, the user should have at least Maintainer/Owner permissions. * The token must have the “read\_repository” and "api" scopes defined. 2. Encode the personal access token in base64, and use it in the K8S agent installation process as a helm value - `gitlabEnterpriseCredentialsEncoded`. Check out our [Self-Hosted K8S agent docs](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration) for more information. 3. Install/update the agent with the new value ## Webhooks Integration Adding Webhooks is required to support [Continuous Deployment](/guides/admin-guide/environments/continuous-deployment) and our [Plan on Pull Request](/guides/admin-guide/environments/plan-on-pull-request) features on Gitlab Enterprise. 1. Open your repository page in GitLab Enterprise. 2. Click on the settings icon. 3. Enter the **Webhooks** page. 4. Copy and paste the URL and Secret values from the env0 Template creation page. 1. Navigate to env zero > Organization Settings > VCS tab. 2. Find your Gitlab Self-Hosted connection, and click the pencil icon. 3. In the modal that pops up, click on '"Webhook Settings". 4. A new modal will pop up that contains the Webhook URL and Webhook Secret. 5. Check the "Push events", "Merge request events" and "Comments" events. 6. Click on the "Add webhook" button. ![GitLab Enterprise webhook creation interface](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/gitlab_enterprise_webhook_creation_interface.jpg?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=2cde1af5e630f2be2c2202dd421397de) GitLab Enterprise webhook creation ## Next steps * [Install the self-hosted Kubernetes agent](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent) with your encoded GitLab token in the Helm values * [Review your GitLab Enterprise connection](/guides/admin-guide/manage-vcs) among the organization's VCS integrations # Standard GitLab integration Source: https://docs.envzero.com/guides/admin-guide/templates/gitlab-integration Connect GitLab repositories to env zero using centralized VCS connections for template creation and deployments > [!WARNING] > > To integrate with GitLab, you need a GitLab user with Maintainer/Owner permissions on the necessary GitLab Project. We recommend using a designated shared bot user, as env zero performs actions as this user on the project/repository. > > If you do not have those permissions, ask an admin or a different user with those permissions to create the template. ## Prerequisites Before creating a GitLab [template](/guides/admin-guide/templates), you need a GitLab VCS connection configured in your organization. To set one up, go to **Organization Settings > VCS** and create a new GitLab connection. Learn more: [Managing VCS Connections](/guides/admin-guide/manage-vcs#centralized-management) ## New Template If you would like to create the first GitLab Integrated Template in this env zero organization, please see **[Create your first template](/guides/getting-started/create-your-first-template)** instead. **1. Create Template** Click **ADD A NEW TEMPLATE** on the top right in the *Templates* screen. Pick your template type, enter a name for the template, and then click **NEXT**. **2. Select GitLab** Click on the **GitLab.com** button. **3. Select VCS Connection** Select a pre-configured GitLab VCS connection from the dropdown. If no connection exists, click **Add VCS Connection** to create one. **4. Select Repository** Pick the repository containing your IaC configuration from the list of accessible GitLab projects. **5. Configure Source** If you would like to pull the code from a specific revision or branch, enter that in the `Revision` field. Leaving this field empty will use your default branch, which is usually "master"/"main". Enter the folder your Terraform files are located in under `Terraform Folder`. If your Terraform files are in the root of the repository, leave this empty. **6. Configure Variables** Click **NEXT** to proceed to the variables section. Add environment and Terraform variables that you'd like to be used during deployment, and then click **NEXT** to go to the final "Projects" section. **7. Assign Projects** Pick the projects that you'd like to have access to deploy this template, and then click **DONE** to create the template. > [!WARNING] > > Troubleshoot > > * Can't find your repository? Verify that the VCS connection has access to the necessary GitLab project. You can check the available repositories in **Organization Settings > VCS** by selecting the relevant connection. ## Existing Template If you would like to integrate an existing template with GitLab: 1. Go to the **Templates** screen, and click on **Settings** for the template you would like to integrate with GitLab. 2. Click on the **VCS** step. From there you can click on the **GitLab.com** button, and integrate with GitLab as you would for a new template. > [!NOTE] > > Additional Content > > * [Managing Terraform variable hierarchy](https://www.envzero.com/blog/managing-terraform-variable-hierarchy) > * [Why env zero is a Terraform Cloud alternative?](https://www.envzero.com/alternatives/terraform-cloud-vs-envzero) # Helm integration Source: https://docs.envzero.com/guides/admin-guide/templates/helm Deploy Helm charts with env zero from Git, Helm repositories, OCI registries, or S3, with helm diff and upgrade support for private chart repos. Helm is a popular package manager for Kubernetes, an open-source container orchestration platform. It simplifies the deployment and management of applications in Kubernetes clusters by providing a templating system and a standardized way to package, distribute, and deploy software. With Helm, developers can define their application's configuration and dependencies using "charts," which are essentially packages that contain all the necessary files, templates, and metadata. These charts can be versioned and shared, allowing for easy collaboration and reuse across different projects. ## Helm Chart Source env zero supports using Helm with different chart sources: 1. `git`/`local` - Use charts that are defined in your code and are not hosted in a Helm Repo. 2. `Helm Repo` - both [regular chart repositories](https://helm.sh/docs/topics/chart_repository/) and [OCI-based registries](https://helm.sh/docs/topics/registries/). If the repository requires authentication you can provide the username and password in `ENV0_HELM_REPO_USERNAME` and `ENV0_HELM_REPO_PASSWORD` environment variables. 3. `S3` - Hosted directly on S3, similar to `Helm Repo` these charts are hosted remotely but they follow a different protocol. To use a chart that is defined directly in your `git` select the appropriate VCS provider and provide the path to your Helm chart code: ![Helm template configuration showing VCS provider selection and chart path field for git-based charts](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/fe72ec5-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=5d0bc70cec255f6db57631f1139e4b4b) To use a chart hosted in a `Helm Repo` / `S3` select the Helm Repo option in your template: ![Helm Repo option selected in the template configuration for using a remotely hosted chart](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/2e0ed11-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=75eeacb369b0c8fcf07409e0b3391af7) > [!NOTE] > > **Custom Flow For Helm Repo Deployments** > > Helm Repo deployments do not require git clone since the chart is not stored in git, therefore there is no custom flow for a Helm Repo template. > > To use custom flows (for cluster authentication or other usages) in Helm Repo you must configure a [Project-level custom flow](/guides/admin-guide/custom-flows/project-level-custom-flow). ## Environment Deployment 1. Create a Helm [Template](/guides/admin-guide/templates). 2. Follow our guide to [Connect Your Kubernetes Cluster](/guides/getting-started/connect-your-cloud-account/#kubernetes). 3. Create an [Environment](/guides/admin-guide/environments/setting-up-a-new-environment) 1. The provided namespace is automatically injected with [HELM\_NAMESPACE](https://helm.sh/docs/helm/helm/#helm) env var 2. If the provided namespace does not exist, make sure to add `--create-namespace` flag in the `upgrade` step. (See the section below for the instructions) > [!NOTE] > > **Cluster Authentication** > > Cluster authentication varies from one provider to another. Please refer to the [Connect Your Kubernetes Cluster](/guides/getting-started/connect-your-cloud-account/#kubernetes) guide to learn more. ## Environment Variables For Enhanced Customization env zero supports a more customized usage by providing unique environment variables which will be passed to Helm: 1. `ENV0_HELM_SET_` - set an environment variable with the `ENV0_HELM_SET` prefix and the variable name as the suffix will be passed to Helm using the `--set` flag. E.g. `ENV0_HELM_SET_servers[0].port=80` will pass `--set server[0].port=80` to helm command. (see below for additional examples for inputting more complex types) 2. `ENV0_HELM_VALUES_FILES` - set this environment variable to provide Helm with your configuration which is stored in a values file(s), and will be passed to Helm using the `--values (-f)` flag. 3. `ENV0_HELM_CLI_ARGS` - this variable's value will be added to every Helm command execution, it can be used to pass additional custom arguments to Helm. For example it can be set to `--create-namespace --no-hooks`. `ENV0_HELM_CLI_ARGS_diff`, `ENV0_HELM_CLI_ARGS_upgrade`, and `ENV0_HELM_CLI_ARGS_uninstall` are similar, but only added to corresponding helm commands. ## Execution Steps Beyond the common steps such as Clone, Loading variables, etc. Deploy/Destroy Helm deployments contain the following steps: 1. Helm Diff - `helm diff upgrade --install --allow-unreleased --color --detailed-exitcode` 2. Helm Upgrade - `helm upgrade . --install --atomic --timeout 4h` 3. Helm Uninstall - `helm uninstall --wait --timeout 4h` ![Helm deployment execution steps showing Helm Diff, Helm Upgrade, and Helm Uninstall commands](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/df7413d-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=383affb5975c224f2b6f93127f89de09) > [!NOTE] > > **What Counts as a "diff"** > > env zero calculates diff between deployments using `helm` and the [helm diff plugin](https://github.com/databus23/helm-diff). > > The Helm diff plugin finds the exact difference between Helm executions, changes to your Kubernetes resources that were not done by Helm are left unnoticed. > > For example, A Drift Detection run would result as successful (meaning no drift was found) if a change was done manually inside the cluster without using Helm (such as increasing the `replicas` from 1 to 2). ## Complex Input Value Examples | Desired Helm Value | env zero HELM SET Input | Examples | | :- | :- | :- | | **annotations** | **general rule:** - use quotes to encapsulate the "key" of annotation. - escape . (period) and / (slashes) with a (backslash) | `ENV0_HELM_SET_annotations ."nginx\.ingress\.kubernets\.io\/backend-protocol"=HTTPS` `ENV0_HELM_SET_server.ingress.annotations."cert-manager\.io\/cluster-issuer"=letsencrypt` | | **labels** | **general rule:** - use quotes to encapsulate the "key" of label. - escape . (period) and / (slashes) with a (backslash) | `ENV0_HELM_SET_labels."app\.kubernetes\.io\/name"=my-deployment` | | **complex values** | **general rule:** - escape spaces with a (backslash) | `ENV0_HELM_SET_map={"foo:\ bar"}` | ## Next steps To deploy a chart stored in Git rather than a Helm repository, [connect your Git provider](/guides/admin-guide/manage-vcs) first. # Managing IaC binary versions Source: https://docs.envzero.com/guides/admin-guide/templates/iac-binaries-versions Specify and manage IaC tool versions in env zero templates for Terraform, OpenTofu, Terragrunt, Pulumi, and Ansible via environment variables. ## Overview When creating or editing a [template](/guides/admin-guide/templates), you can specify which version of Infrastructure as Code (IaC) tools to use for your deployments. env zero supports version management for Terraform, OpenTofu, Terragrunt, Pulumi, and Ansible. ## Version Resolution Order When determining which version to use, env zero follows this priority order: 1. **Environment Variables** (`ENV0_TOOL_VERSION` Environment Variable) 2. **Version Files** (per-tool repository files such as `.terraform-version`) 3. **Template Settings** (Specified in UI) ## Version Specification Methods ### 1. Environment Variables You can override the template version setting using [environment variables](/guides/admin-guide/variables): | IaC Tool | Environment Variable | | - | - | | Terraform | `ENV0_TERRAFORM_VERSION` | | OpenTofu | `ENV0_OPENTOFU_VERSION` | | Terragrunt | `ENV0_TERRAGRUNT_VERSION` | | Pulumi | `ENV0_PULUMI_VERSION` | | Ansible | `ENV0_ANSIBLE_VERSION` | For Terraform, env zero also accepts `ENV0_TF_VERSION` as a legacy alias. If both are set, `ENV0_TERRAFORM_VERSION` takes precedence. ### 2. Version Files env zero can automatically detect versions from standard version files located under the directory you configure in the template. If you want to reuse the same version files for multiple folders, set the environment variable ENV0\_RESOLVE\_FILE\_VERSION\_RECURSIVELY=true. | IaC Tool | Version File | | - | - | | Terraform | `.terraform-version` | | OpenTofu | `.opentofu-version` | | Terragrunt | `.terragrunt-version` | | Ansible | `.ansible-version` | | Pulumi | `.pulumi-version` | ### 3. Template Settings To associate a specific IaC version with a template: 1. Open the relevant **Template**. 2. Go to the **Settings** tab and expand **Advanced Settings**. 3. Select the desired version from the `"Template Type" Version` dropdown. 4. Click **Save**. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/6e0ce13-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=1f5c2b84cbe0b8af9a7f35d5d99a2bed) > [!WARNING] > > Changing a version in an existing template might affect running environments. ### Special Version Values #### Automatic Version Detection When selecting a version in the template settings, you can choose special values: * **Terraform**: "Resolve from code" - Automatically detects and uses the minimum required version specified in your Terraform code's `required_version` constraint * **OpenTofu**: "Resolve from code" - Similar to Terraform, extracts required version from your code > [!NOTE] > > For Terraform, the version value for automatic detection is `RESOLVE_FROM_TERRAFORM_CODE`. For OpenTofu, it is `RESOLVE_FROM_CODE`. ![Screenshot showing Resolve from terraform code option](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/8d0dc65-screen_shot_2021-04-25_at_12.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=e055a148c5aa382569575e189dd0cdce) #### Latest Version You can specify "latest" for supported IaC tools: * Terraform: Latest version up to 1.5.x * Pulumi: Latest available version * OpenTofu: Latest available version * Ansible: Latest available version > [!NOTE] > > The version value for automatic detection is `latest`. > [!WARNING] > > **Terraform versions ≥ 1.6.0 aren't supported** > > Terraform versions 1.6.0 and higher are under a BSL license and are not supported in env zero. Consider switching to [OpenTofu](https://opentofu.org/), the drop-in replacement for Terraform. ## Next steps * [Switch a template to OpenTofu](/guides/admin-guide/templates/opentofu) * [Set other deployment controls](/guides/admin-guide/additional-controls) through environment variables # Kubernetes (K8s) integration Source: https://docs.envzero.com/guides/admin-guide/templates/k8s Deploy Kubernetes resources with env zero using kubectl and Kustomize for per-environment labeling, PR plan integration, and drift detection. Kubernetes (also known as K8s) is an open source system for automating deployment, scaling, and management of containerized applications. Use env zero with Kubernetes to get Pull Request Plans and Drift Detection across your environments. Kubernetes uses YAML or JSON files to declare the resources it manages. ## Environment Deployment 1. Create a Kubernetes [Template](/guides/admin-guide/templates) 2. Follow our guide to [Connect Your Kubernetes Cluster](/guides/getting-started/connect-your-cloud-account/#kubernetes) 3. Create an environment. env zero will label the resources for each environment separately, so no collisions will occur when using the same template several times. > [!NOTE] > > **Cluster Authentication** > > Cluster authentication varies from one provider to another. See the [Connect Your Kubernetes Cluster](/guides/getting-started/connect-your-cloud-account/#kubernetes) guide for details. ## Execution Steps In addition to the common steps such as Clone, Loading Variables, etc., a Kubernetes environment in env zero has the following features: 1. K8s Label Resources - env zero uses `Kustomize` to label resources per environment, so you do not need to change files.\ `kustomize create --autodetect`\ `kustomize edit remove resource metadatLabelTransformer.yaml`\ `kustomize edit add transformer metadatLabelTransformer.yaml` 2. K8s Diff -\ `kubectl apply -k . --prune --dry-run=server -l env0-environment-id=`\ `kubectl diff -k . -l env0-environment-id=` 3. K8s Apply - `kubectl apply -k . --prune -l env0-environment-id=` 4. K8s Delete - `kubectl delete "$(kubectl api-resources --verbs=delete -o name | tr "\n" "," | sed -e 's/,$//')" --ignore-not-found -l env0-environment-id=` ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/77b5768-k8s_sidebar.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=6bea28badb58157ea6cac01eab5b1a7b) > [!NOTE] > > **Labels description** > > The following labels are added to each resource created by env zero: > > * `env0-environment-id=`. All resources created for a certain environment are labeled with the environment's ID. > * `app.kubernetes.io/managed-by: env0`. Regardless of the environment, every resource is labeled with the [recommended label](https://kubernetes.io/docs/concepts/overview/working-with-objects/common-labels/#labels) `managed-by` > [!WARNING] > > Supported versions > > The `kubectl` version is `1.23`, and the `kustomize` version is `4.5.4`.\ > It is recommended for the remote cluster not to be more than one minor version ahead or behind the client's.\ > Kubernetes's documentation goes back to version `1.20`, therefore older versions won't be supported. ## Next steps If the repository with your Kubernetes manifests isn't connected yet, [set up a VCS integration](/guides/admin-guide/manage-vcs). # OpenTofu Source: https://docs.envzero.com/guides/admin-guide/templates/opentofu Configure and deploy OpenTofu templates with env zero using the tofu binary for HCL-based infrastructure as an open-source Terraform alternative. OpenTofu is an open-source fork of Terraform that provides an Infrastructure-as-Code (IaC) solution. It maintains compatibility with Terraform while offering additional features and community-driven development. ## OpenTofu in env zero env zero provides full support for OpenTofu deployments, allowing you to manage your infrastructure using OpenTofu's declarative configuration language. OpenTofu is the default Terraform binary in env zero, providing a reliable and open-source alternative to Terraform. ## Configuration options ### OpenTofu version selection You can [specify which version of OpenTofu to use](/guides/admin-guide/templates/iac-binaries-versions) in your template configuration: 1. Navigate to your template settings 2. Open the **Advanced** settings section 3. Select your preferred OpenTofu version from the dropdown ### Working directory Configure the working directory where your OpenTofu configuration files are located: * **Root directory**: Use the repository root (default) * **Subdirectory**: Specify a path relative to the repository root > [!NOTE] > > If your OpenTofu files are in a subdirectory, specify the path in the **Working Directory** field under **Advanced** settings. ## OpenTofu-specific features ### State management OpenTofu uses the same state management concepts as Terraform: * **Local state**: Stored temporarily during deployment * **Remote state**: Recommended for production environments * **State locking**: Prevents concurrent modifications > [!WARNING] > > **State persistence** > > env zero stores the local state between deployments by default. For production environments, use the [env zero Remote Backend](/guides/admin-guide/remote-backend) or configure a remote backend in your OpenTofu configuration to ensure state persistence and team collaboration. ### Variable handling OpenTofu supports multiple variable input methods: * **Environment variables**: Set in env zero's [variable management](/guides/admin-guide/variables) * **Variable files**: `.tfvars` files in your repository * **Command-line variables**: Passed via `-var` flags * **Variable precedence**: `-var` and `-var-file` flags > `*.auto.tfvars` files > `terraform.tfvars.json` > `terraform.tfvars` > `TF_VAR_*` environment variables > defaults ### Provider configuration Configure OpenTofu providers in your configuration files: ```hcl main.tf theme={null} terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 5.0" } } } provider "aws" { region = var.aws_region } ``` ## Deployment workflow env zero follows OpenTofu's standard deployment workflow: 1. **Initialize**: `tofu init` - Download providers and modules 2. **Plan**: `tofu plan` - Generate execution plan 3. **Apply**: `tofu apply` - Execute the planned changes 4. **Destroy**: `tofu destroy` - Remove resources (when needed) ### Plan and apply process The plan step generates a detailed execution plan showing what changes will be made. The apply step uses this plan to make the actual changes to your infrastructure. > [!NOTE] > > env zero stores plan files between the plan and apply steps to ensure consistency and allow for review and [approval workflows](/guides/admin-guide/environments#approval-flow). ## Best practices ### Remote backend configuration Configure a remote backend for state management: ```hcl backend.tf theme={null} terraform { backend "s3" { bucket = "your-terraform-state-bucket" key = "path/to/your/state.tfstate" region = "us-west-2" encrypt = true dynamodb_table = "terraform-state-lock" } } ``` ### Module usage Organize your infrastructure using OpenTofu modules: ```hcl main.tf theme={null} module "vpc" { source = "./modules/vpc" vpc_cidr = "10.0.0.0/16" environment = var.environment } ``` ### Variable management Use consistent variable naming and types: ```hcl variables.tf theme={null} variable "environment" { description = "Environment name" type = string validation { condition = contains(["dev", "staging", "prod"], var.environment) error_message = "Environment must be dev, staging, or prod." } } ``` ## Troubleshooting ### Common issues **Provider version conflicts** * Ensure provider versions are compatible with your OpenTofu version * Check the [OpenTofu provider compatibility matrix](https://opentofu.org/docs/language/providers/) **State file issues** * Use remote backends for production environments * Enable state locking to prevent concurrent modifications * Regularly backup your state files **Variable resolution** * Check variable precedence order * Verify environment variables are set correctly in env zero * Use `tofu console` to debug variable values ### Debugging deployments Enable detailed logging by setting the `TF_LOG` environment variable: * `TF_LOG=TRACE` - Most verbose logging * `TF_LOG=DEBUG` - Detailed debugging information * `TF_LOG=INFO` - Standard information level * `TF_LOG=WARN` - Warnings and errors * `TF_LOG=ERROR` - Errors only > [!NOTE] > > Set the `TF_LOG` environment variable in your template's environment variables section for detailed OpenTofu execution logs. ## Migration from Terraform OpenTofu maintains compatibility with Terraform configurations: 1. **Configuration files**: No changes required to `.tf` files 2. **State files**: Compatible with Terraform state format 3. **Providers**: Use the same provider ecosystem 4. **Modules**: Existing Terraform modules work without modification > [!TIP] > > Your existing Terraform configurations will work with OpenTofu without any modifications. ## Additional resources * [OpenTofu Documentation](https://opentofu.org/docs/) * [OpenTofu GitHub Repository](https://github.com/opentofu/opentofu) * [Provider Registry](https://registry.opentofu.org/) * [Migration Guide from Terraform](https://opentofu.org/docs/intro/migration/) ## Next steps Before you create an OpenTofu template from your repository, [connect your VCS provider](/guides/admin-guide/manage-vcs). # Pulumi integration Source: https://docs.envzero.com/guides/admin-guide/templates/pulumi Deploy Pulumi stacks with env zero using Python, TypeScript, Go, and .NET, with PULUMI_ACCESS_TOKEN configuration and Pulumi remote backend state. [Pulumi ](https://www.envzero.com/blog/what-is-pulumi-and-how-to-use-it-with-envzero) is an infrastructure-as-code framework that supports popular programming languages such as Go, JS/TS, Python, and .NET Platform. With env zero, you can enjoy all of the benefits that are built on top of it such as Plan on Pull Request, Drift Detection, and more... Unlike the HCL language that is used in terraform, Pulumi represents the concept of writing IaC by commonly used programming languages. There are many benefits of such concept, for example, strong-type support, homogeneous codebase, testing easiness, etc. You can read more about Pulumi in their [docs.](https://www.pulumi.com/docs/) ## Environment Deployment To manage your Pulumi executions in env zero, follow these steps: 1. Create a Pulumi [Template](/guides/admin-guide/templates) first. 2. Create [`env0.yml`](/guides/admin-guide/custom-flows) file in the target repository and inject a required packages installation command\ (`npm i` for example, see [gist](https://gist.github.com/away168/50b406854197657d8a4631b9f52203e1)). 3. [Connect your cloud account](/guides/getting-started/connect-your-cloud-account) 4. Add `PULUMI_ACCESS_TOKEN` [environment variable](/guides/admin-guide/variables) 5. Create an environment, you can set the stack name if you already configured one, if not, env zero will create a random stack name. > [!WARNING] > > State Storage > > Currently, env zero does not store the stack state, which means that it is saved in Pulumi's remote backend or using a Pulumi self-managed option. See [Pulumi Docs on State Storage ](https://www.pulumi.com/docs/concepts/state/)for more details. ## Execution Steps Beyond the common steps such as Clone, Loading variables, etc. Deploy/Destroy Pulumi environment contains the following steps: 1. Pulumi Login - `pulumi login --non-interactive` 2. Stack Selection - `pulumi stack select --create ` 3. Pulumi Preview - ` pulumi preview --refresh --diff --show-replacement-steps` 4. Pulumi Up - `pulumi up -f --yes --refresh --diff --show-replacement-steps ` 5. Pulumi Stack Output 6. Pulumi Destroy - `pulumi destroy -f --yes --refresh --diff --show-replacement-steps` Set `ENV0_PULUMI_SKIP_PREVIEW_REFRESH=true` to run the Pulumi Preview step without `--refresh`. See [Skip state refresh in Pulumi deploy previews](/guides/admin-guide/additional-controls#skip-state-refresh-in-pulumi-deploy-previews). To add or turn off flags on the Preview, Up and Destroy commands, set `ENV0_PULUMI_CLI_ARGS_preview`, `ENV0_PULUMI_CLI_ARGS_up` or `ENV0_PULUMI_CLI_ARGS_destroy`. See [Pass custom CLI arguments to Pulumi commands](/guides/admin-guide/additional-controls#pass-custom-cli-arguments-to-pulumi-commands). ![Pulumi deployment execution steps showing Login, Stack Selection, Preview, Up, Output, and Destroy](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/325a55c-screen_shot_2022-03-24_at_15.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=e9e8036088e4d6b547c9071a8d129747) ## Additional Configuration Check out [Pulumi's Environment Variable configurations](https://www.pulumi.com/docs/cli/environment-variables/) to further customize your environment For example, to use your own S3 remote backend, create an Environment Variable in your env zero Environment with `PULUMI_BACKEND_URL=s3://your-pulumi-state-bucket` ## Next steps Your Pulumi template needs access to the repository that holds your stack code, so [connect your VCS provider](/guides/admin-guide/manage-vcs) if you haven't yet. # Repository structure Source: https://docs.envzero.com/guides/admin-guide/templates/repository-structure Understand how monorepo and single-repo structures work with env zero templates, including module source patterns and self-hosted Git server requirements. env zero works with any repository structure you currently use. This page covers the key structural decisions that affect how you configure templates. ## Monorepo considerations If multiple templates or environments share a single repository, configure each template in env zero to target the specific subdirectory for that stack. Use the [file filter pattern](/guides/admin-guide/environments/continuous-deployment) in continuous deployment settings to trigger each environment only when its subdirectory changes, not on every commit to the repo. If your monorepo includes shared modules alongside root modules, configure the file filter to include both the root module path and the shared module path so that changes to either trigger a plan. ## Module source patterns ### Local modules For modules sourced from the same repository (`source = "../modules/vpc"`), env zero can monitor both the root module directory and the module directory. Configure the file filter pattern to include both paths so that a change to the shared module triggers plans across all environments that use it. ### Git-sourced modules For modules sourced via HTTPS (`source = "git::https://..."`) or SSH (`source = "git::ssh://..."`): * **HTTPS**: requires a token. Pass it via a [custom flow](/guides/admin-guide/custom-flows) that configures git credentials before `init`. * **SSH**: attach an [SSH key](/guides/admin-guide/variables/ssh-keys) to your template or environment. ### Terraform Registry modules Modules from the public Terraform Registry or a [private registry](/guides/admin-guide/private-registry) work the same way in env zero as they do locally. Combine registry modules with [drift detection](/guides/admin-guide/environments/drift-detection) to catch when a new module version makes your deployed infrastructure stale. ## Self-hosted Git servers If your infrastructure code is in a self-hosted VCS (GitHub Enterprise Server, Bitbucket Data Center, GitLab on-prem), env zero requires the [self-hosted agent](/guides/admin-guide/self-hosted-kubernetes-agent) to reach your network. Each self-hosted VCS instance needs its own agent. See [Using self-hosted VCS](/guides/admin-guide/templates/self-hosted-vcs) for connection setup. ## Next steps With your repository layout settled, [create a template](/guides/admin-guide/templates#create-a-template) for each stack you want to deploy. # Using self-hosted VCS Source: https://docs.envzero.com/guides/admin-guide/templates/self-hosted-vcs Connect self-hosted VCS providers to env zero with agent proxy support, covering GitHub Enterprise Server, Bitbucket Data Center, and GitLab. Connect your Self Hosted VCS to env zero. Once set up, you can create self-hosted VCS [templates](/guides/admin-guide/templates) and [VCS environments](/guides/admin-guide/environments/setting-up-a-new-environment#based-on-a-direct-vcs-integration) within the system. Manage all VCS connections in a centralized page, allowing you to apply changes across all templates and environments. > [!NOTE] > > **This feature is available exclusively to customers using [self-hosted agents](/guides/admin-guide/self-hosted-kubernetes-agent)** > [!NOTE] > > **Supported VCS** > > * [GitHub Enterprise Server](https://docs.github.com/en/enterprise-server) > * [Bitbucket Data Center](https://www.atlassian.com/software/bitbucket/enterprise/data-center) (Server) > * [Offline GitLab](https://docs.gitlab.com/ee/topics/offline/) **Using a self-hosted VCS provides you with all the features similar to a cloud-based VCS**. including: * [Plan on Pull Request](/guides/admin-guide/environments/plan-on-pull-request) * [Continuous Deployment](/guides/admin-guide/environments/continuous-deployment) * [PR Comments Commands](/guides/admin-guide/environments/plan-and-apply-from-pr-comments) * [Module Registry](/guides/admin-guide/private-registry) * [Project-level custom flow](/guides/admin-guide/custom-flows/project-level-custom-flow) * [Approval Policies](/guides/policies-governance/approval-policies) ## Add New VCS Connection You can create a new connection in two ways; when creating a new template or through centralized management. ### Option 1 - Create VCS Connection from Template Creation 1. When configuring the VCS type, select one of the self-hosted supported VCS options. 2. Click the Repository dropdown and select "Add VCS Connection". ![Template VCS configuration with Repository dropdown showing the Add VCS Connection option](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/77b5c437bbc65dc674deecf57e1f9beb230a842b448cd97562721d59c3e2e52d-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=317c6569e976a3e73538aa9dc9102ccb) ### Option 2 - Create VCS Connection from VCS Settings 1. Go to "Organization Settings," select the "VCS" tab, and scroll down. 2. Click "Create Connection" ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/528a32db423ddd446f036f9c73787905af85a8180b0c44a174e7c4d8a2405fa1-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=b072509d0f7f21043b1b85ab96822010) ### Create VCS Connection 1. Choose Self-Hosted in the picker 2. Choose the VCS type and click **Add** for **Deployment** access. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/27fdbdf533706548ccabf057a710f0e49f871b106cfbf7a8fde98cd071af8b68-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=046e6e56f77bba22d350a8d937bec213) 3. Enter Self-Hosted VCS URL 4. Select the "Agent Key" to which all requests will be forwarded ([VCS Agent](/guides/admin-guide/templates/self-hosted-vcs/#configure-vcs-agent-proxy) - Running Proxy). 1. To create a new agent pool, go to **Organization Settings → Agents** and click **Create Agent**. See [Self-hosted agents overview](/guides/admin-guide/self-hosted-kubernetes-agent/overview) for details. 2. The dropdown is available only to users with the "[Edit Organization Settings](/guides/admin-guide/user-role-and-team-management/custom-roles/#custom-role-permissions)" permission. 3. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/bfa206944f1c178c9de6e1365e1a5da27b6269cb1b76141772d14c8202a6834f-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=c97a46159347517ff851ad7e6670943b) 5. Click "Save Connection" > [!NOTE] > > **Forward requests to this VCS Agent** > > The intention behind forwarding requests refers to all the requests the platform needs to support the features mentioned above. It does not refer to where the deployment actually runs; it will continue to run based on the project to which it is assigned. ### Configure VCS agent (Proxy) Running a proxy can be achieved in two ways; as part of the agent's Kubernetes helm chart deployment or as a standalone Docker instance. #### Agent's Kubernetes Helm Chart 1. The [installation](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#installation) is included as part of the agent's Kubernetes Helm chart deployment. 2. By default, the proxy runs when the agent is installed without any special configuration. 3. Proxy Configuration: Configure it in the [values.yml](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration) file 1. ```yaml theme={null} agentProxy: install: true # default true replicas: 1 # how many replicas of the agent proxy to use. Default is 1 maxConcurrentRequests: 500 # how many concurrent requests each pod should handle. Default is 500 limits: # k8s (cpu and memory) limits. Example values: 250m and 500Mi (not set by default) cpu: 250m memory: 500Mi bitbucketServerCredentialsEncoded: base64= # Base64 Bitbucket server credentials in the format `username:token (using a Personal Access token) gitlabEnterpriseCredentialsEncoded: base64= # Base64 Gitlab Enterprise credentials in the form of an Access token githubEnterpriseAppId: 1 # For more details, check out /guides/admin-guide/templates/github-enterprise-integration githubEnterpriseAppInstallationId: 1 githubEnterpriseAppPrivateKeyEncoded: "base64==" ``` Refer to the Self Hosted Kubernetes Agent [specifications](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration) for additional configuration details. #### Standalone VCS Agent Docker Instance 1. Run the VCS agent Docker image with the following command: ```shell theme={null} docker run --env-file ~/path/to/env0.env ghcr.io/env0/vcs-agent:latest ``` 2. For more details, see Standalone Docker Agent - [Running a VCS Agent](/guides/admin-guide/self-hosted-kubernetes-agent/standalone-docker-agent/#running-a-vcs-agent-for-on-prem-/-self-hosted-vcs). > [!NOTE] > > **env zero communication with VCS Agent** > > The communication is one-way: the VCS agent connects to the env zero platform. This means that when the env zero platform forwards a request to the VCS agent, we cannot immediately determine if the communication was successful or if the proxy is alive until the timeout period (\~25s). > > If something isn't working as expected, check the VCS agent logs to see if the requests are being received ### Configure Webhook Integration This section outlines the steps required to configure webhook integration for your VCS. Follow the instructions to set up the webhook and ensure it works with your system. 1. When you [Create VCS connection](/guides/admin-guide/templates/self-hosted-vcs/#create-vcs-connection) you will find the **Webhook Settings** button. 1. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/03e5d6ced669a74341e747c24302c9b31661e75c918f5a94273842be86eb3271-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=619d41b18978e90f516a0ebbe692dcaf) 2. At the bottom of the window, you will see this section. From here, you need to obtain the **webhook URL** and **webhook secret**. 3. Configure Webhook Integration per Self-Hosted VCS: 1. [Github Enterprise](/guides/admin-guide/templates/github-enterprise-integration) 2. [Bitbucket Server](/guides/admin-guide/templates/bitbucket-server-integration) 3. [Gitlab Enterprise](/guides/admin-guide/templates/gitlab-enterprise-integration) > [!WARNING] > > **Please ensure that only one entry is created for Webhook Integration. Creating multiple entries may result in duplicate events and cause multiple deployments for the same change.** # Terraform Source: https://docs.envzero.com/guides/admin-guide/templates/terraform Configure and deploy Terraform templates with env zero for infrastructure provisioning, state management, and drift detection using HashiCorp Terraform. Terraform is HashiCorp's Infrastructure-as-Code (IaC) tool that enables you to define and provision infrastructure using a declarative configuration language. env zero provides comprehensive support for Terraform deployments across all major cloud providers and services. ## Terraform in env zero env zero supports Terraform as an alternative to OpenTofu, allowing you to use HashiCorp's official Terraform binary for your infrastructure deployments. While [OpenTofu](/guides/admin-guide/templates/opentofu) is the default, you can switch to Terraform when needed. ## Configuration options ### Terraform version selection To use Terraform instead of OpenTofu: 1. Navigate to your template settings 2. Open the **Advanced** settings section 3. Select **Terraform** from the TF binary dropdown 4. Choose your preferred Terraform version. See [Managing IaC binary versions](/guides/admin-guide/templates/iac-binaries-versions). ![Terraform version selection in Advanced settings](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/8d0dc65-screen_shot_2021-04-25_at_12.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=e055a148c5aa382569575e189dd0cdce) ### Working directory Configure the working directory where your Terraform configuration files are located: * **Root directory**: Use the repository root (default) * **Subdirectory**: Specify a path relative to the repository root > [!NOTE] > > If your Terraform files are in a subdirectory, specify the path in the **Working Directory** field under **Advanced** settings. ## Terraform-specific features ### State management Terraform uses state files to track infrastructure resources: * **Local state**: Stored temporarily during deployment * **Remote state**: Recommended for production environments using backends * **State locking**: Prevents concurrent modifications using DynamoDB or similar > [!WARNING] > > **State persistence** > > env zero stores the local state between deployments by default. For production environments, use the [env zero Remote Backend](/guides/admin-guide/remote-backend) or configure a remote backend in your Terraform configuration to ensure state persistence and team collaboration. ### Variable handling Terraform supports multiple variable input methods with clear precedence: 1. **Command-line variables**: `-var` and `-var-file` flags, in the order given (highest precedence) 2. **Auto-loaded variable files**: `*.auto.tfvars` and `*.auto.tfvars.json` files, in lexical order of filename 3. **`terraform.tfvars.json`** 4. **`terraform.tfvars`** 5. **Environment variables**: `TF_VAR_*` prefixed variables 6. **Default values**: Defined in variable blocks (lowest precedence) For how variables set in env zero fit into this order, see [Variable precedence](/guides/admin-guide/variables#variable-precedence). ### Provider configuration Configure Terraform providers in your configuration files: ```hcl main.tf theme={null} terraform { required_providers { aws = { source = "hashicorp/aws" version = "~> 5.0" } } required_version = ">= 1.0" } provider "aws" { region = var.aws_region } ``` ## Deployment workflow env zero follows Terraform's standard deployment workflow: 1. **Initialize**: `terraform init` - Download providers and modules 2. **Plan**: `terraform plan` - Generate execution plan 3. **Apply**: `terraform apply` - Execute the planned changes 4. **Destroy**: `terraform destroy` - Remove resources (when needed) ### Plan and apply process The plan step generates a detailed execution plan showing what changes will be made. The apply step uses this plan to make the actual changes to your infrastructure. > [!NOTE] > > env zero stores plan files between the plan and apply steps to ensure consistency and allow for review and [approval workflows](/guides/admin-guide/environments#approval-flow). ## Best practices ### Remote backend configuration Configure a remote backend for state management: ```hcl backend.tf theme={null} terraform { backend "s3" { bucket = "your-terraform-state-bucket" key = "path/to/your/state.tfstate" region = "us-west-2" encrypt = true dynamodb_table = "terraform-state-lock" } } ``` ### Module usage Organize your infrastructure using Terraform modules: ```hcl main.tf theme={null} module "vpc" { source = "terraform-aws-modules/vpc/aws" version = "~> 5.0" name = "my-vpc" cidr = "10.0.0.0/16" azs = ["us-west-2a", "us-west-2b"] private_subnets = ["10.0.1.0/24", "10.0.2.0/24"] public_subnets = ["10.0.101.0/24", "10.0.102.0/24"] } ``` ### Dependency lock file Terraform generates a `.terraform.lock.hcl` file that records the exact provider versions selected during `terraform init`. Committing this file to your repository ensures that every env zero deployment uses the same provider versions, regardless of which versions are published at run time. When env zero runs `terraform init`, it reads the lock file and downloads the pinned providers. If a provider constraint in your configuration matches the lock file entry, Terraform uses that version. If the lock file is absent, Terraform selects the newest version that satisfies your constraints, which can cause unexpected differences between runs. To update a pinned provider version, run `terraform init -upgrade` locally and commit the updated `.terraform.lock.hcl`. > [!NOTE] > > Add `.terraform.lock.hcl` to version control. Exclude `.terraform/` (the local working-directory data, including downloaded providers and init artifacts) from version control by adding it to `.gitignore`. ### Variable management Use consistent variable naming and types: ```hcl variables.tf theme={null} variable "environment" { description = "Environment name" type = string validation { condition = contains(["dev", "staging", "prod"], var.environment) error_message = "Environment must be dev, staging, or prod." } } variable "instance_count" { description = "Number of instances to create" type = number default = 1 validation { condition = var.instance_count > 0 error_message = "Instance count must be greater than 0." } } ``` ## Advanced features ### Workspaces Terraform workspaces allow you to manage multiple environments: ```bash theme={null} # Create a new workspace terraform workspace new production # List workspaces terraform workspace list # Switch workspaces terraform workspace select production ``` > [!NOTE] > > env zero automatically manages Terraform workspaces based on your environment configuration. ### Data sources Use data sources to fetch information about existing resources: ```hcl data.tf theme={null} data "aws_ami" "latest_amazon_linux" { most_recent = true owners = ["amazon"] filter { name = "name" values = ["amzn2-ami-hvm-*-x86_64-gp2"] } } ``` ### Outputs Define outputs to expose important resource information: ```hcl outputs.tf theme={null} output "vpc_id" { description = "ID of the VPC" value = module.vpc.vpc_id } output "private_subnets" { description = "List of IDs of private subnets" value = module.vpc.private_subnets } ``` ## Troubleshooting ### Common issues **Provider version conflicts** * Ensure provider versions are compatible with your Terraform version * Check the [Terraform provider compatibility matrix](https://www.terraform.io/docs/language/providers/requirements.html) **State file issues** * Use remote backends for production environments * Enable state locking to prevent concurrent modifications * Regularly backup your state files **Variable resolution** * Check variable precedence order * Verify environment variables are set correctly in env zero * Use `terraform console` to debug variable values ### Debugging deployments Enable detailed logging by setting the `TF_LOG` environment variable: * `TF_LOG=TRACE` - Most verbose logging * `TF_LOG=DEBUG` - Detailed debugging information * `TF_LOG=INFO` - Standard information level * `TF_LOG=WARN` - Warnings and errors * `TF_LOG=ERROR` - Errors only > [!NOTE] > > Set the `TF_LOG` environment variable in your template's environment variables section for detailed Terraform execution logs. ### Common error messages **"Error: No such file or directory"** * Verify the working directory path is correct * Check that Terraform files exist in the specified location **"Error: Failed to get existing workspaces"** * Ensure proper backend configuration * Check backend credentials and permissions **"Error: Provider configuration not present"** * Verify required providers are declared * Check provider version constraints ## Migration considerations ### From OpenTofu to Terraform If migrating from OpenTofu to Terraform: 1. **Configuration compatibility**: Most configurations work without changes 2. **State files**: Compatible format, but consider backing up first 3. **Provider versions**: Verify compatibility with Terraform version 4. **Testing**: Test in a non-production environment first > [!WARNING] > > **Migration planning** > > Always test migrations in a development environment before applying to production infrastructure. ## Additional resources * [Terraform Documentation](https://www.terraform.io/docs/) * [Terraform Registry](https://registry.terraform.io/) * [Terraform Cloud](https://www.terraform.io/cloud) * [Terraform Best Practices](https://developer.hashicorp.com/terraform/cloud-docs/recommended-practices) ## Next steps To deploy Terraform code from a repository, [connect a VCS provider](/guides/admin-guide/manage-vcs). # Terragrunt integration Source: https://docs.envzero.com/guides/admin-guide/templates/terragrunt Set up Terragrunt templates in env zero with run-all support, configurable binary selection, and module targeting for DRY infrastructure configurations. Terragrunt is a thin wrapper that provides extra tools for keeping your configurations “Don’t Repeat Yourself” (DRY), working with multiple Terraform modules, and managing remote states. ## Running Terragrunt with OpenTofu / Terraform The env zero platform supports running Terragrunt with either OpenTofu or Terraform. By default the selected TF binary is [OpenTofu](/guides/admin-guide/templates/opentofu). To change that, you should open the `Advanced` settings and select which TF binary to use: ![Terragrunt Advanced settings showing the TF binary selector with OpenTofu and Terraform options](https://mintcdn.com/envzero-b61043c8/NFoAIaj_CGEzw-yg/images/guides/admin-guide/templates/95908ce-image.png?fit=max\&auto=format\&n=NFoAIaj_CGEzw-yg\&q=85\&s=768e7eeed04a73c49877f119428cc1fa) You can check Terragrunt's Terraform and OpenTofu version compatibility table [here](https://terragrunt.gruntwork.io/docs/reference/supported-versions/). ## Run-all Terragrunt command checkbox Within Terragrunt [template](/guides/admin-guide/templates) configuration, under `Advanced` settings - check `Execute run-all commands on multiple modules` * Adds `run-all` to each command, read more [here](https://terragrunt.gruntwork.io/docs/reference/supported-versions/). * Supported from version 0.28.1. > [!WARNING] > > **Local Terraform State** > > By default, env zero stores the local state for next deployments. > > In some cases, we will not be able to store the local state for your Terragrunt modules. Please configure a remote backend with your Terragrunt code [Remote terraform code](https://terragrunt.gruntwork.io/docs/reference/config-blocks-and-attributes/#terraform), otherwise your Terragrunt code may not work properly with env zero. > [!WARNING] > > **Cross-Module Dependencies** > > env zero's Terraform deployment flow includes a `plan` step and an `apply` step that uses the plan's results (plan file/s) to ensure every change is aligned between both steps. > > According to the official [docs](https://terragrunt.gruntwork.io/docs/reference/cli-options/#run-all), the `run-all plan -out=/path/to/plan-file` command we use will fail if there are yet-to-be-applied dependencies between modules. It will only output some of the expected plan files. This leads to the failure of the `run-all apply /path/to/plan-file` command that is being executed next, since it expects all modules to have plan files. > > As a workaround, we expose the `ENV0_TERRAGRUNT_RUN_ALL_SKIP_PLAN` environment variable. Set its value to `true` and deploy. The `run-all apply` command will be executed without running the plan. This is risky and should only be done on initial deployment. On success, remove this environment variable to keep the `plan` and `apply` steps in-sync. > > Enabling ENV0\_TERRAGRUNT\_RUN\_ALL\_SKIP\_PLAN requires the deployment to be configured with auto-approval. When this variable is set to true, both the plan and cost estimation steps are skipped, and their statuses will be marked as "warning" to indicate reduced visibility and governance. The deployment will proceed directly to apply. If this flag is used in a deployment that requires approval, the step - and consequently the entire deployment - will fail. ### Target modules env zero supports [terragrunt include dir ](https://terragrunt.gruntwork.io/docs/reference/cli-options/#terragrunt-include-dir), which is a CLI Arg for Terragrunt environment that runs in a `run-all` mode by using environment variable `ENV0_TERRAGRUNT_RUN_ALL_INCLUDE_DIRS`. Terragrunt will plan and apply only those modules and their dependencies when you use this variable. #### Example: > [!NOTE] > > **ENV0\_TERRAGRUNT\_RUN\_ALL\_INCLUDE\_DIRS=module1,path\_to\_module/module2** #### Smart detect Terragrunt modules changes If you use `Terragrunt run all` [PR Plan](/guides/admin-guide/environments/plan-on-pull-request) feature you can use the [Terragrunt module detection plugin](/guides/integrations/plugins/terragrunt-modules-detection) for running plan only for changed modules in the PR ### Troubleshooting There is a known issue with `terragrunt run-all plan -destroy -out=.tf-plan` generating an incorrectly ordered graph. Thus, if you have dependency issues with run-all destroy, please use `ENV0_TERRAGRUNT_RUN_ALL_SKIP_PLAN=true` in your pipeline to skip the plan step. Make sure to enable "Approve Plan Automatically". ## Next steps * [Pin the Terragrunt, Terraform, or OpenTofu version](/guides/admin-guide/templates/iac-binaries-versions) your template runs * [Connect the repository](/guides/admin-guide/manage-vcs) that holds your Terragrunt code # Migrate from Terraform Cloud Source: https://docs.envzero.com/guides/admin-guide/tfc-migration Migrate Terraform Cloud or Terraform Enterprise workspaces to env zero using the in-app wizard for workspace discovery, variable migration, and state move. > [!NOTE] > > This guide is for teams moving existing Terraform Cloud or Terraform Enterprise workspaces to env zero. If you're new to env zero and not migrating from TFC, start with the [Quick Start](/guides/getting-started/getting-started) instead. The env zero migration wizard enables teams to move Terraform Cloud (TFC) and Terraform Enterprise (TFE) workspaces into env zero quickly and safely, without rebuilding environments or manually transferring configuration. The wizard automatically discovers your existing workspaces and recreates them in env zero, including: * Workspace configuration * Variables and variable sets * Terraform state * Version control settings The migration process runs directly from the env zero UI and follows a controlled migration flow. Your original Terraform Cloud workspaces remain unchanged during the process, allowing teams to validate environments in env zero before completing the final Go Live step. This approach allows organizations to migrate infrastructure gradually, verify configurations safely, and transition execution to env zero without interrupting existing deployments. ## What this migration covers * Automatic discovery of TFC/TFE workspaces, variables, and variable sets * 1:1 replication of project structure, workspace settings, and variables * Terraform Cloud state migration to the env zero remote backend * Controlled cutover with TFC workspace locking and env zero environment unlocking * Gradual migration: migrate a few workspaces at a time and return later to continue with the rest ## What is not migrated automatically The wizard focuses on workspaces, variables, state, and VCS configuration. The following TFC/TFE entities are not migrated and need to be recreated manually in env zero after migration: * **Private module registry** - re-publish modules in the env zero module registry * **Policies (Sentinel / OPA)** - recreate as env zero custom flows or policy rules * **Run triggers and workspace dependencies** - configure workflow triggers in env zero * **Team permissions and RBAC** - configure [SSO/SAML integration](/guides/sso-integrations/self-service-sso) in env zero to manage identity and access. This avoids migrating individual TFC team permissions and ensures your identity provider remains the single source of truth for access control * **Notification configurations** - configure notifications in env zero * **SSH keys** - add SSH keys to env zero as needed ## Prerequisites **env zero access:** * Admin role or Edit Organization Settings permission **Terraform Cloud / Terraform Enterprise access:** * A TFC/TFE user or team API token with read permissions and workspace lock/release permissions > [!TIP] > > To create a TFC API token: log in to Terraform Cloud and go to **User Settings > Tokens** to generate a user token, or go to **Organization Settings > Teams**, select your team, and generate a team token. The token needs read access to workspaces, variables, variable sets, and state, plus permissions to lock and unlock workspaces (used during go-live). ## Before you start Review these before launching the wizard to avoid surprises mid-migration. **Self-hosted VCS (GitHub Enterprise, GitLab self-managed, Bitbucket Data Center)** If your workspaces reference repositories on a self-hosted git server, env zero requires a [self-hosted agent](/guides/admin-guide/self-hosted-kubernetes-agent) to reach it. One agent is needed per VCS instance — if you have two Bitbucket Data Center instances, you need two agents. Set these up before migrating workspaces that use self-hosted VCS. **Private Terraform modules sourced via git** Workspaces that pull modules using `ssh://` URLs need an [SSH key](/guides/admin-guide/variables/ssh-keys) attached to the environment in env zero. Workspaces using `https://` module URLs need a git token configured via a [custom flow](https://github.com/env0/custom-flows-examples/tree/main/misc/git-token). Deployments will fail after migration if these credentials are not in place before the first run. **`.tfvars` files for variable configuration** If your workspaces use a `.tfvars` file to supply variable values rather than TFC workspace variables, set the `ENV0_TERRAFORM_CONFIG_FILE_PATH` environment variable on the migrated environment to point env zero at the correct file. See [Custom Terraform Variables File](/guides/admin-guide/additional-controls/#custom-terraform-variables-file) for details. ## How concepts map between TFC and env zero | TFC/TFE concept | env zero concept | | - | - | | Project | Project | | Workspace | Environment | | Workspace variables | Environment variables | | Variable sets | Configuration sets | | VCS settings | Template VCS settings | | Remote backend state | env zero remote backend | ## Migration flow The wizard guides you through five steps: 1. **Connect** - enter your TFC organization name and API token 2. **Select Scope** - choose which workspaces to migrate 3. **Resolve** - provide missing secrets and configure VCS connections 4. **Review** - review your selection and create environments in env zero 5. **Go Live** - lock TFC workspaces and activate env zero environments > [!TIP] > > You do not need to migrate everything at once. Select a group of workspaces, migrate and go live with them, then return to the wizard to select the next group. Your session is preserved between visits. > [!NOTE] > > Your TFC workspaces are never modified or deleted during the migration. They remain fully operational until you explicitly go live. ## Getting started Navigate to **Organization Settings > Migration** to launch the wizard, then click **Start Migration**. > [!NOTE] > > If you have an active migration session, a **TFC Migration** widget appears on your homepage with a **Resume Migration** button. ## Pages in this guide * [Connect and scan](/guides/admin-guide/tfc-migration/connect-and-scan) * [Resolve issues](/guides/admin-guide/tfc-migration/resolve-issues) * [Review and migrate](/guides/admin-guide/tfc-migration/review-and-migrate) * [Go live](/guides/admin-guide/tfc-migration/go-live) * [Troubleshooting](/guides/admin-guide/tfc-migration/troubleshooting) ## Next steps Each migrated workspace becomes an env zero environment. To deploy, redeploy, or destroy it after go-live, see the [environment overview](/guides/admin-guide/environments). # Connect and scan Source: https://docs.envzero.com/guides/admin-guide/tfc-migration/connect-and-scan Connect your Terraform Cloud or Terraform Enterprise organization to env zero and automatically discover all workspaces, variables, and variable sets. The first step of the [migration wizard](/guides/admin-guide/tfc-migration) connects env zero to your Terraform Cloud (TFC) or Terraform Enterprise (TFE) organization and automatically discovers all workspaces, variables, and variable sets. Provide your API token and env zero scans your organization automatically. ## Connect your TFC organization **1. Open the migration wizard** Navigate to **Organization Settings > Migration** and click **Start Migration**. **2. Enter your TFC organization details** Provide two fields: * **Terraform Cloud Organization Name** - the exact name of your TFC/TFE organization (for example, `acme-corp`) * **Terraform Cloud API Token** - a user or team token with read permissions and permissions to lock/unlock workspaces **3. Click Connect & Scan** env zero validates your credentials and begins scanning your TFC organization. This is a read-only operation, nothing in TFC is modified. ![Connect your Terraform Cloud organization](https://mintcdn.com/envzero-b61043c8/VFw2NcRxIisIupl6/images/guides/admin-guide/tfc-migration-connect.png?fit=max\&auto=format\&n=VFw2NcRxIisIupl6\&q=85\&s=2b3f8e9240ab2616a8bf09604731b9cb) > [!NOTE] > > If you previously started a migration for this TFC organization, the wizard resumes your existing session. ## Scan progress After connecting, the wizard scans your TFC organization in three phases: 1. **Workspaces** - discovers all workspaces and their variables 2. **Variable Sets** - discovers variable sets and their variables 3. **Projects** - maps TFC projects to env zero [projects](/guides/admin-guide/projects) A progress bar shows the number of workspaces and variable sets scanned. You can safely leave the page during scanning and return later. ## Select scope Once scanning completes, the wizard displays all discovered workspaces organized by TFC project. **1. Review discovered workspaces** The tree view shows your TFC projects and their workspaces. Each workspace displays its current status: * **Migrated** - already migrated in a previous session * **Live** - already live in env zero * **Excluded** - manually excluded from this migration round; click the chip to include it again * **Unsupported VCS provider** - the workspace uses a [VCS provider](/guides/admin-guide/manage-vcs) not supported by the wizard (supported providers: GitHub, GitLab, Bitbucket, and Azure DevOps including self-hosted). These workspaces cannot be migrated with the wizard. **2. Select workspaces to migrate** Check the workspaces you want to migrate in this round. You can select entire projects or individual workspaces. Use the search bar to filter by workspace name. You do not need to select all workspaces at once. Migrate a subset now and return later to continue with the rest. **3. Click Continue to Review** The wizard checks your selection for issues that need resolution before migration can proceed. ![Select workspaces to migrate](https://mintcdn.com/envzero-b61043c8/VFw2NcRxIisIupl6/images/guides/admin-guide/tfc-migration-select-scope.png?fit=max\&auto=format\&n=VFw2NcRxIisIupl6\&q=85\&s=e392b011e89546d18db475e83c018ba1) > [!NOTE] > > The summary at the bottom shows your total workspace count, selected count, and already-migrated count. Workspaces migrated in previous rounds are marked as **Migrated** and cannot be selected again. ## Re-scanning If your TFC organization has changed since the initial scan, click the **Re-scan** button next to the organization name to refresh the workspace list. ## Next steps * [Resolve missing secrets and VCS gaps](/guides/admin-guide/tfc-migration/resolve-issues), the next step in the wizard * [Fix credential errors or a failed scan](/guides/admin-guide/tfc-migration/troubleshooting) # Go live Source: https://docs.envzero.com/guides/admin-guide/tfc-migration/go-live Complete the Terraform Cloud migration with a controlled cutover that locks TFC workspaces and activates the corresponding env zero environments. The final step transfers operational control from TFC to env zero. You choose which workspaces to cut over and when. Your TFC workspaces stay untouched until you explicitly trigger this step. ## What Go Live does For each workspace you select: 1. **Locks the TFC workspace permanently** - the lock is intentional and stays in place after go-live. The wizard does not unlock TFC. 2. **Unlocks the env zero environment** - allows deployments from env zero > [!WARNING] > > **Go-live is irreversible.** Once complete, the TFC workspace is permanently locked and the env zero environment is active. There is no undo in the wizard. To revert, you would need to manually unlock the TFC workspace and lock the env zero environment yourself. > [!WARNING] > > Going live transfers operational control to env zero. Make sure your team is aware before cutting over production workspaces. ## Cut over workspaces **1. Select workspaces to go live** The Go Live table lists all successfully migrated workspaces. Skipped workspaces are not shown. Each workspace displays its current status and drift detection result: * **Migrated** - migrated and ready to go live * **Live** - already cut over; cannot be re-selected * **Failed** - migration failed; cannot be selected Each workspace also shows a drift detection status from the empty-plan check run after migration. An **error** status means the state transfer may have issues — investigate before going live with that workspace. This status is informational; it does not block go-live. **2. Click Go Live** The button label shows the count of selected workspaces (for example, **Go Live (5)**). env zero locks the TFC workspaces and unlocks the corresponding env zero environments. If unlocking an env zero environment fails after TFC is locked, the TFC lock is automatically rolled back — no manual cleanup is needed. **3. Review results** The results screen shows the success or failure status for each workspace. Failed workspaces can be retried without affecting already-live workspaces. ![Select workspaces to go live](https://mintcdn.com/envzero-b61043c8/VFw2NcRxIisIupl6/images/guides/admin-guide/tfc-migration-go-live.png?fit=max\&auto=format\&n=VFw2NcRxIisIupl6\&q=85\&s=9e04586afc03b041b74e5d7db5411e31) > [!TIP] > > You do not need to go live with all workspaces at once. Go live with a group, then return to the Select Scope step to pick the next group of workspaces to migrate. Start with non-production workspaces to build confidence before cutting over critical infrastructure. ## Migration complete Once all workspaces are live or skipped, the wizard shows a completion screen confirming that env zero is now your source of truth for the migrated environments. From this screen you can: * Click **Done** to finish the migration session * Click **Back to Home** to return to the homepage ## Post-migration checklist After going live, complete the following to fully replicate your TFC setup in env zero: * Verify plan output shows no unexpected infrastructure changes for each migrated environment * Confirm all variables (including sensitive ones) are present and scoped correctly * Configure [SSO/SAML integration](/guides/sso-integrations/self-service-sso) in env zero to manage team access and roles via your identity provider * Recreate any Sentinel or OPA policies as env zero [custom flows](/guides/admin-guide/custom-flows) or policy rules * Configure [notification](/guides/integrations/notifications) integrations (Slack, email, webhooks) * Set up [workflow triggers](/guides/admin-guide/environments/workflow-triggers) to replace any TFC run triggers or workspace dependencies * Re-publish private modules in the env zero [module registry](/guides/admin-guide/private-registry/modules) * Add any [SSH keys](/guides/admin-guide/variables/ssh-keys) needed for private repository access * Verify [VCS](/guides/admin-guide/manage-vcs) webhooks and deployment triggers work as expected * Archive or delete the migrated workspaces in TFC once you are confident the migration is complete ## Finishing the session Once all workspaces are either live or skipped, click **Finish Migration** to close the session. The wizard blocks finishing while any workspace is in a migrated-but-not-live state — you must either go live or skip each migrated workspace before the session can be closed. You can start a new migration session at any time to migrate remaining workspaces. ## Next steps * [Manage your migrated environments](/guides/admin-guide/environments) * [Troubleshoot drift detected after migration](/guides/admin-guide/tfc-migration/troubleshooting#drift-detected-after-migration) * [Return to the migration wizard](/guides/admin-guide/tfc-migration#getting-started) to migrate the next group of workspaces # Resolve issues Source: https://docs.envzero.com/guides/admin-guide/tfc-migration/resolve-issues Review and fix any missing secrets or VCS connection gaps flagged by the migration wizard before proceeding with the Terraform Cloud migration. Before migrating, the [TFC migration wizard](/guides/admin-guide/tfc-migration) checks your selected workspaces for issues that need resolution. It tells you exactly what needs attention. If no issues are found, you skip directly to review. The **Continue** button stays disabled until every issue is either resolved or explicitly skipped. ## Issue types ### Missing secrets TFC marks sensitive variables as write-only, so their values cannot be read during the scan. You need to re-enter these values before migration. Missing secrets appear in two places: * **Workspace variables** - sensitive variables defined on individual workspaces * **Variable set variables** - sensitive variables defined in [variable sets](/guides/admin-guide/variables/variable-sets#coming-from-terraform-cloud) shared across workspaces. Each variable set card shows a badge listing every workspace that uses it, so you can see the full scope before deciding how to handle it. **1. Click on a workspace or variable set card** The card expands to show all sensitive variables that need values. **2. Enter the secret values** Provide the current value for each sensitive variable. **3. Click Save Secrets** The card updates to reflect the resolved status. ![Resolve missing secrets and VCS connections](https://mintcdn.com/envzero-b61043c8/VFw2NcRxIisIupl6/images/guides/admin-guide/tfc-migration-resolve-issues.png?fit=max\&auto=format\&n=VFw2NcRxIisIupl6\&q=85\&s=f36e4f8caf1b116f7710a70ac53c68c4) > [!WARNING] > > **Skipping a secret removes it from the migrated environment.** Use **Skip for now** only for variables that are no longer needed. Any deployment that depends on a skipped variable will fail until the value is [added manually to the environment](/guides/admin-guide/variables#secrets) after migration. ### VCS connection required Some workspaces reference VCS repositories through providers not yet [connected in env zero](/guides/admin-guide/manage-vcs). The wizard groups these issues by provider type and shows the repository name (`org/repo`) for each affected workspace. For each provider, click the **Connect** button (for example, **Connect GitHub**). This opens an OAuth flow directly in the wizard. Once authenticated, all workspaces using that provider are unblocked at once. > [!NOTE] > > Workspaces using VCS providers not supported by env zero are excluded at the workspace selection step and do not appear here. ## No issues found If all selected workspaces pass validation, the wizard displays a success message and you can proceed directly to the next step. ## Next steps * [Review your selection and start the migration](/guides/admin-guide/tfc-migration/review-and-migrate) * [Troubleshoot missing secrets](/guides/admin-guide/tfc-migration/troubleshooting#missing-secrets-not-resolving) if a workspace still reports them # Review and migrate Source: https://docs.envzero.com/guides/admin-guide/tfc-migration/review-and-migrate Review your selected Terraform Cloud workspaces and trigger one-click migration to create matching environments, variables, and state in env zero. The Review step of the [migration wizard](/guides/admin-guide/tfc-migration) shows a summary of what will be created in env zero and lets you trigger the migration with a single click. ## What happens during migration When you click **Create in env zero**, the wizard: 1. Creates env zero [projects](/guides/admin-guide/projects) matching your TFC project structure 2. Creates env zero environments for each selected workspace, in a [**locked**](/guides/admin-guide/environments/environment-locking) state to prevent accidental deployments 3. Copies variables and configuration sets to the new environments 4. Locks the TFC workspace briefly, copies the Terraform state to the [env zero remote backend](/guides/admin-guide/remote-backend), then unlocks the TFC workspace 5. Triggers a [drift detection](/guides/admin-guide/environments/drift-detection) plan to verify the imported state is valid > [!NOTE] > > State migration temporarily locks each TFC workspace during the copy. The lock is released automatically once the state transfer completes. If you see a workspace locked in TFC during migration, this is expected. > [!WARNING] > > **Terraform 1.6+ workspaces are migrated as OpenTofu environments.** env zero does not support Terraform 1.6 or later (BSL license). Any workspace running Terraform 1.6+ is automatically created as an [OpenTofu](/guides/admin-guide/templates/opentofu) environment in env zero. Verify your IaC code is compatible with OpenTofu before going live. ## Review your selection The summary displays your selected workspaces organized by TFC project. For each workspace you can see the Terraform version, VCS repository branch, and variable count. You can uncheck individual workspaces on this screen to defer them to a later migration round before triggering the migration. ![Review migration summary](https://mintcdn.com/envzero-b61043c8/VFw2NcRxIisIupl6/images/guides/admin-guide/tfc-migration-review.png?fit=max\&auto=format\&n=VFw2NcRxIisIupl6\&q=85\&s=ab570be2da3d8b2eab9370a0fded2ad8) ## Migrate large organizations in groups of 50 One migration run accepts up to 100 workspaces. If you select more, the Review step shows a warning and asks you to migrate them in batches. For a large organization, select no more than 50 workspaces per run. A run migrates its workspaces one after another, and workspaces with large state files take longer, so a run of 100 workspaces can exceed the run's time limit. Start the next group once the previous run reports completion. ## Start the migration **1. Review the workspace list** Verify the workspaces and projects listed match your expectations. Uncheck any workspaces you want to defer. **2. Click Create in env zero** The migration begins. Each workspace shows its status inline as migration progresses. **3. Wait for completion** Migration time depends on the number of workspaces and the size of their state files. You can safely leave the page and return later. Progress is saved automatically. ## Migration results When migration completes, the wizard shows a success count and a failure count with error details for any workspace that failed. * **Successfully migrated workspaces are not rolled back if others fail.** Partial success is a valid outcome — already-migrated workspaces are marked and cannot be re-selected in future sessions. * **Drift detection runs asynchronously** after migration reports completion. The plan results appear on each environment once finished. Migration success does not mean drift detection has completed. * If any workspaces failed, click **Retry** to attempt them again. Only the failed workspaces are retried. ## Next steps * [Go live](/guides/admin-guide/tfc-migration/go-live) to lock the TFC workspaces and activate the new env zero environments * [Troubleshoot a failed state migration](/guides/admin-guide/tfc-migration/troubleshooting#state-migration-fails) # Troubleshooting Source: https://docs.envzero.com/guides/admin-guide/tfc-migration/troubleshooting Fix common issues during Terraform Cloud migration, including credential errors, scan failures, state transfer problems, and drift detection. ## Invalid credentials Verify that: * The organization name matches exactly (case-sensitive) * The API token has read access to workspaces, variables, and variable sets * The token has not expired ## Scan fails or times out Click **Retry Scan** on the Select Scope step. If the issue persists, check that your TFC organization is accessible and the token permissions are correct. ## Missing secrets not resolving Sensitive variable values in TFC are write-only and cannot be read by the scanner. You must re-enter these values manually in the Resolve step. ## State migration fails State migration can fail if: * The TFC workspace state is locked by an active run * The state file is too large for a single transfer * Network connectivity issues between env zero and TFC Retry the migration for failed workspaces after resolving the underlying issue. ## Drift detected after migration A non-empty plan after state migration usually means: * A provider version difference between TFC and env zero * Environment variables or credentials differ between platforms * The state was modified in TFC after the migration started Run the plan in env zero to review the changes and apply if they are expected. ## CLI-driven workspaces TFC workspaces using CLI-driven runs have no linked repository. The wizard migrates these workspaces, but the resulting env zero environments are not connected to a repository. After migration, connect a repository to the environment in env zero so that deployments can be triggered. ## Token authentication format for Terraform Enterprise If migrating from Terraform Enterprise (self-hosted), ensure the token variable name matches your hostname format: `TF_TOKEN_` (with dots replaced by underscores). ## Related docs * [State Migration](/guides/admin-guide/remote-backend/state-migration) * [Environment Locking](/guides/admin-guide/environments/environment-locking) ## Next steps For the full sequence of wizard steps, see the [Terraform Cloud migration overview](/guides/admin-guide/tfc-migration). # User API keys Source: https://docs.envzero.com/guides/admin-guide/user-role-and-team-management/api-keys Create and manage Admin, User, and Personal API keys in env zero for REST API access, Terraform provider use, and module registry with RBAC-scoped permissions. As an organization admin, it is possible to create API keys that can use env zero without interacting with the UI. For example, you can call the [API](/api-reference/credentials/create-api-key) directly, use the [Terraform provider](/guides/community-and-resources/support-and-help/terraform-provider), or use the [Private Module Registry](/guides/admin-guide/private-registry/modules). > [!WARNING] > > Deleting an API key > > When deleting an API key it might take up to 1 hour for it to completely expire. ## How to create an API key From *Organization Settings* navigate to *API Keys* tab: ![Organization Settings API Keys tab showing existing keys and the Add button](https://mintcdn.com/envzero-b61043c8/ngeLWWxxE3C57X-b/images/guides/admin-guide/user-role-and-team-management/55ece3b-screen_shot_2022-05-24_at_12.png?fit=max\&auto=format\&n=ngeLWWxxE3C57X-b\&q=85\&s=2e548de9416493175553bd64d5d19f8f) Click the + button to see the create API key modal.\ By default, the role of the key will be Admin, but you can also assign it to a user role, and provide specific project permission (the same as when [inviting a new user](/guides/admin-guide/user-role-and-team-management/user-management#invite-users-to-an-organization) to the platform): ![Create API key modal showing role selection and project permission assignment options](https://mintcdn.com/envzero-b61043c8/ngeLWWxxE3C57X-b/images/guides/admin-guide/user-role-and-team-management/87bb66d-screen_shot_2022-05-24_at_16.png?fit=max\&auto=format\&n=ngeLWWxxE3C57X-b\&q=85\&s=90da1989fdd6978e5cf46d3974dfa1a3) ## Admin API key With an admin API key, you can perform any request that requires admin permission: changing organization settings, deploying and approving environments, etc.\ You can check our full API in the [API reference](/api-reference). ## Non-Admin API key With a non-admin (User) API key, you can provide members of your team with the ability to use our API, while maintaining your organization's [RBAC](/guides/admin-guide/user-role-and-team-management/rbac).\ When creating a user API key, it can be configured with specific project permissions, assigned to a team, and treated like any other user in the system. ![Create user API key form showing project permissions and team assignment fields](https://mintcdn.com/envzero-b61043c8/ngeLWWxxE3C57X-b/images/guides/admin-guide/user-role-and-team-management/ff6e406-screen_shot_2022-05-24_at_18.png?fit=max\&auto=format\&n=ngeLWWxxE3C57X-b\&q=85\&s=9da1519619c2080840902fe28290fb99) ## Read-only API key Select **Read-only** when you create an admin or user API key, or send `"readOnly": true` to [Create API Key](/api-reference/credentials/create-api-key). A read-only key keeps only the view permissions of its role, such as View Environment, View Project, View Audit Logs, and Read State. It can't create, update, or delete resources, and it can't run plans or tasks. A request that needs another permission fails with `403`. The **Read-only** column on the *API Keys* tab marks these keys. You can't make an existing key read-only, so create a new one. Personal API keys can't be read-only. ### Read access to every project To give an integration read access to your whole organization, create an **Admin** API key and select **Read-only**. You don't need to select any projects. An organization role covers every project in the organization, so the key can also read projects created after it. A **User** key can read only the projects that its own project permissions or its teams give it. You can't edit the key's own project permissions after you create it. ## Allowed IPs Any API key, including a personal API key, can be limited to a list of IP addresses. Enter them in **Allowed IPs** when you create the key, or click the edit button next to an existing key. The **Allowed IPs** column shows each key's list, and **Any IP** for a key without one. Your organization's [IP allowlist](/guides/overview/security-overview/ip-allowlisting) still applies on top of the key's list. For the entry format and the API, see [Allowed IPs for one API key](/guides/overview/security-overview/ip-allowlisting#allowed-ips-for-one-api-key). ## Personal API key With a personal API key, members of your team can be provided with the ability to use our API with the same permissions they have configured in their env zero account. Every user can generate a personal API key, you can read more about it in our [API docs](/api-reference/credentials/create-api-key). # Custom roles Source: https://docs.envzero.com/guides/admin-guide/user-role-and-team-management/custom-roles Create and manage custom roles with tailored permissions in env zero, assignable at organization, project, and environment levels with deletion options. Custom roles allow you to create tailored permission sets that match your organization's specific needs. These roles can be created, edited, and deleted as needed, giving you full flexibility to define exactly what permissions users should have. ## Role Creation and Management Create a role with your desired permissions in **Organization Settings** > **Roles** tab > **Add Role** button. You can also edit or delete roles from that page. > [!NOTE] > > **Role Deletion Behavior** > > When roles are deleted while being assigned, the users or team will update according to the role assignment level: > > * **Organization level**: The user will receive the default [Organization User](/guides/admin-guide/user-role-and-team-management/default-roles#organization-user) role. > * **Project level**: The user will lose access to that project and have no role in it. > * **Environment level**: The user will lose access to that environment and have no role in it. ## Role Assignment Roles can be assigned to [users](/guides/admin-guide/user-role-and-team-management/user-management) or [teams](/guides/admin-guide/user-role-and-team-management/teams): * **Organization Roles**: Assigned in **Organization Settings** > **Users** or **Teams** tab. See [Assigning Organization Roles](/guides/admin-guide/user-role-and-team-management/role-assignment#assigning-organization-roles) for details. * **Project Roles**: Assigned in **Project Settings** > **Users** or **Teams** tab. See [Assigning Project Roles](/guides/admin-guide/user-role-and-team-management/role-assignment#assigning-project-roles) for details. * **Environment Roles**: Assigned in the **Environment** page > **ACCESS** tab. See [Assigning Environment Roles](/guides/admin-guide/user-role-and-team-management/role-assignment#assigning-environment-roles) for details. ## Custom Role Permissions ### Deployment Permissions | Permission | Description | | :- | :- | | Run Plans | Create an environment, redeploy & destroy - without apply (requires approval) | | Run Applies | Create an environment, redeploy & destroy (without requiring approval), approve plans and update environment-level variables | | Abort Deployments | Abort running deployments | | Run Tasks | Run ad hoc commands on environments' workspaces | | Create VCS Environment | Create an environment without use of a template. Used in conjunction with "Run Plans" or "Run Applies" | ### Environment Permissions | Permission | Description | | :- | :- | | Edit Environment Settings | Edit Continuous Deployment, Environment Triggers, Scheduling and Drift Detection | | Edit Environment VCS Settings | Edit IaC type, advanced settings and VCS details in Environments that are created using a VCS rather than using a template | | View Drift Cause | View the cause of a drift in the environment | | Archive Environment | Mark an environment as inactive (without destroying the underlying resources) | | `Lock/Unlock Environment` | Lock environment, preventing changes to the underlying resources | | Override Max TTL | Extend environments' TTL beyond the project/organization policy | | Override project's max-environments policy | Allow creating more environments in a project than a project's policy allows | | View Environment | See environment in Environment's list, view its settings, variables and logs | | Assign roles on environment | Assign roles for environment(s) | ### Project Permissions | Permission | Description | | :- | :- | | View Project | See project in Projects list, view project settings, templates, variables and environments, within a specific project | | Edit Project Settings | Edit Project Settings & Variables | | Manage Project Templates | Manage which templates can be used to create environments, within a specific project | | Create Project | Create new projects | | Import Environments | Import existing infrastructure as env zero environments | ### Organization Permissions | Permission | Description | | :- | :- | | View Organization | View organization variables, templates and modules | | Edit Organization Settings | Edit organization settings and variables | | Create & Edit Templates | Create and edit templates in the organization | | Create & Edit Modules | Create and edit modules in the organization's private module registry | | Create & Edit Providers | Create and edit providers in the organization's private provider registry | | Create Cross-Project Environment Triggers | Make an Environment's from one project, trigger an environment in another project | | View Modules | View and download modules from the organization's private module registry | | View Providers | View and download providers from the organization's private providers registry | | Create & Edit Custom Roles | Create and edit custom roles in the organization | | View Dashboard | View the organization's dashboard | | Edit Dashboard | Edit the organization's dashboard (IaC Insights only) | | View Audit Logs | View the logs for all the events in the organization | | Manage Billing Information | Change pricing plan and billing data | | Move Environments | Move environments between different projects | | Manage Credentials | Create and update credentials | | Manage VCS Connections | Create, edit, and delete VCS connections | ### Remote Backend Permissions | Permission | Description | | :- | :- | | Read State | Read the remote state | | Write State | Edit the remote state | | `Force Unlock Workspace` | Release workspace locks | | Edit Allow Remote Apply | Configure whether remote apply is allowed for the workspace | # Default roles Source: https://docs.envzero.com/guides/admin-guide/user-role-and-team-management/default-roles Built-in default roles at organization, project, and environment levels in env zero, including Organization Admin, Project Admin, and Project Deployer. Default roles are built-in, non-editable roles that come with every env zero organization. These roles provide standard permission sets for common use cases and cannot be modified or deleted. ## Organization-Level Default Roles Organization roles apply across the entire organization and cascade down to all projects (including [sub-projects](/guides/admin-guide/projects/sub-projects)) and environments. ### Organization User The basic role for organization members. Provides: * View organization variables, templates, and modules * View modules from the private module registry * View providers from the private provider registry This is the default role assigned when a [custom role](/guides/admin-guide/user-role-and-team-management/custom-roles) is deleted from a user at the organization level. ### Organization Admin Full administrative access to the organization. Includes all available permissions across the platform, including: * All [Organization User](#organization-user) permissions * Edit organization settings and variables * Create and edit templates, modules, and providers * Create and edit custom roles * View and edit dashboards * View [audit logs](/guides/admin-guide/audit-logs) * Manage billing information * Move environments between projects * Manage credentials and VCS connections * All project and environment permissions ## Project-Level Default Roles Project roles apply to specific projects and cascade down to: * All sub-projects within that project * All environments within the project and its sub-projects ### Project Viewer Read-only access to project resources. Provides: * All [Organization User](#organization-user) permissions * View project settings, templates, variables, and environments * Read Terraform state files * View drift causes ### Project Planner Can create and plan deployments but cannot apply changes. Provides: * All [Project Viewer](#project-viewer) permissions * Run plans (create environments, redeploy, destroy - requires approval) ### Project Deployer Can deploy and manage environments. Provides: * All [Project Planner](#project-planner) permissions * Run applies (deploy without requiring approval) * Edit environment settings * Write to Terraform state files * Abort running deployments ### Project Admin Full administrative access to the project. Provides: * All [Project Deployer](#project-deployer) permissions * Edit project settings and variables * Manage project templates * Archive environments * Lock environments and release existing locks * Override max TTL settings * Create cross-project environments * Force-release workspace locks * Create new projects * [Assign roles on environments](/guides/admin-guide/user-role-and-team-management/role-assignment#assigning-environment-roles) * Create VCS environments * Edit VCS environment settings * Import environments * Manage credentials and VCS connections ## Environment-Level Default Roles Environment roles apply to specific environments only. ### Environment Viewer Read-only access to a specific environment. Provides: * All [Organization User](#organization-user) permissions * View environment details, settings, variables, and logs * Read Terraform state files * View drift causes ### Environment Planner Can plan changes to a specific environment. Provides: * All [Environment Viewer](#environment-viewer) permissions * Run plans (requires approval) ### Environment Deployer Can deploy changes to a specific environment. Provides: * All [Environment Planner](#environment-planner) permissions * Run applies (deploy without requiring approval) * Edit environment settings * Write to Terraform state files * Abort running deployments ### Environment Admin Full administrative access to a specific environment. Provides: * All [Environment Deployer](#environment-deployer) permissions * Archive the environment * Lock the environment and release existing locks * Override max TTL settings * Force-release the workspace lock * Assign roles on the environment * Edit allow remote apply settings # Role-based access control (RBAC) Source: https://docs.envzero.com/guides/admin-guide/user-role-and-team-management/rbac Manage permissions with role-based access control in env zero, using default and custom roles assignable at organization, project, and environment levels. env zero's Role-Based Access Control (RBAC) system allows you to manage permissions for users and teams across your organization, projects, and environments. This comprehensive access control system ensures that team members have the appropriate level of access to perform their responsibilities while maintaining security and governance. ## Understanding Roles in env zero env zero provides two types of roles to manage access control within your organization: ### Default Roles vs. Custom Roles **[Default roles](/guides/admin-guide/user-role-and-team-management/default-roles)** are built-in, non-editable roles that come with every env zero organization. These roles provide standard permission sets for common use cases and cannot be modified or deleted. They are designed to cover the most common access patterns and ensure consistent security practices across organizations. **[Custom roles](/guides/admin-guide/user-role-and-team-management/custom-roles)** allow you to create tailored permission sets that match your organization's specific needs. These roles can be created, edited, and deleted as needed, giving you full flexibility to define exactly what permissions users should have. ### Role Assignment Levels and Inheritance Roles can be assigned at three levels in env zero, and permissions cascade down the hierarchy: * **Organization Level**: Roles assigned at the organization level apply to the entire organization and cascade down to all projects (including sub-projects) and environments within the organization. * **Project Level**: Roles assigned at the project level apply to that specific project and cascade down to: * All sub-projects within that project * All environments within the project and its sub-projects * **Environment Level**: Roles assigned at the environment level apply only to that specific environment. > [!NOTE] > > **Permission Cascading** > > env zero's RBAC is cascading, top to bottom. If a user or team has a permission at the organization level, they have that permission on every project and environment in the organization. Similarly, project-level permissions apply to all sub-projects and environments within that project. > > However, this does not work in reverse - project permissions only apply to that specific project and its sub-projects, not to the parent project or organization. ## RBAC Documentation > [card] [Default Roles](/guides/admin-guide/user-role-and-team-management/default-roles) > > Learn about built-in roles and their permissions at organization, project, and environment levels > [card] [Custom Roles](/guides/admin-guide/user-role-and-team-management/custom-roles) > > Create and manage custom roles with tailored permissions > [card] [Assigning Roles](/guides/admin-guide/user-role-and-team-management/role-assignment) > > Step-by-step guides for assigning roles to users and teams # Assigning roles Source: https://docs.envzero.com/guides/admin-guide/user-role-and-team-management/role-assignment Assign roles to users and teams at organization, project, and environment levels in env zero, with cascading permissions and sub-project inheritance rules. Roles can be assigned at three levels: organization, project, and environment. ## Assigning Organization Roles Organization roles can be assigned to both individual [users](/guides/admin-guide/user-role-and-team-management/user-management) and [teams](/guides/admin-guide/user-role-and-team-management/teams), and apply across the entire organization (including all projects and environments). ### Assigning Organization Roles to Users **1. Navigate to Organization Settings** Go to **Organization Settings** > **Users** tab. **2. Select User Role** Locate the user in the table and click the **Role** dropdown for that user. **3. Choose Role** Select from the available roles in the dropdown: * Default roles: [Organization User](/guides/admin-guide/user-role-and-team-management/default-roles#organization-user), [Organization Admin](/guides/admin-guide/user-role-and-team-management/default-roles#organization-admin) * Custom roles: Any [custom roles](/guides/admin-guide/user-role-and-team-management/custom-roles) created for your organization > [!NOTE] > > **Role Dropdown Organization**: Default roles are listed first, followed by a separator, then custom roles in alphabetical order. **4. Save Changes** Click **SAVE** to apply the changes. ![Organization User Role Assignment](https://mintcdn.com/envzero-b61043c8/ngeLWWxxE3C57X-b/images/guides/admin-guide/user-role-and-team-management/org-user-role-assignment.png?fit=max\&auto=format\&n=ngeLWWxxE3C57X-b\&q=85\&s=41a5e370ce84125bae9cefe83e52ea7f) ### Assigning Organization Roles to Teams **1. Navigate to Organization Settings** Go to **Organization Settings** > **Teams** tab. **2. Select Team Role** Locate the team in the table and click the **Role** dropdown for that team. **3. Choose Role** Select from the available roles: * Default roles: [Organization User](/guides/admin-guide/user-role-and-team-management/default-roles#organization-user), [Organization Admin](/guides/admin-guide/user-role-and-team-management/default-roles#organization-admin) * Custom roles: Any custom roles created for your organization **4. Save Changes** Click **SAVE** to apply the changes. ![Organization Team Role Assignment](https://mintcdn.com/envzero-b61043c8/ngeLWWxxE3C57X-b/images/guides/admin-guide/user-role-and-team-management/org-team-role-assignment.png?fit=max\&auto=format\&n=ngeLWWxxE3C57X-b\&q=85\&s=5cdf07db3bb6d5f2c152d21faa139c2c) ## Assigning Project Roles Project roles can be assigned to both users and teams and apply to a specific project, all its sub-projects, and all environments within them. ### Assigning Project Roles to Users **1. Navigate to Project Settings** Go to **Project Settings** > **Users** tab. **2. Select User** Locate the user in the table and check the checkbox in the **Assign** column. **3. Choose Role** Click the **Role** dropdown that appears and select from the available roles: * Default roles: [Project Viewer](/guides/admin-guide/user-role-and-team-management/default-roles#project-viewer), [Project Planner](/guides/admin-guide/user-role-and-team-management/default-roles#project-planner), [Project Deployer](/guides/admin-guide/user-role-and-team-management/default-roles#project-deployer), [Project Admin](/guides/admin-guide/user-role-and-team-management/default-roles#project-admin) * Custom roles: Any custom roles created for your organization **4. Save Changes** Click **SAVE** to apply the changes. ![Project User Role Assignment](https://mintcdn.com/envzero-b61043c8/ngeLWWxxE3C57X-b/images/guides/admin-guide/user-role-and-team-management/project-user-role-assignment.png?fit=max\&auto=format\&n=ngeLWWxxE3C57X-b\&q=85\&s=bbe906f67c685f1f6384928e7a8e449f) > [!NOTE] > > **Important:** You must first select the user using the checkbox in the **Assign** column before you can choose their role. ### Assigning Project Roles to Teams **1. Navigate to Project Settings** Go to **Project Settings** > **Teams** tab. **2. Select Team** Locate the team in the table and check the checkbox in the **Assign** column. **3. Choose Role** Click the **Role** dropdown that appears and select from the available roles: * Default roles: [Project Viewer](/guides/admin-guide/user-role-and-team-management/default-roles#project-viewer), [Project Planner](/guides/admin-guide/user-role-and-team-management/default-roles#project-planner), [Project Deployer](/guides/admin-guide/user-role-and-team-management/default-roles#project-deployer), [Project Admin](/guides/admin-guide/user-role-and-team-management/default-roles#project-admin) * Custom roles: Any custom roles created for your organization **4. Save Changes** Click **SAVE** to apply the changes. ![Project Team Role Assignment](https://mintcdn.com/envzero-b61043c8/ngeLWWxxE3C57X-b/images/guides/admin-guide/user-role-and-team-management/project-team-role-assignment.png?fit=max\&auto=format\&n=ngeLWWxxE3C57X-b\&q=85\&s=ec02ca89493ea887caca7fc9a38a94e9) > [!NOTE] > > **Important:** You must first select the team using the checkbox in the **Assign** column before you can choose their role. ## Assigning Environment Roles Environment roles can be assigned to both users and teams and apply only to a specific environment. > [!NOTE] > > **Team Role Assignment Limitation** > > Default roles cannot be assigned to teams at the environment level. Teams can only be assigned custom roles at the environment level. ### Assigning Environment Roles to Users **1. Navigate to Environment** Go to the **Environment** page and click the **ACCESS** tab. **2. Select User** In the **Manage Users** card, locate the user in the table and check the checkbox in the **Assign** column. **3. Choose Role** Click the **Role** dropdown that appears and select from the available roles: * Default roles: [Environment Viewer](/guides/admin-guide/user-role-and-team-management/default-roles#environment-viewer), [Environment Planner](/guides/admin-guide/user-role-and-team-management/default-roles#environment-planner), [Environment Deployer](/guides/admin-guide/user-role-and-team-management/default-roles#environment-deployer), [Environment Admin](/guides/admin-guide/user-role-and-team-management/default-roles#environment-admin) * Custom roles: Any custom roles created for your organization **4. Save Changes** Click **SAVE** to apply the changes. ![Environment User Role Assignment](https://mintcdn.com/envzero-b61043c8/ngeLWWxxE3C57X-b/images/guides/admin-guide/user-role-and-team-management/environment-user-role-assignment.png?fit=max\&auto=format\&n=ngeLWWxxE3C57X-b\&q=85\&s=5b1e0419a9a1f5dc59cb25c69dfd042f) > [!NOTE] > > **Important:** You must first select the user using the checkbox in the **Assign** column before you can choose their role. ### Assigning Environment Roles to Teams **1. Navigate to Environment** Go to the **Environment** page and click the **ACCESS** tab. **2. Select Team** In the **Manage Teams** card, locate the team in the table and check the checkbox in the **Assign** column. **3. Choose Role** Click the **Role** dropdown that appears and select a custom role. **4. Save Changes** Click **SAVE** to apply the changes. ![Environment Team Role Assignment](https://mintcdn.com/envzero-b61043c8/ngeLWWxxE3C57X-b/images/guides/admin-guide/user-role-and-team-management/environment-team-role-assignment.png?fit=max\&auto=format\&n=ngeLWWxxE3C57X-b\&q=85\&s=f22e61c29027979427f8732a1f5de458) > [!NOTE] > > **Default Role Limitation** > > Default roles ([Environment Viewer](/guides/admin-guide/user-role-and-team-management/default-roles#environment-viewer), [Environment Planner](/guides/admin-guide/user-role-and-team-management/default-roles#environment-planner), [Environment Deployer](/guides/admin-guide/user-role-and-team-management/default-roles#environment-deployer), [Environment Admin](/guides/admin-guide/user-role-and-team-management/default-roles#environment-admin)) cannot be assigned to teams at the environment level. Only custom roles are available for team assignments. > [!NOTE] > > **Important:** You must first select the team using the checkbox in the **Assign** column before you can choose their role. # Manage teams Source: https://docs.envzero.com/guides/admin-guide/user-role-and-team-management/teams Create and manage teams in env zero to group users and assign permissions at organization, project, and environment levels, with SCIM provisioning support. Teams allow you to manage permissions across your env zero organization by setting a role for an entire group of users as a single entity. Assigning a team's role is available across all scopes, including organization, project, and environment levels. A team belongs to a single [Organization](/guides/admin-guide/organizations). Teams are managed at the Organization Settings level, and are not shared between multiple organizations. Teams can be synced from your identity provider's groups. With SSO, groups sync at login time. For continuous sync that doesn't depend on login events, see [SCIM provisioning](/guides/sso-integrations/scim-provisioning). ## Creating a Team To create a team, you must be an Organization Admin. 1. Go to **Organization Settings** 2. Click on the **Teams** tab. 3. Click the **Add Team** button 4. Fill in the team's `name` and `description` 5. Click **Confirm** to create the team. ![Interface screenshot showing configuration options](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/7789123-image.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=c08af0ba0a7cba48c005d9ab622c442f) ![Teams tab in Organization Settings showing the list of existing teams with Add Team button](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/60e7d13-screen_shot_2020-10-20_at_17.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=67455c7d216087f18d97fda4d7fc5780) ## Managing Members To manage team's members, go to **Organization Settings**, and then to **Teams** tab. 1. Click on the "Users" icon next to the team you would like to change. 2. You will now be redirected to the "Manage Team" page, which lets you edit the team's information, and manage the members of the team. > [!NOTE] > > **Adding Users to a Team** > > Only existing users in the Organization may be added as team members - to add new users to your organization follow the [Users Management guide](/guides/admin-guide/user-role-and-team-management/user-management) ![Manage Team page showing team information editor and member list with add/remove controls](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/27c92f7-screen_shot_2020-10-20_at_17.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=e50846833cf2312d4dac498d52293c36) ## Managing Team Access to a Project Either an Organization Admin or a Project Admin can manage the access of members, or teams, of your organization to a project. This role will cascade into every member of the team. See [Users & Roles](/guides/admin-guide/user-role-and-team-management/user-management/#project-users) for more information on roles. > [!WARNING] > > Users With Multiple Roles > > In the case a user is assigned to a project with multiple roles (such as being the member of two different teams who each have a different role), then the highest permission role for that project will take precedence. To modify permissions on a project 1. Go to **Project Settings**, and then to the **Teams** tab. 2. You will see all teams for the organization, assign your desired Teams to the project by clicking the check mark and picking a role for that team from the dropdown. 3. Click on Save when you are done ![Project Settings Teams tab showing team list with role dropdown and checkmarks to assign access](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/e22dc43-screen_shot_2020-10-20_at_17.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=ebf1ef7a25ce0075c5f81e9b872925af) ## Next steps * Assign a team an [organization](/guides/admin-guide/user-role-and-team-management/role-assignment#assigning-organization-roles-to-teams), [project](/guides/admin-guide/user-role-and-team-management/role-assignment#assigning-project-roles-to-teams) or [environment](/guides/admin-guide/user-role-and-team-management/role-assignment#assigning-environment-roles-to-teams) role * [Compare the default roles](/guides/admin-guide/user-role-and-team-management/default-roles) before picking one for a team * [Create a custom role](/guides/admin-guide/user-role-and-team-management/custom-roles) if no default role fits # Manage users Source: https://docs.envzero.com/guides/admin-guide/user-role-and-team-management/user-management Add, invite, and manage users in your env zero organization with SSO via Azure Active Directory, SAML 2.0, and SCIM provisioning support. ## Create users in env zero When a new user logs into env zero for the first time, either by signing up or accepting an invitation to join an existing Organization, a user profile is created. Profile details are taken from the Google, Github, BitBucket, or Microsoft account that was used to log in. Users are identified by their email address. > [!NOTE] > > **Single Sign-On (SSO)** > > env zero supports Single Sign-On with Azure Active Directory (Microsoft Entra ID) and SAML 2.0 for enterprise authentication. With SSO enabled, users authenticate through your identity provider and are automatically provisioned in env zero. > > You can configure SSO directly from your organization settings. See [Self-service SSO integration](/guides/sso-integrations/self-service-sso) for setup instructions. > > For automated user provisioning and deprovisioning that doesn't depend on login events, see [SCIM provisioning](/guides/sso-integrations/scim-provisioning). When a user profile is created, a Default Organization is set up for them, and they become its administrator. This Default Organization is used for testing and evaluation. Users can be part of multiple [Organizations](/guides/admin-guide/organizations) and can also accept invitations to join other organizations. ## Manage Organization Users Organization Administrators have the capability to oversee user management within the organization. This includes assigning users to roles directly or via teams, offering flexibility in how permissions are distributed across the organization, project, and environment. To access the user management interface, navigate to the Users screen located under the Settings tab. This area is exclusively available to Organization Administrators. > [!NOTE] > > **Note** > > Selecting an Active Project changes the context of the Users screen to project-specific user management, rather than organization-wide settings. Organization Administrators can modify roles, invite new users, or remove existing users from the organization. Direct changes to a user's organization role or their removal from the organization are actions restricted to Organization Administrators only. ## Invite Users to an Organization Any Organization Administrator can invite other users to join their organization. Click Invite User, enter a valid email address for the invited user, and then click Send Invitation. A user can be invited to an organization whether or not they have an active env zero profile. A user is created in env zero for the invitee (if they are not already a user). The invitation email is sent to the user at their email address and the user status is set to Invited. If the user is new to env zero, a user profile is created when they log in for the first time. The admin can track the user status in the Users screen, and see when the user has accepted the invitation and joined the organization. Organization Administrators can revoke an invitation to a user at any time. Click on the garbage can icon next to the user in the Users tab. Once revoked, the user disappears from the list and they can no longer accept the invitation. ## Understanding Roles env zero uses Role-Based Access Control (RBAC) to manage permissions. Users can be assigned roles at the organization, project, or environment level. **Organization-level roles** include: * **[Organization User](/guides/admin-guide/user-role-and-team-management/default-roles#organization-user)** - Basic access to view organization resources * **[Organization Admin](/guides/admin-guide/user-role-and-team-management/default-roles#organization-admin)** - Full administrative access across the entire organization For detailed information about all available roles and their permissions, see [Default roles](/guides/admin-guide/user-role-and-team-management/default-roles). You can also [create custom roles](/guides/admin-guide/user-role-and-team-management/custom-roles) tailored to your organization's needs. ## Project Users To have access to a project, users need to be associated with it.\ Each user associated with a project has a specific project Role assigned to them. Managing access to a project can be done in 2 ways: 1. **Managing a team's access to a project:**\ If a user is a member of a team that is assigned to the project, the team's role will cascade onto the user. See the [Teams section](/guides/admin-guide/user-role-and-team-management/teams/#managing-team-access-to-a-project) for more information. 2. **Manage a user's access directly:**\ A user can also be given a specific role in a project outside of a team. This can be used to give a user additional permissions beyond those assigned by their team, or when the user is not part of any team. Managing users this way requires the Administrator role for that project.\ Go to Project Settings and then select the Users tab. There you'll see a list of all the organization users. Select users from this list to assign to this project. For each, set a role within the specific project. If the user has multiple roles that originate from their teams or from their specific role for the project, the highest role will be the one to take effect. ## Project Roles **Project-level roles** include: * **[Project Viewer](/guides/admin-guide/user-role-and-team-management/default-roles#project-viewer)** - Read-only access to project resources * **[Project Planner](/guides/admin-guide/user-role-and-team-management/default-roles#project-planner)** - Can plan deployments but requires approval * **[Project Deployer](/guides/admin-guide/user-role-and-team-management/default-roles#project-deployer)** - Can deploy and manage environments * **[Project Admin](/guides/admin-guide/user-role-and-team-management/default-roles#project-admin)** - Full administrative access to the project Organization Admins automatically have admin access to all projects. For complete details about project roles and their permissions, see [Default roles](/guides/admin-guide/user-role-and-team-management/default-roles). You can also [create custom roles](/guides/admin-guide/user-role-and-team-management/custom-roles) with specific permissions. ## Environment Access Users can be assigned roles at the environment level for granular access control. **Environment-level roles** include: * **[Environment Viewer](/guides/admin-guide/user-role-and-team-management/default-roles#environment-viewer)** - Read-only access to a specific environment * **[Environment Planner](/guides/admin-guide/user-role-and-team-management/default-roles#environment-planner)** - Can plan changes but requires approval * **[Environment Deployer](/guides/admin-guide/user-role-and-team-management/default-roles#environment-deployer)** - Can deploy changes to the environment * **[Environment Admin](/guides/admin-guide/user-role-and-team-management/default-roles#environment-admin)** - Full administrative access to the environment You can assign different permission levels at different scopes. For example, a user might have Viewer access at the project level but Admin access to a specific environment within that project. For complete details about environment roles and permissions, see [Default roles](/guides/admin-guide/user-role-and-team-management/default-roles). To create roles with specific permissions, see [Custom roles](/guides/admin-guide/user-role-and-team-management/custom-roles). ## Next steps To grant a user access, [assign them a role](/guides/admin-guide/user-role-and-team-management/role-assignment) at the organization, project, or environment level. # Managing variables Source: https://docs.envzero.com/guides/admin-guide/variables Configure Terraform and shell environment variables across organization, project, template, and environment scopes in env zero for IaC deployments. ## Terraform Variables and Environment Variables Using an infrastructure-as-code model, variables are used to customize certain aspects of a configuration for a specific deployment, without having to change the code. In this way, a single configuration can be used in different contexts to create different deployments. Variables can be anything from ports and IPs to cloud credentials, availability zones, and images. env zero supports two types of variables: * Terraform Variables (also called Input Variables) - These are defined in the Terraform configuration files. Their values are set by env zero when running IaC commands. * Environment Variables - These are set by env zero in the shell running IaC commands and [Custom Flows](/guides/admin-guide/custom-flows). > [!NOTE] > > **Built-in Terraform/Terragrunt Environment Variables Support** > > Terraform and Terragrunt support various environment variables to alter the behavior of the deployment. You can add those as environment variables inside the env zero platform as well, under name and the appropriate value. > > See all the supported [Terraform environment variables](https://www.terraform.io/cli/config/environment-variables#environment-variables) and the relevant [Terragrunt environment variables](https://terragrunt.gruntwork.io/docs/reference/cli-options/#cli-options). > > For example:\ > If you wish to perform a state migration you can add the `TF_CLI_ARGS_init` environment variable and as a value by adding `-migrate-state`.\ > You can read more about `TF_CLI_ARGS` [here](https://www.terraform.io/cli/config/environment-variables#tf_cli_args-and-tf_cli_args_name). Terraform Variables and Environment Variables are both managed by the user in env zero. ## Variables and Scopes in env zero env zero uses hierarchical scopes to manage variables (both Terraform Variables and Environment Variables). You can set variables for an Organization, a Template, a Project, or a specific Environment. Each scope inherits the variables defined in the higher scopes. Hence, a template will have all the variables that are set for the organization. A project will have all the variables that are set for the organization, or any parent projects it has. And a new Environment will have all the variables that are set for the project, template, and organization. You can change the value of a variable inherited from a higher scope, but not its name. ### Precedence across scopes When a variable is set in more than one scope, the most specific scope wins. From lowest to highest precedence: 1. Organization 2. Template 3. Project. A sub-project wins over its parent project. 4. Environment Values you set when you deploy, in the deploy dialog or through the API, are saved on the environment, so they rank as environment values. For a workflow sub-environment, the workflow environment's variables rank between the project and the sub-environment. A [read-only variable](#read-only-variable) is the exception. Once a scope marks a variable as read-only, every lower scope uses that value, and lower-scope values are ignored. A [variable set](/guides/admin-guide/variables/variable-sets#precedence-and-conflicts) ranks at the scope it's assigned to. The different variable scopes reflect the fact that variables are used for different purposes and might be set by different people. > [!NOTE] > > **Example** > > * An administrator sets cloud credentials in the Organization scope to apply to all the environments managed in an organization. > > * A DevOps engineer creates a new template. They want to have the option for the user to select from two different machine sizes. Therefore they use the same Terraform configuration, with the instance type set as a variable, and create two templates, each with a different value for the instance size variable. > > * A developer creates a new environment. They don't need to know the credentials, or set the sizes of instances. They choose a template and let env zero use the variables defined in the higher scopes. They can, however, still make further customizations by overriding a Terraform Variable which specifies which port to use. ## Variables Value Types The env zero platform supports several value types of variables: ### Free Text This is the most common value type. It holds a plain text value. This value type also supports setting it as [secrets](/guides/admin-guide/variables/#secrets). A blank value reaches Terraform as an empty string (`""`), and `null` reaches it as the string `"null"`. To pass Terraform's `null`, use [HCL Format](#pass-null). ### HCL Format This type allows you to define complex terraform values, similar to what can you define in the `.tf` file\ We support all complex [terraform types](https://www.terraform.io/language/expressions/types#types-and-values).\ This format is only available under **Terraform Variables** section. Examples for HCL values: ```hcl Object theme={null} { name = "John" age = 52 } ``` ```hcl Array theme={null} [ "value1", "value2" ] ``` ```hcl Compound theme={null} { objects_list = [ { first_field = "value1" second_field = "value2" }, { first_field = "value1" second_field = "value2" }] } ``` #### Pass null Enter `null` to set the variable to Terraform's `null`. env zero writes ` = null` to `env0.auto.tfvars`. | HCL Format value | Terraform receives | | - | - | | `null` | `null` | | `"null"` | The string `"null"` | | Empty | Nothing. The variable is omitted, so the default in your code applies. | > [!NOTE] > > **Self-hosted agents**: passing `null` requires agent v5.3.0 or later. Older agents pass the string `"null"`. ### JSON Format This type allows you to define complex terraform values such as JSON format.\ We support all complex [terraform types](https://www.terraform.io/language/expressions/types#types-and-values).\ This format is only available under the Terraform Variables section. Examples for JSON values: ```json theme={null} { "list_of_stuff": [ { "some_field": "value", "other_field": "other value" }, { "something": "value1", "something_else": "value2" } ] } ``` ### Dropdown List This is a variable value that is configured with a predefined set of options that you can select as a value. This allows you to govern your specific variable with a dropdown of available options that any other organization or user can select from. Dropdown List variables can be re-selected in lesser scopes but can be configured (aka add/remove options) only in their original scope. To add/remove options of a Dropdown List variable: 1. Add a new Dropdown List variable. 2. Click on its value input and a new select dropdown will be opened. 3. To add an option, type the desired option and click + Add Option button on the opened select's footer. 4. To remove an existing option,click the Trash icon next to the relevant option. 5. Don't forget to hit the save button to commit your changes. ![Dropdown List variable editor showing options to add or remove predefined values](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/2709a2f-screen_shot_2020-11-05_at_17.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=c292819030947f7179f70d48a62e1203) ### Multi Select List A Multi Select List works like a [Dropdown List](#dropdown-list), but you can select more than one option. You add and remove options the same way, and only in the scope where the variable was created. The selected options reach your run in a different form for each variable type: * **Terraform Variables**: for Terraform, OpenTofu, and Terragrunt templates, env zero passes the selection as a list of strings. Declare the variable as `list(string)` or `set(string)`. * **Environment Variables**: the value is a JSON array string, for example `["us-east-1","eu-west-1"]`. ```hcl variables.tf theme={null} variable "regions" { type = list(string) } ``` A Multi Select List variable cannot be sensitive. > [!NOTE] > > **Self-hosted agents**: Multi Select List variables require agent v4.2.0 or later. ## Variable Settings You can configure advanced settings for every variable in our system by opening the advanced settings form -\ The rightmost icon in the variable line. ### Required Variable This setting means that you can't start deployment without first setting a value for this variable. In higher scopes (Organization, Template, Project), "Required" variables can be set without a value. The user will be required to enter a value before a deployment. A required [Multi Select List](#multi-select-list) is the exception: it needs at least one selected option in every scope. ### Read Only Variable This setting means you locked this variable for all lower scopes. When configured, none of the lower scopes can override it. Here's a good example of using this setting: When the organization admin wants to enforce using the same stage and identifier for all environments in the organization, the admin can enable it and no one can override it or delete it. ### Regular Expression Validation (only for Free Text variables) You can define a regular expression that value should match. If you set the regular expression in upper scope, you can keep the value empty - the validation will be enforced in lower scope. ### Variables Description Variables have an optional description that is editable only at the scope in which they are created, and viewable in lower scopes. Unlike values, the description cannot be overridden. ![Variables description interface](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables_description_interface.gif?s=b77c3efbb736a1c0c3d36f4635c758bb) ## Load Variables From Terraform Code On a Terraform Variables scope, clicking on Load Variables From Code will load the variables from your Terraform code directory. All will be at default values. Loaded variables are not saved until you click **Save**. > [!TIP] > > **Complex value** > > All the default complex values will be loaded by env zero JSON format. You will be able to edit them as JSON files. > [!WARNING] > > A variable with `default = null` loads with an empty value, so Terraform receives `""` instead of `null`. An untyped variable or one of type `string`, `number`, or `bool` loads as Free Text. A `list`, `map`, or `object` variable loads as JSON Format. To keep `null`, change the variable to HCL Format and either enter `null` or leave the value empty. See [Pass null](#pass-null). ![Variables page with Load Variables From Code button to populate variables from the Terraform configuration](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/4a2ecce-screen_shot_2021-11-23_at_13.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=2f189e4d640b38819e4cb861c0d469ee) ## Secrets For security reasons, some variables needed for flow execution should not be exposed to user executing flows. This is known as Secrets Management. The most common use case for secrets management is cloud credentials. In env zero, secrets are variables that are marked as sensitive. A sensitive variable has its value masked after you save it. To change an existing sensitive variable, click on the masked value to clear it, type in the new secret value, and then click save. Like other variables, secrets are inherited and can be defined in any scope. > [!NOTE] > > **Secrets in a Self-Hosted Agent** > > If your organization manages self-hosted agents, you can control whether users are allowed to store sensitive data within env zero by the [policy](/guides/policies-governance/allow-env0-secrets). > > Additionally, you can reference a variable from an external secret manager in one of the following ways: > > 1. [AWS Secret Manager](https://aws.amazon.com/secrets-manager/) > 2. [GCP Secret Manager](https://cloud.google.com/secret-manager) > 3. [Azure Key Vault](https://azure.microsoft.com/en-us/services/key-vault/) > 4. [HashiCorp Vault](https://www.vaultproject.io/) > 5. [OCI Vault](https://docs.oracle.com/en-us/iaas/Content/KeyManagement/home.htm) > > You can read more on how to configure it [here](/guides/admin-guide/self-hosted-kubernetes-agent/self-hosted-kubernetes-agent#sensitive-secrets) ![External secret manager configuration options for AWS, GCP, Azure, HashiCorp Vault, and OCI](https://mintcdn.com/envzero-b61043c8/BZYthPtvpSdQtcKJ/images/guides/admin-guide/0cf2d536fe81d6cfa0fdab855d5d24280ba6273b1fdfdc5c55e343a946aadd26-image.png?fit=max\&auto=format\&n=BZYthPtvpSdQtcKJ\&q=85\&s=858a79a3f453585ed888ee38422fb018) ## Manage Variables To manage variables at the organization scope, select the Variables tab on the main screen. This shows a list of the organization's Environment Variables and Terraform Variables. You can edit their names or values, and add new ones. Don't forget to save any changes before leaving the page, or they will be lost. To manage variables at the Template level, go to the Template tab and select the template you are interested in. Click Settings, then select the Variable tab. Here you can modify variables for the template. At the environment level, you can set the variables just before deployment. When you create a new environment or redeploy, you’ll get a pop-up with environment details to fill in. Select the Variable section and modify the variables for that specific environment. For an environment that already exists, you edit the variables settings by redeploying (or queuing) a new deployment or under the Variables section (the latter can only be done if the environment has no running deployment). > [!NOTE] > > **Note** > > * Changes to variables in a higher scope will change the variables in all inheriting scopes. > > * Changes to variables in an existing environment will not take effect until the environment is redeployed. When env zero runs a deployment, it stores the variable names to be used in undeploy so changes for an Active environment will not affect the destroy process. > > * If a user does not have the RUN APPLY permission (like in the Planner project role), any variable changes they make when running a plan, will only be saved to the environment if the plan is approved. If the plan is canceled or the deployment fails, the proposed variable changes will not be saved. For a user with RUN APPLY permission, changes will be saved once the deployment is queued. ## Variable Precedence When using a combination of `TF_VAR_*` and `ENV0_TERRAFORM_CONFIG_FILE_PATH` option as described [here](/guides/admin-guide/additional-controls/#custom-terraform-variables-file), and with Terraform Variables in the UI, you might wonder which variable will actually be used. At run time, env zero writes the Terraform Variables you set in the UI to `env0.auto.tfvars.json`, and those in HCL Format to `env0.auto.tfvars`. `ENV0_TERRAFORM_CONFIG_FILE_PATH` uses the `-var-file` flag for plan and apply. With this information, along with the [Variable Definition Precedence](https://opentofu.org/docs/language/values/variables/#variable-definition-precedence), essentially this will be the order of precedence, with later sources taking precedence over earlier ones: * Environment Variables: `TF_VAR_*` * env zero UI Terraform Variables: `env0.auto.tfvars` and `env0.auto.tfvars.json` * variable files specified through `ENV0_TERRAFORM_CONFIG_FILE_PATH` If you also use Custom Flow to manage variables, then you could create your own `auto.tfvars` and make sure it is named **alphabetically** ahead or behind `env0.auto.tfvars.json` if you want your values to get overwritten by env zero or override env zero, respectively. For example, if you created a file `acme.auto.tfvars.json`, variables would get overwritten by env zero's UI tf vars. ## Ansible Variables Currently, there's no way to set Ansible variables via the UI.\ However, you can set Ansible variables by setting any environment variable prefixed by `ANSIBLE_VAR_`. Any variable added to that prefixed would be parsed and added to the `--extra-vars` flag. More about it [here](/guides/admin-guide/templates/ansible/#setting-extra-variables). ## Next steps * [Set variables on your first template](/guides/getting-started/create-your-first-template) * [Pass one environment's outputs into another](/guides/admin-guide/variables/environment-outputs) as input variables * [Configure variables for workflow sub-environments](/guides/admin-guide/variables/workflow-variables), if you deploy with workflows # Manage access tokens Source: https://docs.envzero.com/guides/admin-guide/variables/access-tokens Add and manage HTTP/S access tokens for private VCS repository access in env zero, covering GitHub, GitLab, and Bitbucket app password authentication. env zero can use HTTP/S Access tokens (aka Git Tokens) to access your infrastructure as code [templates](/guides/admin-guide/templates) stored in private git repositories. ## Adding a New Access Token 1. Enter your organization's settings, and go to the **Credentials** tab 2. In the **Git Tokens** section, click **+ Add Token** 3. Choose any name that will help you recognize this token in the future. 4. Enter the token value in the `Value` text box. 5. Click **Add** ## Generating Access Tokens Generate an access token is done in your VCS. This is vendor-specific and you can find further instructions here - * Github - [Personal access tokens](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line) * Gitlab - [Personal access tokens](https://docs.gitlab.com/ee/user/profile/personal_access_tokens) * Bitbucket - [App Passwords](https://confluence.atlassian.com/bitbucket/app-passwords-828781300.html) ## Next steps To pass Terraform and environment variables to deployments from these repositories, see [Managing variables](/guides/admin-guide/variables). # Handling common errors Source: https://docs.envzero.com/guides/admin-guide/variables/common-errors Troubleshoot common Terraform variable errors in env zero, including TF_VAR formatting for list and map types and sensitive variable configuration issues. ## "The root module input variable '\[variable\_name]' is not set, and has no default value" or "Error: Variables not allowed" This is commonly associated with using `TF_VAR_*` where the variable type is a list or map. Please make sure the value is properly formatted for the variable type. `list` type expects an array with quotes around the list item. e.g., `["listitem1", "listitem2"]` `map` type expects a key/value map surrounded curly brackets. e.g., `{"key1": "value1", "key2": "value2"}` ## "Error: Incorrect attribute value type" This can occur if your template variables do not specify the type and you are trying to assign the value in the [Environment Variables](/guides/admin-guide/variables#terraform-variables-and-environment-variables) section. e.g. > [!NOTE] > > ```bash theme={null} > export TF_VAR_myvar='["listitem1","listitem2"]' > ``` > > ```hcl theme={null} > variable "myvar" { > type = list(string) // make sure you add this field to your variable > } > ``` ## "Got a multi-select variable that failed deserialization: \[variable\_name]" The stored value of a [Multi Select List](/guides/admin-guide/variables#multi-select-list) variable is not a JSON array. This can happen when the value was set through the API. To fix it, select the options again in the UI and save, or set the value through the API as a JSON array string, for example `["option1","option2"]`. # Working with environment outputs Source: https://docs.envzero.com/guides/admin-guide/variables/environment-outputs Export and share environment outputs like VPC IDs and endpoints across env zero environments as input variables for Terraform, Pulumi, and CloudFormation. Environment Outputs let you export data generated by **OpenTofu/Terraform/Terragrunt/Pulumi/CloudFormation** environments and use it as input variables in other environments. This is useful for sharing configuration values like VPC IDs, database endpoints, or security group IDs across your infrastructure. > [!NOTE] > > **Environment Outputs Consumers** > > Any environment - no matter the IaC type - can consume environment outputs. > > The list above names which IaC framework environment outputs can be exported. > [!WARNING] > > Self-Hosted Agent Support > > * Environment Outputs are ***not*** supported for self hosted agents prior to version `3.0.724` > * Re-installation of the agent necessitates using the **same** encryption key: `environmentOutputEncryptionKey`(see below for details) > * **Outputs between different agents** can be supported by using the **same** `environmentOutputEncryptionKey` > * Outputs between Self-hosted agents and SaaS agent are not supported. ## Environment Outputs Activation To activate exporting Environment Outputs, a Project Admin must enable this feature within the project settings. This action necessitates opting in, signifying acknowledgment that env zero will store encrypted sensitive outputs on its platform. To opt in, navigate to the **Policies** tab within the project settings and locate the **Environment Outputs** checkbox. > [!NOTE] > > Note > > Environment Outputs are not consumable right after enabling the **Environment Outputs** policy. > > For an Environment's Outputs to be consumable, it needs to be deployed at least once after the policy is enabled. ### Self-Hosted Agents Activation When employing a self-hosted agent, sensitive outputs undergo encryption using a key independent of env zero ownership. This approach ensures end-to-end encryption of sensitive values, thereby bolstering security measures to their fullest extent. The encryption key should be provided by the `environmentOutputEncryptionKey` helm value. See our [Self-Hosted Agent - optional configuration](/guides/admin-guide/self-hosted-kubernetes-agent/custom-optional-configuration) for how to configure your agent. ## Access Restriction env zero supports restricting access to Environment Outputs, each Environment can configure which Projects can access its outputs inside the "Settings" Tab. If you don't want any access restrictions - select the "All environments in the organization" option. ![Environment Outputs access restriction settings showing project selection options](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/b08a213-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=fe1fa2fb2be3fd38f6d34dea4488b00f) By default, the outputs of every Environment are accessible to all Environments inside your organization until configured otherwise. ## Using Environment Outputs Environment Outputs are accessible as inputs for other environments. To use this functionality, add a variable of type "Environment Output," following the example below: ![Environment Outputs Variable Selection](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/environment_outputs_variable_selection.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=f20b1be0f8319cdfb02b4184f57413d0) Environment Outputs Variable Selection > [!NOTE] > > **Good to Know** > > * To utilize an output of an environment, the environment must be deployed initially for env zero to capture and store the output. In workflows, you can use the free-type option to specify output names for sub-environments that haven't been deployed yet. See [Using in Workflows](#using-in-workflows) below. > * Environment Output variables are exclusively accessible within Environment and Project scopes. > * Only **strings** are supported at this time. See the example below for working with maps and lists. After adding the new variable to the list, you can select the relevant Environment Output by clicking the edit (pencil) button and selecting the relevant Environment/Sub-Environment Alias and Output Name: ![The value of an Environment Output Variable](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/the_value_of_an_environment_output_variable.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=dd56adbbb9377bfd6a20ce7e6aab45e5) The value of an Environment Output Variable ### Outputting Complex Types in Terraform Currently, **only string variable types are supported by Environment Outputs**. This is partially to ensure interoperability between other frameworks (such as passing a TF variable to an Helm chart). So if your terraform code is outputting a map or a list, use `jsonencode()`to first convert the value to a string format. See example: ```hcl theme={null} locals { tags = {"foo": "bar"} } # instead of this # output "tags" { # value = local.tags # } # do this output "tags" { value = jsonencode(local.tags) } ``` > [!NOTE] > > **No changes needed on the input variable`type=list() or map()`** > > Since Terraform allows input variables to be defined as strings with the proper JSON format, you don't need to make any additional changes to your input definition. ### Using in Workflows Environment Outputs are especially useful in [Workflows](/guides/admin-guide/workflows) for passing data between sub-environments. For example, a networking stack can output a VPC ID that a compute stack consumes as an input variable. There are two ways to configure output-to-variable mappings in workflows: #### Configuring at the Template Level (Recommended) For reusable workflows and self-service scenarios, configure Environment Output variables directly on the workflow template. This pre-configures the mappings so end-users deploying the workflow do not need to set anything up. For step-by-step instructions, see [Passing Outputs Between Sub-Environments](/guides/admin-guide/variables/workflow-variables#passing-outputs-between-sub-environments). #### Configuring at Deploy Time You can also configure output-to-variable mappings on the workflow deploy page: **1. Select the Sub-Environment** On the workflow deploy page, select the sub-environment that needs to **receive** the output. ![Workflow deploy page with sub-environment selector for configuring variable inputs](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/9457df8-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=63cbbb4429ff5002cefa855139fcc208) **2. Add an Environment Output Variable** In the **Variables** section, add a new variable of type **Environment Output** (same as described above). **3. Select the Output Source** Click the edit button. In the modal, you will see a **Sub-Environment Aliases** section listing the aliases from your workflow file. Select the source sub-environment. ![Sub-Environment Aliases modal showing source sub-environment selection for environment output](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/e8de86b-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=dcc2c08b22ab3cf7ae80b7617465838d) **4. Select or Type the Output Name** Select an output from the dropdown. If the source sub-environment has never been deployed, you can free-type the expected output name. ![Output name dropdown with available outputs from the selected source sub-environment](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/8483581-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=f1eb6465b463a071f502e85eb37a0abb) **5. Save and Deploy** Click **Save** and continue with the deployment. > [!NOTE] > > On the first deployment of a workflow, outputs from sub-environments that haven't been deployed yet won't appear in the dropdown. Use the free-type option to enter the expected output name. env zero resolves outputs in dependency order based on the `needs` configuration in your workflow file. ## Next steps To limit which projects can read an environment's full remote state, not only its outputs, see [Configuring state access control](/guides/admin-guide/remote-backend/state-access-control). # Managing SSH keys Source: https://docs.envzero.com/guides/admin-guide/variables/ssh-keys Add and manage SSH keys at organization and project level in env zero for secure Git repository access with GitHub, GitLab, and Bitbucket setup. ## Add a new SSH Key to your Organization To create a new SSH key in your *organization* scope, go to your organization's **Settings** page and select the **SSH Keys** tab. The "SSH Keys" screen shows your existing SSH keys that are associated with your organization. The table shows the SSH key name in your organization and the user who initially created this key. To create a new SSH key for your organization, 1. Enter your **Organization Settings** page, and go to the **SSH Keys** tab 2. Click **+ Add SSH Key** 3. Choose any name that will help you recognize this key in the future and enter it in the `Name` field 4. Paste the private key you generated in step 1, into the `SSH Key Value` box. 5. Click **Add SSH Key** Generating SSH keys is vendor-specific and you can read more about this here - * Github - [Adding a new SSH key to your GitHub account](https://help.github.com/en/github/authenticating-to-github/adding-a-new-ssh-key-to-your-github-account) * Gitlab - [Create and add your SSH key pair](https://docs.gitlab.com/ee/ssh/index.html#generate-an-ssh-key-pair) * Bitbucket - [Set up an SSH key](https://confluence.atlassian.com/bitbucket/set-up-ssh-for-git-728138079.html) ## Associate an existing SSH Key with your Template After creating an SSH Key in your organization, you can now associate this key with your *[template](/guides/admin-guide/templates)*. The *[environment](/guides/admin-guide/environments)* created from that *template* would be able to use its associated keys during its run to establish SSH connectivity. To associate a key with a template: 1. Go to the organization's **Templates** page. 2. Click the **Settings** button of your desired Template. 3. The **Template Settings** screen includes an `SSH Keys` dropdown. Associate your desired SSH key with your template 4. Click the **Save** button to commit your changes. ![Template Settings screen showing the SSH Keys dropdown for associating a key with a template](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/24d9257-template_settings.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=2197e29bc54fa31d1b7a8a5c9bcd31e1) ## Associate an existing SSH Key with your VCS Environment The steps are similar to the template association, but to modify the environment, click on the kebab menu placed at the top right corner of the environment page. ## Next steps Once the template can clone its repository, [set the variables](/guides/admin-guide/variables) its deployments need. # Using variable sets Source: https://docs.envzero.com/guides/admin-guide/variables/variable-sets Group related variables into reusable sets and assign them to organizations, projects, templates, or environments in env zero for consistent configuration. Variable Sets offer a convenient solution for organizing frequently used or closely related variables into cohesive groups. These groups can then be linked to an entire Organization or to specific Projects, Templates, Workflows, or Environments that require access to their values. Overall, Variable Sets can be used to store an important configuration as a single unit. For instance, you might create a Set named "RDS Settings," encompassing the default and commonly used values of your RDS instances and assign it to all of the environments that manage RDS instances. This approach ensures variables are defined once and utilized only where needed, promoting efficiency and consistency across your workflows. ## View Variables Sets Variable Sets can be defined within one of two scopes: * Organization: Sets created at this level are available for assignment to any entity within env zero, including that same Organization or all Projects, Templates, Workflows, and Environments. * Project: Sets created within a specific Project can be assigned to any sub-entity of that Project, such as sub Projects, Workflows, or Environments. To view your Variable Sets, navigate to the 'Variables' section in the navigation menu, either within the Organization or Project context, and then click on the 'SETS' tab. ![Variable Sets list in the SETS tab showing existing sets within the organization or project context](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/2b4e1d7-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=9f3bd12418c881ff0a5d3fd1b457e175) ## Create a Variable Set Variable Sets can be created on two scopes: Organization and Project. To create a new Variable Set, follow these steps: Click on the 'CREATE NEW SET' button located in the upper right corner. This action will open a modal window. In the modal window, proceed through two steps: 1. Define the Set's name and provide an optional description. 2. Define the variables within the Set. ![Create Variable Set modal with fields for set name, description, and variable definitions](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/2f06bfa-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=bb254776d6b6dd17b87b8fb2eb7710e8) ## Assign a Variable Set Assigning a Variable Set can be done on multiple levels – Organization/Project/Template/Workflow/Environment. The variables table for any of the mentioned entities contains a selector that allows you to mark the sets you would like to use. ![Variables table with a Variable Set selector showing sets available to assign to this entity](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/8a94e2a-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=448c7c6ea22aa1f0b539f6458385a76f) ## Override Set's Variables Similar to any other variable in env zero, you can override the variables within a Variable Set. ![Variable set with an overridden variable value shown inline in the variables table](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/7edd479-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=04c55ad2fb2a22325513f4d4fe132bb7) ## Precedence and conflicts A variable set ranks at the scope it's assigned to, not the scope it was created in. A set assigned to a project ranks as a project variable, and a set assigned to an environment ranks as an environment variable. For the order of scopes, see [Precedence across scopes](/guides/admin-guide/variables#precedence-across-scopes). Within one scope, a variable defined directly on the scope wins over the same variable from a set assigned to that scope. To override a value that comes from a set, set the variable directly on the environment. Overriding with a second set doesn't work, because two sets can't define the same variable (see [Same variable in two sets](#same-variable-in-two-sets)). The only set variables you can't override are [read-only](/guides/admin-guide/variables#read-only-variable) ones. Mark a variable as read-only when lower scopes must not change it. With the [Terraform provider](/guides/community-and-resources/support-and-help/terraform-provider), set `is_read_only = true` on the variable in [`env0_variable_set`](https://registry.terraform.io/providers/env0/env0/latest/docs/resources/variable_set), then assign the set to a scope with [`env0_variable_set_assignment`](https://registry.terraform.io/providers/env0/env0/latest/docs/resources/variable_set_assignment): ```hcl theme={null} resource "env0_variable_set" "platform_baseline" { name = "platform-baseline" variable { name = "cost_center" value = "platform" type = "terraform" is_read_only = true } } resource "env0_variable_set_assignment" "platform_baseline" { scope = "project" scope_id = var.project_id set_ids = [env0_variable_set.platform_baseline.id] } ``` ### Example An organization admin assigns the set `platform-baseline` to the organization. A project and an environment then set some of the same variables directly: | Variable | `platform-baseline` set (organization) | Project `payments` | Environment `payments-prod` | Value used in `payments-prod` | | - | - | - | - | - | | `region` | `us-east-1` | | | `us-east-1` | | `instance_type` | `t3.small` | `t3.medium` | `m5.large` | `m5.large` | | `cost_center` | `platform` (read-only) | | `payments` | `platform` | * `instance_type`: the environment is the most specific scope, so its value wins. * `cost_center`: the set marks it read-only, so the environment's value is ignored. If you then assign `payments-prod` a second set that also defines `instance_type`, env zero rejects the assignment, because `platform-baseline` already defines it. ### Same variable in two sets Two variable sets that apply to the same environment can't define a variable with the same name and type. A Terraform variable and an environment variable with the same name don't conflict. * When you assign a set, env zero rejects the assignment with `Set has conflicts with already assigned configurations` if a set already assigned to that scope or a higher scope defines the same variable. * When you assign two sets in the same save and they define the same variable, env zero rejects it with `A Set has conflicts with another assigned set`. * If conflicting sets still apply to an environment, for example because a variable was added to a set after it was assigned, the deployment fails with `Configuration properties with the same name and type are not allowed`. Setting the variable directly on the environment doesn't resolve this. To fix a conflict, rename the variable in one of the sets, or keep the variable in one set and remove it from the other. ### Coming from Terraform Cloud Variable sets in HCP Terraform (Terraform Cloud) resolve some cases differently: * HCP Terraform allows two variable sets at the same level to define the same variable, and uses the value from the set whose name sorts first. env zero rejects the assignment or fails the deployment instead. * HCP Terraform priority variable sets override workspace variables. env zero has no priority sets. To stop lower scopes from overriding a value, mark the variable as read-only. * In HCP Terraform, a variable defined directly on the workspace wins over non-priority variable sets. In env zero, a variable defined directly on the environment wins over variable sets, unless a set or a higher scope marks the variable as read-only. ## Next steps * [Share output values across environments](/guides/admin-guide/variables/environment-outputs) as input variables * [Use these variables in custom flow steps](/guides/admin-guide/custom-flows) # Managing workflow variables Source: https://docs.envzero.com/guides/admin-guide/variables/workflow-variables Configure variables for workflow sub-environments at the template level in env zero, including output passing between stacks and self-service defaults. You can configure variables for your workflow by setting them on the workflow template. This includes configuring variables for each sub-environment's template, so default values are applied automatically every time the workflow is deployed. This is useful for self-service scenarios where end-users should not need to configure variables manually. ## Setting Variables on Sub-Environment Templates In the workflow template wizard, under the Variables step, env zero loads the workflow file and displays the sub-environment templates. Select the sub-environment you want to configure. ![Workflow template wizard showing sub-environment template selection](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/8be79d5bb384f57ceba95ed861daf9095259f748c89db77a45a4e57dc3cc3b96-screenshot_2025-05-25_at_15.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=60be3b1d87c404f44e5b65d614273b58) Once you add a variable to a sub-environment template, it appears with a **Workflow Template** scope badge, indicating it was configured at the template level. ![Variable with Workflow Template scope badge](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/94417cc73f51e4df22ccc0038ba0c30c901f894f858a37f8a165abbd80cd70c1-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=9f5ebe7fd89d3c35b436448a7e54f648) ## Passing Outputs Between Sub-Environments A common pattern in workflows is passing data from one sub-environment to another. For example, a networking stack might output a VPC ID that a compute stack needs as an input variable. You can configure this at the template level using **Environment Output** variables, so the output-to-variable mapping is pre-configured and applied automatically on every deployment. > [!NOTE] > > **Prerequisites** > > * [Environment Outputs](/guides/admin-guide/variables/environment-outputs) must be enabled in the project's Policies settings. > * The consuming sub-environment must list the source sub-environment in its `needs` field in the workflow file, so the source deploys first. **1. Open the Workflow Template Wizard** Navigate to the workflow template and open the settings wizard. Go to the **Variables** step. **2. Select the Consuming Sub-Environment** From the sub-environment list, select the sub-environment that needs to **receive** the output (the one that depends on another sub-environment). **3. Add an Environment Output Variable** Click **Add Variable**, set the type to **Environment Output**, and enter the variable key (the Terraform/environment variable name you want to populate). **4. Configure the Output Source** Click the edit (pencil) button on the variable value. In the modal, you will see a **Sub-Environment Aliases** section listing the aliases from your workflow file. Select the alias of the sub-environment whose output you want to consume. ![Sub-Environment Aliases modal for selecting the source sub-environment whose output to consume](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/e8de86b-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=dcc2c08b22ab3cf7ae80b7617465838d) **5. Select or Type the Output Name** If the source sub-environment has been deployed before, select from the dropdown of available outputs. If it has not been deployed yet, you can free-type the expected output name. ![Output name dropdown showing available outputs from the selected source sub-environment](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/variables/8483581-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=f1eb6465b463a071f502e85eb37a0abb) **6. Save** Click **Save**. The variable is now configured at the template level and will be resolved automatically on each deployment. ### First Deployment Considerations > [!WARNING] > > Environment Outputs from a sub-environment are only available after that sub-environment has been deployed at least once. On the first deployment of a workflow, outputs won't appear in the dropdown. > > Use the **free-type** option to enter the expected output name manually. Because the `needs` field in your workflow file controls deployment order, the source sub-environment will deploy before the consuming one, and the output will be available by the time it is needed. ### Configuring at Deploy Time You can also configure output-to-variable mappings at deploy time on the workflow deploy page. For step-by-step instructions, see [Using Environment Outputs in Workflows](/guides/admin-guide/variables/environment-outputs/#using-in-workflows). ## Cross-Environment Outputs In addition to referencing outputs from sub-environments within the same workflow, you can reference outputs from any deployed environment in your organization. When configuring the output source, select the environment by its ID instead of a sub-environment alias. Learn more: [Environment Outputs](/guides/admin-guide/variables/environment-outputs) ## Code-Based Configuration (Import Variable Plugin) The steps above configure output mappings through the env zero UI. For teams that prefer a **code-driven / GitOps approach** where variable configurations are version-controlled, the [Import Variable Plugin](/guides/integrations/plugins/import-variable-plugin) allows you to define output-to-variable mappings in `env0.yaml` custom flows using the `${env0-workflow::}` syntax. > [!NOTE] > > The `${env0-workflow:...}` syntax is specific to the Import Variable Plugin and requires API key configuration. It is not part of the native Environment Outputs feature. For most users, the UI-based approach described above is recommended. > > You can also define Environment Output variables programmatically with the [`env0_environment_output_configuration_variable`](https://registry.terraform.io/providers/env0/env0/latest/docs/resources/environment_output_configuration_variable) resource in the [env zero Terraform provider](/guides/community-and-resources/support-and-help/terraform-provider). ## Next steps * [Create a workflow](/guides/admin-guide/workflows/create-a-new-workflow) and define its sub-environment dependencies * [Group shared variables into a variable set](/guides/admin-guide/variables/variable-sets) # Workflow overview Source: https://docs.envzero.com/guides/admin-guide/workflows Orchestrate multi-environment deployments with dependency management using env zero workflows, defined declaratively in env0.workflow.yaml for pipelines. ## What is a Workflow? env zero Workflows provide a structured approach to managing groups of related environments by defining their dependencies and orchestrating the entire process. env zero ensures that all dependencies are satisfied and the Workflow runs smoothly from start to finish. This is especially useful for managing systems divided into multiple subsystems – allowing you to oversee the entire system as a cohesive unit while retaining control over individual stacks. It also simplifies the process of breaking down IaC stacks into smaller, more manageable parts. Workflows are defined declaratively through a Workflow configuration YAML file (`env0.workflow.yaml` or `.yml`) and are designed to be reused as templates. The environments within a Workflow are also based on these reusable templates, promoting consistency and efficiency. Learn more: [Workflow file reference](/guides/admin-guide/workflows/workflow-file-reference) ## When Should You Use Workflows? The infrastructure of a production app consists of many different resources. The more resources there are, the more thought and effort is required to manage and deploy them. We tend to view managing resources as we do code - split them into smaller manageable pieces ([Environments](/guides/admin-guide/environments)) where each piece is cohesive and loosely coupled. In theory, this textbook solution sounds great because each Environment is independent and can be deployed at any time. The thing is, in the real world we have dependencies, and deploying all these Environments simultaneously is impractical. ## Basic Dependency Example ![Workflow example diagram showing environment dependencies and execution flow](https://mintcdn.com/envzero-b61043c8/pcx_nh6zT3at7dYL/images/guides/admin-guide/a_workflow_example.png?fit=max\&auto=format\&n=pcx_nh6zT3at7dYL\&q=85\&s=a22f0937caca6b00efe7dda3d26f63bf) A Workflow example Environment Network and VPC manages all necessary network configurations. Environment DB manages a database that multiple services use. Environment EKS manages the Elastic Kubernetes Service onto which pods of services will be deployed. Environments Billing Service, Configuration Service, and Notification Service all manage the deployments of services on EKS. These services need access to the database. For this use case: * Environment DB depends on the VPC from the Network and VPC IaC stack * Environment EKS also depends on the VPC from the Network and VPC IaC stack * All service environments depend on DB and EKS As you can see, these dependencies make it impossible for all the Environments to be deployed simultaneously. As the resources and Environments grow, the complexity of the dependencies will increase. Workflows will help you manage and deploy your environments with their dependencies. ## Workflow Environment Status A Workflow Environment can be in one of the following states: *Active* - All sub-environments have been successfully deployed and are up and running.\ *Inactive* - All sub-environments have been successfully destroyed, manually or automatically.\ *Deploy in progress* - Currently being deployed.\ *Destroy in progress*- Currently being destroyed.\ *Failed* - Errors were encountered during deployment in at least 1 sub-environment > [!TIP] > > **Workflow Benefits** > > 1. Manage your entire infrastructure with complex dependencies between Environments > 2. Visual presentation of the complex deployment > 3. Each Environment can use a different IaC tool – one Environment can be managed by Terraform while another is managed by K8S > 4. Enhanced experience from all surrounding env zero features such as [Policies](/guides/policies-governance/policies), [Custom flows](/guides/admin-guide/custom-flows), [Drift Detection](/guides/admin-guide/environments/drift-detection) and [Continuous Deployment](/guides/admin-guide/environments/continuous-deployment) ## Environment Variables If you'd like to pass [Environment Variables](/guides/admin-guide/variables) to all IaC stacks in the workflow. To do that, add or edit Environment variables when deploying the workflow. If you'd like to set some specific Environment variable for a specific Environment in the workflow, you'd have to redeploy that specific Environment and add/edit that Environment variable ## Passing Outputs Between Sub-Environments Workflows often require data from one sub-environment to be used as input in another. For example, a networking stack might output a VPC ID that a compute stack needs as an input variable. env zero supports this through [Environment Outputs](/guides/admin-guide/variables/environment-outputs). You can configure output-to-variable mappings at the workflow template level so they are automatically applied on every deployment. Learn more: [Managing workflow variables](/guides/admin-guide/variables/workflow-variables#passing-outputs-between-sub-environments) ## Next steps To write your first `env0.workflow.yaml` file and deploy it, follow [Creating a new workflow](/guides/admin-guide/workflows/create-a-new-workflow). # Creating a new workflow Source: https://docs.envzero.com/guides/admin-guide/workflows/create-a-new-workflow Create an env zero workflow using env0.workflow.yaml, covering dependency definitions, approval priority order, and multi-environment workflow setup. To set up a Workflow, follow these steps: env zero relies on a file named **env0.workflow\.yaml** (or **env0.workflow\.yml**) to describe the dependencies and configuration of the sub-environments in your workflow. For the complete schema reference, see [Workflow file reference](/guides/admin-guide/workflows/workflow-file-reference). ## Approval Priority Order When multiple approval settings exist, approvals are evaluated in the following priority: 1. [ENV0\_REQUIRES\_APPROVAL](/guides/admin-guide/custom-flows/#forcing-manual-approvals) environment variable 2. Approval policy (always evaluated if defined) 3. Value from the UI or API request 4. Value from the workflow `requiresApproval` field 5. The sub-environment's saved approval setting, which env zero updates from the result of steps 3 and 4 on every deploy or destroy run, and on create. If you also manage the workflow environment with the Terraform provider, see [Terraform provider settings for sub-environments](/guides/admin-guide/workflows/terraform-provider-sub-environment-settings) for which configuration surface wins for each setting. If the project has [Skip apply when plan has no changes](/guides/policies-governance/deployment-controls#skip-apply-when-plan-has-no-changes) enabled, a sub-environment whose plan reports no resource changes finishes without waiting for approval, including when a custom flow set `ENV0_REQUIRES_APPROVAL=true`. An approval policy returning a pending result still holds the sub-environment for approval. ## Example Configuration ```yaml env0.workflow.yaml theme={null} environments: vpc: name: "VPC and Network" templateName: "VPC" db: name: "Database" templateName: "DB" requiresApproval: true needs: - vpc eks: name: "EKS Cluster" templateName: "EKS" needs: - vpc billing-service: name: "Billing Service" vcs: type: terraform terraformVersion: "1.5.7" repository: "https://github.com/env0/templates" path: "aws/hello-world" githubInstallationId: 123456789 disabled: ${DISABLE_BILLING_SERVICE} needs: - db - eks config-service: name: "Configuration Service" templateName: "Configuration Service" revision: feature-branch disabled: ${DISABLE_CONFIG_SERVICE} needs: - db - eks ``` ### Using Environment Variables in Workflow Fields You can use `${...}` syntax to interpolate environment variables into workflow fields. In the example above: * `DISABLE_BILLING_SERVICE` controls whether the `billing-service` environment is disabled. * `DISABLE_CONFIG_SERVICE` controls whether the `config-service` environment is disabled. When these variables are set to `true` (for example, in your environment or via env zero variables), the corresponding sub-environment is skipped during deployment. ## Environment Removal Strategy By default, removing an environment from the workflow file leaves it detached but not destroyed. To automatically run a "destroy" process on environments that were removed from the workflow file, add `environmentRemovalStrategy: destroy` to your `settings` section. For example: ```yaml env0.workflow.yaml theme={null} settings: environmentRemovalStrategy: destroy environments: vpc: name: "VPC and Network" templateName: "VPC" ``` | Value | Behavior | | - | - | | `destroy` | Automatically destroy removed environments after deploying all environments | | `detach` | Detach removed environments without destroying them (default) | > [!WARNING] > > **Template Naming** > > While not enforced, use unique template names. Otherwise, the Workflow will randomly choose one of the templates without considering permission restrictions. ## Creating a Workflow in the UI 1. Create a [new template](/guides/admin-guide/templates) and select **env zero Workflow** as the Template Type: ![Template creation screen with env zero Workflow selected as the Template Type](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/workflows/7e4b205-screen_shot_2022-06-08_at_16.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=031d94c14169550423c5a8488d1a42ad) In the VCS step, fill in your VCS details and the directory that contains your **env0.workflow\.yaml** (or **env0.workflow\.yml**) file: ![VCS step in workflow template setup showing repository and workflow file directory fields](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/workflows/bec911f-screen_shot_2022-06-08_at_16.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=6779901470b6abd60d4ddbd07963c412) 2. Create an [Environment](/guides/admin-guide/environments/setting-up-a-new-environment) based on the Workflow template. You can choose any of the workflow environments from the dropdown menu in the top right corner. ![Workflow environment creation screen with sub-environment selector dropdown](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/workflows/9d4cf3b-screen_shot_2022-11-30_at_19.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=66e4e17f97aa5adb935589a49e42ed62) After choosing one of the workflow sub-environments, you can modify its variables, workspace, revision and auto-approval settings. > [!NOTE] > > Remote Backend > > The Remote Backend option applies to Terraform and OpenTofu sub-environments when env zero creates them. To enable it on an existing sub-environment, see [Enable Remote Backend on a workflow sub-environment](/guides/admin-guide/remote-backend#enable-remote-backend-on-a-workflow-sub-environment). For further documentation about remote backend, [follow this guide](/guides/admin-guide/remote-backend). > [!NOTE] > > Overrides Note > > The values you set here for workspace and revision will override the ones you've defined in the workflow file for the corresponding environment. > > If you would like to set the whole workflow to the same workspace name value, you can do so by setting the workflow workspace name, and leaving the sub environments blank. > > Note that since Terragrunt uses a working directory instead of workspace name, the workspace name override won't apply to Terragrunt template type. > > When marking the workflow as remote backend, you must provide unique names for each of the sub environments workspaces. ![Sub-environment configuration showing workspace, revision, and auto-approval override options](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/workflows/953934f-screen_shot_2022-12-21_at_11.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=f721bf284c6dfd90ceeed003a331e689) 3. Deploy ![Deploy button to start the workflow deployment after configuration is complete](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/workflows/de95a1c-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=c69abe44cab5e61f66d5b055360ae659) ## Next steps * [Redeploy or destroy a single sub-environment](/guides/admin-guide/workflows/workflow-partial-deployment) without running the whole workflow * [Pass outputs between sub-environments](/guides/admin-guide/variables/workflow-variables) with workflow variables # Terraform provider settings for sub-environments Source: https://docs.envzero.com/guides/admin-guide/workflows/terraform-provider-sub-environment-settings How sub_environment_configuration in the env zero Terraform provider interacts with env0.workflow.yaml: storage, which deployments honor it, and precedence. A workflow environment can be configured from two places: the `sub_environment_configuration` block of the [`env0_environment` resource](https://registry.terraform.io/providers/env0/env0/latest/docs/resources/environment) in the env zero Terraform provider, and the [`env0.workflow.yaml` file](/guides/admin-guide/workflows/workflow-file-reference). Settings that exist in both do not always behave the same way. ## Field reference | Field | Where the value is stored | Which deployments honor it | Which surface wins | | - | - | - | - | | `alias` | Not stored. Must match the key of the sub-environment under `environments` in the workflow file. | All | The workflow file defines the aliases. | | `approve_plan_automatically` | Every deployment that Terraform triggers saves it on the sub-environment as its approval setting, and so does create, even when `prevent_auto_deploy` is `true`. The provider does not read it back into state. | All, as the last fallback. See [How approval is resolved](#how-approval-is-resolved). | Terraform for the deployment it triggers, ahead of the workflow file. For every other deployment, its own request value when it sets one, then the workflow file when it sets `requiresApproval`, otherwise the saved setting. | | `configuration` | Environment-scoped variables on the sub-environment. The provider reads them back into state, so changes made in the UI or API show as drift, except the values of sensitive variables. The API redacts those, so the provider keeps the state value and a changed secret is not detected. | All | Terraform. The workflow file has no variables section. | | `workspace` | The sub-environment's workspace name, set once when env zero creates the sub-environment. | All | Terraform over the workflow file's `workspace`, at creation only. Changing it after creation does not change the workspace. It triggers a deployment unless `prevent_auto_deploy` is `true`. | | `revision` (deprecated) | Not stored. The provider sends it as an override for a single deployment. | Deployments that Terraform triggers only. | Terraform for the deployment it triggers. The workflow file's `revision` for every other deployment. Set `revision` in the workflow file instead. | | `id` | Computed. The sub-environment's environment ID. | n/a | n/a | ## 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](/guides/admin-guide/workflows/create-a-new-workflow#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..userRequiresApproval` field set a request value. VCS pushes and schedules do not. > [!WARNING] > > 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. ```hcl main.tf theme={null} resource "env0_environment" "workflow" { name = "my-workflow" project_id = "" template_id = "" sub_environment_configuration { alias = "kubernetes-cluster" approve_plan_automatically = false } } ``` ```yaml env0.workflow.yaml theme={null} environments: kubernetes-cluster: name: "Kubernetes Cluster" templateName: "eks" requiresApproval: true ``` ## 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. # Workflow file JSON schema Source: https://docs.envzero.com/guides/admin-guide/workflows/workflow-file-json-schema JSON Schema definition for validating and auto-completing env0.workflow.yaml files in your IDE, covering environments and sub-environment dependencies. Use this JSON Schema for IDE validation and auto-completion of [workflow files](/guides/admin-guide/workflows/workflow-file-reference) by referencing it in your editor configuration. ## JSON Schema ```json workflow-file.json theme={null} { "$schema": "http://json-schema.org/draft-07/schema#", "$id": "https://docs.envzero.com/schemas/workflow-file.json", "title": "env0 Workflow File", "description": "Schema for env0 workflow files that define multi-environment deployments. A workflow file allows you to orchestrate the deployment of multiple environments with dependencies between them.", "type": "object", "additionalProperties": false, "required": ["environments"], "properties": { "environments": { "type": "object", "description": "A map of sub-environments in the workflow. Each key is a unique alias for the sub-environment, and the value defines its configuration.", "additionalProperties": { "$ref": "#/definitions/SubEnvironment" } }, "settings": { "type": "object", "description": "Global workflow settings", "additionalProperties": false, "properties": { "environmentRemovalStrategy": { "type": "string", "description": "Determines what happens to sub-environments when they are removed from the workflow file. - destroy: The environment will be destroyed - detach: The environment will be detached but not destroyed", "enum": ["destroy", "detach"], "default": "detach" } } } }, "definitions": { "SubEnvironment": { "type": "object", "description": "Configuration for a sub-environment in the workflow", "additionalProperties": false, "required": ["name"], "properties": { "name": { "type": "string", "description": "The display name for this sub-environment. This name will be shown in the env0 UI." }, "templateName": { "type": "string", "description": "The name of an existing env0 template to use for this sub-environment. Use this when referencing a pre-configured template in your organization. Note: Either 'templateName' OR 'vcs' must be specified, but not both." }, "vcs": { "$ref": "#/definitions/VcsConfiguration", "description": "Inline VCS (Version Control System) configuration for this sub-environment. Use this to define the IaC source directly instead of referencing a template. Note: Either 'templateName' OR 'vcs' must be specified, but not both." }, "revision": { "type": "string", "description": "The git revision (branch, tag, or commit SHA) to use. If not specified, the default branch will be used." }, "workspace": { "type": "string", "description": "The Terraform/OpenTofu workspace name for this sub-environment. Useful for managing multiple instances of the same infrastructure." }, "needs": { "type": "array", "description": "List of sub-environment aliases that must be deployed before this one. Creates a dependency graph for deployment ordering.", "items": { "type": "string" } }, "requiresApproval": { "type": "boolean", "description": "If true, deployments of this sub-environment will require manual approval before proceeding. Useful for production environments.", "default": false }, "disabled": { "oneOf": [{ "type": "boolean" }, { "type": "string" }], "description": "If set to true or 'true', this sub-environment will be skipped during deployment. Useful for temporarily disabling parts of the workflow." } } }, "VcsConfiguration": { "type": "object", "description": "Inline VCS configuration for defining IaC source directly in the workflow file. This allows you to specify the repository, path, and IaC type without creating a separate template.", "additionalProperties": false, "required": ["repository", "type"], "properties": { "type": { "$ref": "#/definitions/IacType", "description": "The Infrastructure as Code type for this environment" }, "repository": { "type": "string", "description": "The git repository URL containing the IaC code. Supports HTTPS and SSH URLs." }, "revision": { "type": "string", "description": "The git revision (branch, tag, or commit) to use" }, "path": { "type": "string", "description": "The path within the repository where the IaC code is located. Use '/' or leave empty for the repository root.", "default": "" }, "terraformVersion": { "type": "string", "description": "The Terraform version to use. Can be: a specific version (e.g., '1.5.7') or 'RESOLVE_FROM_TERRAFORM_CODE' to auto-detect from required_version." }, "opentofuVersion": { "type": "string", "description": "The OpenTofu version to use. Can be a specific version (e.g., '1.6.0')." }, "terragruntVersion": { "type": "string", "description": "The Terragrunt version to use" }, "terragruntTfBinary": { "type": "string", "description": "The underlying IaC binary for Terragrunt to use", "enum": ["terraform", "opentofu"], "default": "terraform" }, "pulumiVersion": { "type": "string", "description": "The Pulumi version to use" }, "ansibleVersion": { "type": "string", "description": "The Ansible version to use" }, "fileName": { "type": "string", "description": "The CloudFormation template file name. Only used when type is 'cloudformation'." }, "helmChartName": { "type": "string", "description": "The Helm chart name (when using a Helm repository)" }, "isHelmRepository": { "type": "boolean", "description": "Set to true if the repository is a Helm chart repository", "default": false }, "tokenId": { "type": "string", "description": "The ID of a stored VCS token for authentication. Use this for private repositories with token-based auth." }, "tokenName": { "type": "string", "description": "The name of the VCS token (for reference)" }, "sshKeys": { "type": "array", "description": "SSH keys for repository authentication. Required for SSH-based repository URLs.", "items": { "$ref": "#/definitions/SshKey" } }, "githubInstallationId": { "oneOf": [{ "type": "number" }, { "type": "null" }], "description": "GitHub App installation ID for GitHub integration" }, "bitbucketClientKey": { "oneOf": [{ "type": "string" }, { "type": "null" }], "description": "Bitbucket client key for Bitbucket Cloud integration" }, "vcsConnectionId": { "oneOf": [{ "type": "string" }, { "type": "null" }], "description": "VCS connection ID for unified VCS integration" }, "isGitLab": { "type": "boolean", "description": "Set to true for GitLab.com repositories", "default": false }, "isGitLabEnterprise": { "type": "boolean", "description": "Set to true for GitLab Enterprise/self-hosted repositories", "default": false }, "isGitHubEnterprise": { "type": "boolean", "description": "Set to true for GitHub Enterprise repositories", "default": false }, "isBitbucketServer": { "type": "boolean", "description": "Set to true for Bitbucket Server/Data Center repositories", "default": false }, "isAzureDevOps": { "type": "boolean", "description": "Set to true for Azure DevOps repositories", "default": false } } }, "IacType": { "type": "string", "description": "Supported Infrastructure as Code types", "enum": [ "terraform", "opentofu", "terragrunt", "pulumi", "k8s", "cloudformation", "helm", "ansible" ] }, "SshKey": { "type": "object", "description": "SSH key reference for repository authentication", "additionalProperties": false, "required": ["id", "name"], "properties": { "id": { "type": "string", "minLength": 1, "description": "The unique identifier of the SSH key stored in env0" }, "name": { "type": "string", "description": "The display name of the SSH key" } } } }, "examples": [ { "environments": { "database": { "name": "PostgreSQL Database", "templateName": "aws-rds-postgres", "workspace": "production" }, "api": { "name": "API Service", "templateName": "kubernetes-deployment", "needs": ["database"], "requiresApproval": true } } }, { "environments": { "networking": { "name": "VPC and Networking", "vcs": { "type": "terraform", "repository": "https://github.com/myorg/infrastructure", "path": "terraform/networking", "terraformVersion": "1.5.7" } }, "compute": { "name": "EC2 Instances", "vcs": { "type": "terraform", "repository": "git@github.com:myorg/infrastructure.git", "path": "terraform/compute", "terraformVersion": "RESOLVE_FROM_TERRAFORM_CODE", "sshKeys": [{ "id": "ssh-key-123", "name": "Deploy Key" }] }, "needs": ["networking"] } } }, { "settings": { "environmentRemovalStrategy": "detach" }, "environments": { "infra": { "name": "Base Infrastructure", "templateName": "terraform-aws-base", "revision": "v2.0.0" }, "app": { "name": "Application", "vcs": { "type": "helm", "repository": "https://github.com/myorg/helm-charts", "path": "charts/myapp" }, "needs": ["infra"] }, "monitoring": { "name": "Monitoring Stack", "templateName": "prometheus-grafana", "needs": ["infra"], "disabled": false } } } ] } ``` # Workflow file reference Source: https://docs.envzero.com/guides/admin-guide/workflows/workflow-file-reference Complete reference for the env0.workflow.yaml file schema, covering environments, sub-environment dependencies, settings, and requiresApproval options. This page provides a complete reference for the `env0.workflow.yaml` (or `.yml`) file used to define env zero Workflows. ## File Structure The workflow file has two main sections: * **`environments`** (required) - Defines the sub-environments in the workflow * **`settings`** (optional) - Global workflow settings Example: ```yaml env0.workflow.yaml theme={null} settings: environmentRemovalStrategy: detach # or destroy environments: my-environment: name: "My Environment" templateName: "my-template" # ... additional configuration ``` ## Settings Global settings that apply to the entire workflow. `environmentRemovalStrategy` (string) controls what happens when a sub-environment is removed from the workflow file. * Default: `detach` * `detach` - The environment is detached but not destroyed. * `destroy` - The environment is destroyed after you deploy the updated workflow. ## Sub-Environment Properties Each sub-environment is defined as a key-value pair under `environments`. The key is a unique alias for the sub-environment. ### Core Properties | Property | Type | Required | Description | | - | - | - | - | | `name` | `string` | Yes | Display name shown in the env zero UI. | | `templateName` | `string` | No\* | Name of an existing env zero template. Cannot be used with `vcs`. | | `vcs` | `object` | No\* | Inline VCS configuration. Cannot be used with `templateName`. | **\* Either `templateName` or `vcs` must be specified, but not both.** ### Optional Properties | Property | Type | Default | Description | | - | - | - | - | | `needs` | `array` | `[]` | List of sub-environment aliases that must deploy before this one. | | `revision` | `string` | - | Git revision (branch, tag, or commit SHA) to use. | | `workspace` | `string` | - | For Terraform/OpenTofu, sets the workspace name. For Helm, sets the release name. For Pulumi/CloudFormation, sets the stack name. | | `requiresApproval` | `boolean` | `false` | If `true`, deployment requires manual approval before proceeding. | | `disabled` | `boolean` or `string` | `false` | If `true` or `"true"`, this sub-environment is skipped during deployment. Supports variable interpolation. | If you also manage the workflow environment with the env zero Terraform provider, see [Terraform provider settings for sub-environments](/guides/admin-guide/workflows/terraform-provider-sub-environment-settings) for how `requiresApproval`, `workspace`, and `revision` interact with the `sub_environment_configuration` block. ## VCS Configuration If you want to use your code directly without creating a template for it first, you can use the `vcs` object with the following properties: | Property | Type | Required | Default | Description | | - | - | - | - | - | | `type` | `string` | Yes | - | IaC type. Options: `terraform`, `opentofu`, `terragrunt`, `pulumi`, `k8s`, `cloudformation`, `helm`, `ansible`. | | `repository` | `string` | Yes | - | Git repository URL (HTTPS or SSH). | | `path` | `string` | No | `""` | Path within the repository where IaC code is located. | | `revision` | `string` | No | - | Git revision (branch, tag, or commit) to use. | ### VCS Authentication Properties | Property | Type | Description | | - | - | - | | `tokenId` | `string` | ID of a stored VCS token for authentication. | | `tokenName` | `string` | Display name of the VCS token. | | `sshKeys` | `array` | SSH keys for repository authentication. Each item requires `id` and `name`. | | `githubInstallationId` | `number` | GitHub App installation ID. | | `bitbucketClientKey` | `string` | Bitbucket client key for Bitbucket Cloud. | | `vcsConnectionId` | `string` | VCS connection ID for unified VCS integration. | ### VCS Provider Flags | Property | Type | Default | Description | | - | - | - | - | | `isGitLab` | `boolean` | `false` | Set to `true` for GitLab.com repositories. | | `isGitLabEnterprise` | `boolean` | `false` | Set to `true` for GitLab Enterprise/self-hosted. | | `isGitHubEnterprise` | `boolean` | `false` | Set to `true` for GitHub Enterprise. | | `isBitbucketServer` | `boolean` | `false` | Set to `true` for Bitbucket Server/Data Center. | | `isAzureDevOps` | `boolean` | `false` | Set to `true` for Azure DevOps. | ### IaC Version Properties | Property | Type | Description | | - | - | - | | `terraformVersion` | `string` | Terraform version. Use a specific version (e.g., `1.5.7`) or `RESOLVE_FROM_TERRAFORM_CODE`. | | `opentofuVersion` | `string` | OpenTofu version. Use a specific version (e.g., `1.6.0`). | | `terragruntVersion` | `string` | Terragrunt version (e.g., `0.54.0`). | | `terragruntTfBinary` | `string` | Underlying binary for Terragrunt: `terraform` (default) or `opentofu`. | | `pulumiVersion` | `string` | Pulumi version (e.g., `3.100.0`). | | `ansibleVersion` | `string` | Ansible version (e.g., `2.15.0`). | ### CloudFormation Properties | Property | Type | Default | Description | | - | - | - | - | | `fileName` | `string` | - | CloudFormation template file name. Only used when `type` is `cloudformation`. | ### Helm Properties | Property | Type | Default | Description | | - | - | - | - | | `helmChartName` | `string` | - | Helm chart name when using a Helm repository. | | `isHelmRepository` | `boolean` | `false` | Set to `true` if the repository is a Helm chart repository. | ## Examples ### Simple Workflow with Template References A basic workflow using pre-defined templates with dependencies. ```yaml env0.workflow.yaml theme={null} environments: database: name: "PostgreSQL Database" templateName: "aws-rds-postgres" workspace: "production" api: name: "API Service" templateName: "kubernetes-deployment" needs: - database requiresApproval: true ``` ### Workflow with Inline VCS Configuration Define IaC source directly without creating separate templates: ```yaml env0.workflow.yaml theme={null} environments: networking: name: "VPC and Networking" vcs: type: terraform repository: "https://github.com/myorg/infrastructure" path: "terraform/networking" terraformVersion: "1.5.7" compute: name: "EC2 Instances" vcs: type: terraform repository: "git@github.com:myorg/infrastructure.git" path: "terraform/compute" terraformVersion: "RESOLVE_FROM_TERRAFORM_CODE" sshKeys: - id: "ssh-key-123" name: "Deploy Key" needs: - networking ``` ### Mixed Workflow with Settings Combine template references and inline VCS with global settings. ```yaml env0.workflow.yaml theme={null} settings: environmentRemovalStrategy: detach environments: infra: name: "Base Infrastructure" templateName: "terraform-aws-base" revision: "v2.0.0" app: name: "Application" vcs: type: helm repository: "https://github.com/myorg/helm-charts" path: "charts/myapp" needs: - infra monitoring: name: "Monitoring Stack" templateName: "prometheus-grafana" needs: - infra disabled: false ``` ### Workflow with Variable Interpolation Use environment variables to conditionally disable sub-environments. ```yaml env0.workflow.yaml theme={null} environments: vpc: name: "VPC and Network" templateName: "VPC" db: name: "Database" templateName: "DB" requiresApproval: true needs: - vpc eks: name: "EKS Cluster" templateName: "EKS" needs: - vpc billing-service: name: "Billing Service" templateName: "Billing Service" disabled: ${DISABLE_BILLING_SERVICE} needs: - db - eks config-service: name: "Configuration Service" templateName: "Configuration Service" revision: feature-branch disabled: ${DISABLE_CONFIG_SERVICE} needs: - db - eks ``` > [!TIP] > > Use variable interpolation with the `disabled` property to enable partial > workflow deployments based on environment variables. Learn more: [Workflow file JSON schema](/guides/admin-guide/workflows/workflow-file-json-schema) # Partial workflow deployment Source: https://docs.envzero.com/guides/admin-guide/workflows/workflow-partial-deployment Deploy or destroy subsets of an env zero workflow graph using Run From Here, single sub-environment redeploy, or single sub-environment destroy. ## What is Partial Workflow Deployment? After the first workflow deployment, a workflow is represented as a graph, generated from the [input env0.workflow.yml](/guides/admin-guide/workflows/create-a-new-workflow) file. Partial Workflow Deployment lets you redeploy or destroy a subset of your workflow's graph as needed, rather than running a full top-to-bottom deployment each time. It provides more targeted, incremental deployment capabilities. Partial Workflow Deployment may be used in various cases, for example: * Fixing failed deployment without having to re-run the entire workflow * Applying changes on a single sub-environment * Generating quicker development cycles for a part of the workflow * Destroying a single sub-environment to test a deployment's resource creation After every partial deployment, workflow status & resources will be reevaluated. There are three options for Partial Workflow Deployment: 1. [Run From Here](/guides/admin-guide/workflows/workflow-partial-deployment/#deploying-a-subset-of-the-workflow) 2. [Single Sub-Environment Redeploy](/guides/admin-guide/workflows/workflow-partial-deployment/#deploying-a-single-sub-environment) 3. [Single Sub-Environment Destroy ](/guides/admin-guide/workflows/workflow-partial-deployment/#destroying-a-single-environment) *** ## Deploying a subset of the workflow This is achieved using the ***Run From Here*** button. This will run the workflow according to the latest workflow file used, starting from the selected sub-environment and continuing to its entire sub-tree. > [!NOTE] > > **Updating the *env0.workflow\.yml* file** > > Updates made to the *env0.workflow\.yml* file will not be applied when performing Run From Here partial deployment, because Partial Workflow Deployment utilizes the most recently cached workflow configuration. The Run From Here button can be found either on the workflow's graph in each sub-environment's three-dot (︙) menu: ![Workflow graph node three-dot menu showing the Run From Here option for partial deployment](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/workflows/e81b398-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=3171da146a727d9bad71cf3b86c67384) Or on the sub-environment's page: ![Sub-environment page showing the Run From Here button for initiating a partial workflow deployment](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/admin-guide/workflows/c5e743b-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=c7a06e3e7cf03878a2bfb56c1efb3a7f) > [!TIP] > > Run From Here > > Run From Here will continue the workflow run as described in the graph. That means environments may be deployed or destroyed, as indicated by the latest deployment graph. ## Deploying a single sub-environment Like with Run From Here, you can deploy a single sub-environment from the three-dot menu on the graph's node or directly from the sub-environment's page. The graph will indicate a single deployment by marking all other environments as skipped. > [!NOTE] > > **Deploying a single sub-environment** > > Deploying a single environment will necessarily perform a **Deploy** operation, regardless of the workflow file. ## Destroying a single environment Similarly to the Run From Here above, destroying a single sub-environment which is a part of a workflow can be done from the three-dot menu on the graph's node or from the environment's page directly. The destroy operation will be indicated in the graph by marking all environments except the destroyed one as skipped. > [!NOTE] > > **Destroying a single sub-environment** > > Destroying a single sub-environment will perform a **Destroy** operation, regardless of the workflow file. ## Status and Resources reevaluation The workflow's [status](/guides/admin-guide/workflows/#workflow-environment-status) is reevaluated after every sub-graph deployment, and as described in the [status](/guides/admin-guide/workflows/#workflow-environment-status) docs, the status will be Active/Inactive only if *all* sub-environments are successfully deployed/destroyed. A workflow sub-graph might have been successfully deployed, but its status may not be `Active` if there is still a sub-environment with a Failed status. Similarly, the resources' count will update after every partial deployment according to all the workflow's sub-environments. # Managing your subscription Source: https://docs.envzero.com/guides/billing/managing-your-subscription How to upgrade, switch, or cancel your env zero subscription, including billing cycle details, Stripe invoicing, and marketplace customer invoice access. All subscription changes are handled by the env zero team. Whether you're looking to upgrade, switch packages, cancel, or have a question about your plan, the best first step is to reach out to your account manager or [contact us](https://www.envzero.com/contact-us). ## Switching or Upgrading Your Plan If your needs have changed and you'd like to move to a different package, your account manager can describe the options and handle the transition. Upgrades take effect immediately; downgrades and package switches typically take effect at the start of the next billing cycle. See [Subscription tiers](/guides/billing/subscription-tiers) for a full comparison of available packages. ## Canceling Your Plan To cancel your subscription, contact your account manager or [reach out to our team](https://www.envzero.com/contact-us). Your plan will remain active and fully functional through the end of the current billing cycle, and no further charges will be made after that. ## Invoices How you access invoices depends on [how your subscription was purchased](/guides/billing/purchase-options). **Direct billing customers** are invoiced via Stripe. Invoices are sent automatically to your billing contact at the start of each billing cycle. If you need to retrieve past invoices or update your billing contact, reach out to our [accounts receivable team](mailto:ar@env0.com). **Marketplace customers** can find invoices in the billing section of their respective cloud console: * **AWS**: Billing & Cost Management → Invoices * **Azure**: Cost Management + Billing → Invoices * **GCP**: Billing → Documents ## Next steps For product or deployment issues rather than billing questions, see [Support](/guides/community-and-resources/support-and-help/support) for contact channels and response times. # Purchase options Source: https://docs.envzero.com/guides/billing/purchase-options Purchase env zero via direct Stripe invoicing or private marketplace offers on AWS, Azure, and Google Cloud to consolidate spend with cloud billing. The [Free plan](/guides/billing/subscription-tiers#env-zero-free) requires no purchase: sign up and start deploying. Paid packages are sold through the env zero sales team. To get started with any purchase option, [contact us](https://www.envzero.com/contact-us) to find the right package and get set up. ## Direct Invoicing The recommended way to get started with env zero is through direct invoicing. After agreeing on a package with our sales team, you'll be billed directly by env zero via Stripe. No marketplace account is required, and [invoices](/guides/billing/managing-your-subscription#invoices) are sent directly to your billing contact. It's a good fit for organizations that prefer to keep software spend separate from their cloud provider billing. ## Cloud Marketplace Purchasing through a cloud marketplace lets you consolidate env zero spend with your existing cloud billing, which can be useful for organizations with committed cloud spend or procurement processes tied to a specific marketplace. Marketplace purchases are handled through a **private offer** process. Once you've connected with our sales team and aligned on a package, we'll prepare a private offer through your preferred marketplace. You'll receive and accept the offer directly within your cloud console, and your env zero subscription will be activated and linked to your cloud billing from there. **Supported marketplaces:** * [AWS Marketplace](https://aws.amazon.com/marketplace/seller-profile?id=55540b66-733b-4d1f-b4fd-84a376407155) * [Azure Marketplace](https://azuremarketplace.microsoft.com/en-us/marketplace/apps?search=env0\&page=1) * [Google Cloud Marketplace](https://console.cloud.google.com/marketplace/product/env0-public/env0) For questions about marketplace purchases, contact your account manager or [reach out to us](https://www.envzero.com/contact-us). ## Next steps Once your package is active, follow the [Quick Start](/guides/getting-started/getting-started) to connect your VCS and cloud account and deploy a first environment. # Subscription tiers Source: https://docs.envzero.com/guides/billing/subscription-tiers Compare env zero plans, the Free plan, Cloud Navigator, and Cloud Pilot, by monthly runs, environments, drift management, features, and support. env zero offers a Free plan and two paid packages designed to meet organizations at different stages of their cloud infrastructure journey. All plans include unlimited users. To get a quote or discuss which package is right for your organization, [contact us](https://www.envzero.com/contact-us). ## env zero Free Free forever. Sign up and start deploying directly, with no trial period, no credit card, and no sales conversation. **\$0/month** Ideal for developers evaluating env zero and small teams that want a free-for-life tier with real features. **Includes:** * Every Cloud Navigator feature, including [drift detection](/guides/admin-guide/environments/drift-detection) and OIDC/SSO. See [Cloud Navigator](#env-zero-cloud-navigator) for the full list * Cloud Compass, with one connected cloud account * 250 runs per month * Up to 30 active environments * Unlimited users, and one [self-hosted agent](/guides/admin-guide/self-hosted-kubernetes-agent/overview) * One concurrent deployment, with a 20-minute limit per run * Community [support](/guides/community-and-resources/support-and-help/support) A run is one successful deploy, destroy, or drift detection. Plans, pull request plans, dry runs, tasks, module tests, and failed or cancelled runs do not count against the cap. ### Free plan limits When you reach 30 active environments, you cannot create new environments until you destroy an existing one or [mark it as inactive](/guides/admin-guide/environments#mark-an-environment-as-inactive). Existing environments keep deploying. When you reach 250 runs, deploys, destroys, and drift detection that you trigger are blocked. Unattended runs are skipped silently instead: continuous deployment, scheduled deployments, drift remediation, and TTL destroys stop happening without notifying you. The run count resets at the start of each month, UTC. ## env zero Cloud Navigator Command control with our cloud provisioning toolbox. Built for maturing enterprises that need self-service, governance, and automation. **Pricing per Apply or Environment - [get a free quote](https://www.envzero.com/pricing)** Everything in the Free plan, with higher limits: * Unlimited monthly runs * Up to 100 active environments * Unlimited concurrent deployments, with no per-run time limit * Unlimited self-hosted agents Plus: * IaC Automation & GitOps (GitOps Workflows, Deploy from PR Comments, Custom Flows, Workflows) * Basic Drift Management (detection, cause analysis, code-to-cloud redeployment) * Managed Self-Service (Environment Discovery, Slack/Teams & Email Notifications, Environment Scheduling, TTL) * Basic Visibility & Dashboards * Private Registry (Module & Provider Registry, Module Testing) * Access Controls (RBAC, OpenID Connect, SAML Integration, Team Sync, Environment-Level Access, Custom RBAC Roles) * Governance & Compliance (Custom Approval Policies, SOC 2 Report access) * Basic Integrations (VCS, IaC frameworks) * Email Support + Dedicated POC Support + Shared Slack/Teams Channel ## env zero Cloud Pilot Run at scale with our cloud governance platform, powered by AI, delivering end-to-end control for sophisticated enterprises. **Pricing per Apply or Environment - [get a free quote](https://www.envzero.com/pricing)** Everything in Cloud Navigator, plus: * **[Cloud Analyst](/guides/cloud-analyst/cloud-analyst)** - AI-powered insights, agent, and dashboards * Unlimited Active Environments * Advanced Drift Cause Analysis, Remediation, and Monitoring * Cost Management (Cost Estimation via Infracost, Actual Cost Visibility, Centralized Cost Tagging, Cost Alerts, Budget Thresholds) * Self-Hosted VCS (Bitbucket, GitLab & GitHub) * Proof-of-Value Guarantee * Advanced Integrations (IDP, FinOps, Observability, PAC/SAST) * Enterprise SLA + env zero POC Guarantee ## Self-Hosted Agent env zero can be delivered as a full SaaS offering or as a Hybrid SaaS + Self-Hosted Agent. The Self-Hosted Agent is available on every plan: one agent on the Free plan, and unlimited agents on Cloud Navigator and Cloud Pilot. [Contact us](https://www.envzero.com/contact-us) for details. For a full feature comparison, visit [envzero.com/pricing](https://www.envzero.com/pricing). ## Next steps * [Choose how to buy a paid package](/guides/billing/purchase-options), direct invoicing or a cloud marketplace private offer * [Upgrade, switch, or cancel your plan](/guides/billing/managing-your-subscription) * [Deploy your first environment](/guides/getting-started/getting-started) on the Free plan # Cloud Analyst Source: https://docs.envzero.com/guides/cloud-analyst/cloud-analyst Use env zero Cloud Analyst to query deployment data with AI, build dashboards and insights, and manage environments at scale using the Explorer tab. env zero Cloud Analyst provides instant access to infrastructure deployment data, enabling teams to ask questions, generate insights, and create dashboards.\ Powered by an AI agent, teams can explore and analyze infrastructure and related DevOps metrics and trends without needing to manually compile data or learn complex models. > [!NOTE] > > **Cloud Analyst is an add-on feature** > > Reach out to our support team for more information about enabling Cloud Analyst. ## Getting Started To begin, go to Cloud Analyst from the left-hand menu in the env zero platform. Once inside Cloud Analyst, you can explore different tabs depending on what you're trying to achieve. ## Key Features: * **AI-Driven Queries** - Ask questions in natural language using the AI Analyst tab. You'll receive a visual response, such as a chart or table, based on the env zero data model. From there, you can: * **Edit** the result using a visual editor * **Pin** it to a Dashboard * **Save** it as an Insight * **Download** it as PNG, CSV, or XLSX\ [Learn more about AI Analyst](/guides/cloud-analyst/cloud-analyst/ai-chat-interface) ![AI Analyst tab showing a natural language query input and a resulting chart visualization](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/cloud-analyst/2c7baed6ef7a4cadfe821d6a723dd510f977b9df57d5b2360c33b25cf6aca76f-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=007e665145e04ae97ad4352d223a40c2) * **Predefined Charts & Metrics** - Access a library of dashboards answering common questions like DORA metrics, drift trends, and deployment performance. [Learn more on Dashboards](/guides/cloud-analyst/cloud-analyst/dashboards) ![Dashboards tab displaying a library of predefined charts and metrics for DORA and deployment analytics](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/cloud-analyst/679899480b922fed62c71f89f523954cc25f1c5919b86a9f6ed2b1418306669c-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=ae32a3ce11697386633fef8729a0160b) * **Custom Charts & Metrics** - Use the chart editor to create tailored views. You can choose fields, apply filters, and define aggregations to build exactly the visualization you need. Every chart can be: * **Saved** as an Insight * **Pinned** to a Dashboard * **Edited** later\ [Learn more on Insights](/guides/cloud-analyst/cloud-analyst/insights) ![Insights tab with a chart editor for building custom visualizations with fields, filters, and aggregations](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/cloud-analyst/b0d7d6e9117cdee66cc9eed9174f2033a5478603365331d38bf4e0d4e6a6139c-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=52df1aabd8f4bc4062f965f38d7f27c0) * **Environment Exploration** - Use the Explorer tab to review and compare all environments. Search, filter, and take bulk actions across multiple environments. Learn about [Explorer](/guides/cloud-analyst/cloud-analyst/explorer) to start managing environments at scale. ![Explorer tab showing a searchable table of all environments with filter and bulk action controls](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/cloud-analyst/06d93331ffd7746181e3179e5701d32b51607dadaaf5d6a81c73274aa9367115-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=4bd82fb6eaa64a1d2003df988b7b5dfd) Cloud Analyst is built to give you flexibility. Whether you're asking ad hoc questions, customizing charts, exploring environments, or building dashboards, each part works together to help you gain better visibility and drive decisions from your infrastructure data.\ Everything is powered by the env zero data model, so you're always working with consistent, real-time information. For more details on the structure behind your data, visit the [env zero model](/guides/cloud-analyst/cloud-analyst/env-zero-model) page. ## Next steps For cloud resources that env zero does not manage, see [Cloud Compass](/guides/cloud-compass/cloud-compass), which scans your cloud accounts and categorizes resources by how they are managed. # AI chat interface Source: https://docs.envzero.com/guides/cloud-analyst/cloud-analyst/ai-chat-interface Query infrastructure data using natural language with env zero Cloud Analyst AI chat, then pin results to dashboards, save as insights, or download as CSV. The Cloud Analyst AI Chat Interface allows users to explore their data using natural language. Instead of writing complex queries, users can ask questions, and the AI will generate insights based on the available [data model](/guides/cloud-analyst/cloud-analyst/env-zero-model). Can be used to retrieve specific metrics, analyze trends, or generate visual reports. ## Possible Actions ![AI Chat Interface showing a query result with Pin, Save, Download, and Edit action buttons](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/cloud-analyst/cloud-analyst/9b88258914d7c970f6fc18de222b90a11045fe543a044e081a64a51d0901a390-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=cc59204936adc1ffb5e674dca3b37d0c) After you asked a question and received the result there are multiple actions you could take: * **Pin** - To keep it for later/common use in context of a specific domain, hitting "Pin" will attach this result to an existing [dashboard](/guides/cloud-analyst/cloud-analyst/dashboards). * **Save** - To keep it for later/common use, hitting "Save" will keep this result as an `Insight`. * **Download** - Downloads the result in `PNG`/`XLSX`/`CSV` format to your computer. * **Edit** - Allows changing the result directly using the [Editor UI](/guides/cloud-analyst/cloud-analyst/insights#editing) instead of interacting with the AI Chat (can add/remove fields, change chart type/color/text, etc). # Dashboards Source: https://docs.envzero.com/guides/cloud-analyst/cloud-analyst/dashboards Create and use Cloud Analyst dashboards in env zero by combining multiple insights into a single interactive page with predefined metrics and global filters. Cloud Analyst Dashboards provide a comprehensive view of key data by combining multiple Insights into a single interactive page. Each dashboard is designed to answer a broad set of questions on a specific topic, offering a holistic perspective through visualizations and metrics. Users can apply global filters to refine the data, making it easy to drill down into specific time periods, environments, or usage patterns. ## Predefined Dashboards env zero provides multiple predefined out of the box dashboards that answer common questions around main topics, you can see those in the Dashboards table, they will be marked with a verified icon. ## Create Your Own After generating a response from the [AI Chat Interface](/guides/cloud-analyst/cloud-analyst/ai-chat-interface) you could click on `Pin` and then attach to an existing Dashboard or to create a new one. ![Pin dialog allowing a chart result from AI Chat to be attached to an existing or new dashboard](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/cloud-analyst/cloud-analyst/95e353c7df994e93a6ed630722971d3d4424b338ae722546cba80fe7cd2fdb95-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=f9184f197e0a8a57c294fb89590360b8) See more info on how to better edit the existing response before pinning it to a Dashboard [here](/guides/cloud-analyst/cloud-analyst/insights/#editing). # env zero model Source: https://docs.envzero.com/guides/cloud-analyst/cloud-analyst/env-zero-model Explore the env zero Cloud Analyst data model covering entities including environments, deployments, state resources, cloud resources, and change events. The Cloud Analyst data model provides a structured view of the data available within our system, enabling users to run queries and extract meaningful insights. It includes detailed information about key entities, relationships, and attributes, allowing users to explore their resources, usage, costs, performance and other critical data and metrics. Whether using our [AI chatbot](/guides/cloud-analyst/cloud-analyst/ai-chat-interface) or building [custom visualizations](/guides/cloud-analyst/cloud-analyst/insights), users can use this data model to gain a deeper understanding of their cloud environment and make data-driven decisions. ## Full Entities Relational Diagram: ![Entity relational diagram showing all Cloud Analyst data model entities and their relationships](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/cloud-analyst/cloud-analyst/5bc6f583204a74aa88930b3266ed4ea8f1fe3dd86c753def89140d4e972ce1fd-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=2b54d60516348d47225abe4bab170f35) ## Elaborating on the Main Entities: | Table | Fields | Connects To | Description | | :- | :- | :- | :- | | **Projects** | Name, Dates | `Templates`, `Environments`, `Budgets` | | | **Environments** | Name, Dates, Template data, Status, Drift Status | `Projects`, `Deployments`, `Daily Costs`, `State Resources`, `Templates`, `Module Usage` | | | **Deployments** | Type, Drift Detected, Duration, Error, Date, Start/Finish Times, IaC version, Status | `Environments`, `Deployment Steps`and `Users` (which started the deployment) | | | **Deployment Steps** | Name, Duration, Start/Compete Times, Status | `Deployments` | | | **Templates** | Name, Dates, Type, Project Association | `Projects`, `Environments` | | | **Users** | Name, Dates, Email | `Deployments` (they started), `Teams` | | | **Teams** | Name, Dates | `Users` | | | **Budgets** | Date, Time Frame, Amount | `Projects` | | | **Modules** | Name, Dates | `Module Downloads`, `Module Usages` | | | **Module Downloads** | Date, Version | `Modules` | How many times a module was downloaded | | **Module Usage** | Dates, Provider, Version | `Modules`, `Environments` | Which Environments use which modules | | **State Resources** | Dates, Type, Cloud Provider, Account, Region, IaC tool, Module, Provider, Deployment (last one that managed it) | `Environments` , `Cloud Resources` | All resources created by your env zero Environments | | **Cloud Resources** | Name, Dates, IaC/API/Click Operations, First Seen, Severity, Type, Service, Management Type, Cloud Provider | `State Resources`, `Change Events`, `Cloud Resource Trends` | All resources found in the cloud (which may or may not be managed using env zero) | | **Change Events** | Event Name, Dates, User Agent, Username | `Cloud Resources` | All change events found in the cloud | | **Cloud Resource Trends** | Dates, IaC/API/Click Count, Type | `Cloud Resources` | | > [!NOTE] > > **Sub Entities** > > In the env zero data model, we also store sub-entity data (sub environments and sub deployment logs of workflows). > > These sub-entities are not counted in pricing calculations, but are included when analyzing usage with Cloud Analyst. # Explorer Source: https://docs.envzero.com/guides/cloud-analyst/cloud-analyst/explorer Filter, search, and manage all environments from one centralized view with env zero Cloud Analyst Explorer, including bulk actions across multiple environments. Cloud Analyst Explorer provides a centralized view of all [environments](/guides/admin-guide/environments) and their associated data, giving users full visibility and control. It allows users to filter, search, and analyze their environments in one place while also enabling [bulk actions](/guides/admin-guide/environments/bulk-operations) for efficient management. Whether comparing environments, or executing operations across multiple environments simultaneously, the Explorer streamlines workflows and enhances operational efficiency. ![Explorer tab with a centralized table of all environments, filter controls, and bulk action options](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/cloud-analyst/06d93331ffd7746181e3179e5701d32b51607dadaaf5d6a81c73274aa9367115-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=4bd82fb6eaa64a1d2003df988b7b5dfd) ## Next steps To narrow the table to a group of environments, [filter Explorer by environment tag](/guides/admin-guide/environments/tags#explorer). # Insights Source: https://docs.envzero.com/guides/cloud-analyst/cloud-analyst/insights Create single-chart insights in env zero Cloud Analyst using predefined metrics or the chart editor with fields, filters, aggregations, and 20+ chart types. Cloud Analyst Insights provide quick, focused answers to specific questions through single-chart visualizations. Each Insight is designed to highlight key trends, usage patterns, or performance metrics, giving users immediate clarity on important topics. ## Predefined Insights env zero provides multiple predefined out of the box insights that answer common questions, you can see those in the Insights table, they will be marked with a verified icon. ## Create Your Own Create your own insights by using the [AI Chat Interface](/guides/cloud-analyst/cloud-analyst/ai-chat-interface) and hitting "Save" to save the results as an Insight, or by Create New Insight button on the Insights table. ![Insights table listing predefined and custom insights with a Create New Insight button](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/cloud-analyst/cloud-analyst/baa55c69b7da567b9572f6642eb8e7bfa23872e430c5408011e998bac9cea704-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=4e88a5bd213e976ef582cb91602a794f) ## Editing: When Editing an insight, you can use the data search to directly specify fields, aggregations, filters and more to build your visualizations. ![Insight editor with the data search bar and left panel field list for building chart queries](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-analyst/cloud-analyst/e21d5f1d2ebca15d3f7f06780badecdd4ac22231c8326374aa738146a46caa22-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=edaa320ec116fc59fe20abd6cdd66e77) ### The Search Bar The search bar allows an easy way to build your query. It is based on a list of keywords. Here are some keywords that can be used: * **Fields**: Search the field name you are interested in seeing such as "Environment Name". The fields are also visible on the left panel, and you can select them from there. * **Filters**: You can add filters in different ways, such as `Environment Name=X`, or keywords like `Top 5` or `Bottom 10` to limit the results. * **Grouping**: Add keywords like `by Environment Type` to group by certain attributes * **Aggregation**: Add keywords like `count`/`sum`/`max` before attributes to count and aggregate measures * **Sorting**: Add keywords like `sort by` to control the order ![Search bar in the Insight editor showing keyword examples for fields, filters, grouping, and sorting](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/cloud-analyst/cloud-analyst/d8c94480ca3e6dc12db01a2effdd422d108479167b47f36810aa447e892568a6-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=d81a4524752ffceef0ea5c4129c663d8) ### Insight Settings On the right panel, there are several options to help you customize the chart to your needs: * **Chart Library** - Select the visualization that best serves your needs from a variety of over 20 options * **Chart Configuration** - Configure the chart by setting up labels, assign fields to axis, and more. * **Query Details** - See a breakdown of the full query details, to make sure it behaves as you expect. * To view the data in a tabular format click on the `View Table` icon at the top ![Right panel of Insight editor showing Chart Library, Chart Configuration, and Query Details options](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/cloud-analyst/cloud-analyst/44e39695081edb8a4695685d0c207a6bff48ab820ea0960dc73b14e1dbc44fb2-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=35db5b98cb3985b8c96cbe85cd082e5e) ### Fields, Formulas and Parameters On the left panel you can see the full list of fields available in the [env zero data model](/guides/cloud-analyst/cloud-analyst/env-zero-model). You can select any field to construct your query, as well as use them along with filters or aggregations, as described above. If you need to create a complex calculation, you can use **Formulas**. ![Left panel in the Insight editor listing available fields and a Formulas option for custom calculations](https://mintcdn.com/envzero-b61043c8/noVHY1C-wdNQ4iZn/images/guides/cloud-analyst/cloud-analyst/282e3d9dc372e3aaeae5288b0cae0d178b984087ab9a70fe9f2f963b4df6c773-image.png?fit=max\&auto=format\&n=noVHY1C-wdNQ4iZn\&q=85\&s=c7d37455ff5300c704cecec568820378) Formulas contain large number of functions that can be used while referencing attributes and measures from the env zero model. The functions along with their explanations are available in the formula editor. ## Next steps To view several insights on one page with global filters, pin them to a [dashboard](/guides/cloud-analyst/cloud-analyst/dashboards). # Cloud Compass Source: https://docs.envzero.com/guides/cloud-compass/cloud-compass Discover and categorize unmanaged cloud resources with env zero Cloud Compass, track IaC coverage trends, assess drift risk severity, and generate IaC code. ## Introduction Cloud Compass by env zero aims to bridge the gap between manual and automated cloud operations, providing deep insights into how your cloud resources are managed. Cloud Compass periodically scans your cloud account. By identifying non-codified resources and evaluating their associated risks, Cloud Compass enables a more effective Infrastructure as Code (IaC) strategy, helping you expand IaC coverage and enhance cloud governance. > [!NOTE] > > **Configure Your First Cloud Account** > > * If you haven't configured your cloud account for usage with Cloud Compass yet, follow the steps in [Configuring Your First Cloud Account](/guides/cloud-compass/cloud-compass/configure-cloud-accounts) to get started. [YouTube video player](https://www.youtube.com/embed/wtrYlBwD9P8) ## Utilizing the Cloud Compass Dashboard Access the Cloud Compass dashboard through the organization menu item (A ‘View Dashboard’ permission is required to access the page). ### Settings Access the Cloud Compass dashboard using the organization menu item (A permission to ‘View Dashboard’ is required to access the page). Here you can see and manage your cloud accounts. Click [here](/guides/cloud-compass/cloud-compass/configure-cloud-accounts) to see how to configure an account to use with Cloud Compass. ![Cloud Compass Settings page listing configured cloud accounts with options to manage them](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/d291765-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=3c5499309f251c389b974314629d5d4f) ### Insights Once you’ve selected a cloud account, you can begin analyzing your cloud culture. The dashboard displays the period for which the data is shown (including the initial data time and last updated time) and provides information about the next Cloud Compass cloud scan. ![Cloud Compass dashboard showing data period, initial data time, last updated time, and next scan schedule](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/8372692-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=b5e198f0cecb760077a4cc549776fdf4) Each run could take several minutes, as env zero scans all new cloud activity and processes it to generate insights.\ While the data is being updated in the background, you'll see a relevant message. ![Cloud Compass dashboard with an in-progress update message while data is being refreshed in the background](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/e3361e9-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=35b99d4fe6f250ad9fd3a651c6934910) #### View Coverage Trends: ##### AWS / GCP Examine the trend of IaC-managed resources, as a percentage of your overall cloud resource in your cloud account over time. ![IaC coverage trend chart for AWS or GCP showing percentage of managed resources over time](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/497d8cb-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=ce1ef37dd991ab66cb5c5f1b2863d5dd) ##### Azure Examine the automated resources trend as a percentage of your overall cloud resources in your account over time. ![Automated resources trend chart for Azure showing percentage over time](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/1c9e45fa490a72ad9b5f2e890db6da7f2dc350bb2ae5aa75f9e9520b61dfc393-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=56900741a88fba83103b903069706155) #### Resource Management Type Breakdown See the current distribution of [management types](#understanding-resource-management-types) * For AWS / GCP ![Resource management type breakdown pie chart for AWS or GCP showing IaC, API/CLI, and ClickOps distribution](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/f5fb58f-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=91f9df7483e4834803771cb0265d95b0) * For Azure ![Resource management type breakdown chart for Azure showing distribution of management types](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/b31a5b0c265097771ee1f449309793bda0907294ad35558d812e85aef9fe333c-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=2a974ad2a29d3d75d557596371dab5fb) ### Assess Resource Breakdown: AWS: Tracking uses CloudTrail logs stored in S3. Ensure CloudTrail is set up for the resources. Azure: Tracking relies on Activity Log in the Log Analytics Workspace. Verify logging is enabled. GCP: Tracking relies on Cloud Audit Logs. Verify Cloud Logging API is enabled. ## Resource Detection Cloud Compass detects and lists your cloud resources, and provides useful information and insights, including: * Tracking (only for resources logged to [S3 by CloudTrail (for AWS)](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/how-cloudtrail-works.html#how-cloudtrail-works-trails) or [Log Analytics Workspace by Azure's Activity Log](https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log?tabs=powershell#send-to-log-analytics-workspace) (for Azure) or [Cloud Audit Logs (for GCP)](https://cloud.google.com/logging/docs/audit) * Exploring detailed resource breakdown * Viewing the total number of operations detected for each resource * Reviewing [severity](/guides/cloud-compass/cloud-compass/#evaluating-management-severity) scores to prioritize tasks effectively and improve management practices ![Cloud Compass resource table listing detected cloud resources with operation counts and severity scores](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/1d3aabb31fe0f42ae51b4da41bb06643074e63568440ceec2580071c1b6f0065-image8.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=b30a119cb1ae61bca2ec52f17144bfff) Let's break it down: ![Resource row detail showing ClickOps, API/CLI, and IaC operation counts with an Optimal severity indicator](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/ab81dc3de83d8959809c884006bfdfd4ea93073684a316b63a280ca877f14b43-image14.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=09439789115db8786254c06edce5ef96) For the resource named `compass-drilldown-qa-ddb`: * 1 manual operations via the Cloud Console (ClickOps) * 0 API/CLI operations * 1 IaC operations This resource is managed via an IaC and is categorized with a severity of 🟢(Optimal). ### Drift Detection Cloud Compass identifies the likelihood of drift based on data from past operational events, and other nuanced relevant information in cloud logs. For env zero-managed resources, Cloud Compass uses env zero's deterministic understanding of deviation between the infrastructure's actual state and the desired state, as defined by the IaC configuration. These resources will be flagged as 'Drifted'. The drift status options include: * “Not Drifted” - This resource is managed by an IaC tool, and no suspicious drift has been detected * "Drifted" - This resource is managed in env zero, and the [Drift Detection](/guides/admin-guide/environments/drift-detection) capability identified it as drifted * “Drift Risk” - This resource is managed by an external IaC tool, and suspicious drift has been detected based on cloud events * “Unknown” (Blank label) - this resource is not managed in IaC You can filter your resources by their drift status using the environment autocomplete and clicking the filter icon.\ This search function includes all env zero environments, even if they don't currently match Cloud Compass resources. [Learn more](/guides/cloud-compass/cloud-compass/linking-environments-to-cloud-compass-resources) about linking env zero environments to cloud resources. To filter by environment, use the environment autocomplete. ### Resource Analysis Click ’Details’ on any resource row to view additional information, including event actions and a summary. ![Resource detail panel opened after clicking Details, showing recent events and management stage](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/a37b9bf62ea11594768d9ac8f4ed4ef2cab5317a2eab96421ef423d0a65a8dca-image7.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=61096ddc61068d0af939a093baf2dce9) The resource information will open, displaying the latest events (we store up to 90 days of events history) and management stage, which indicates who manages this resource. If the resource is managed by env zero, you'll also see a link to the relevant environment.\ [Learn more](/guides/cloud-compass/cloud-compass/linking-environments-to-cloud-compass-resources) about linking env zero environments to cloud resources. ![Expanded resource information showing event history and a link to the managing env zero environment](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/0bae239af50a6f01def106c49e1984cbbc8c977439b661fa797c5fc025f735cb-image12.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=08840e41d3408fa7f863d921d2b4cebc) ## Understanding Resource Management Types Cloud Compass categorizes cloud resources into several types based on their management method. Understanding these types is crucial for optimizing your cloud operations. ### 🟢 IaC Resource A resource managed through Infrastructure as Code (IaC) frameworks. ### 🟡 API/CLI or Automated (Scripted) Resource A resource managed through custom scripts or direct API/CLI interactions. ### 🔴 ClickOps or Manual Resource A resource primarily managed through the cloud console/UI. ## Evaluating Management Severity Cloud Compass assesses the severity of each resource, providing a score that indicates the potential risk and management efficiency. Severity is calculated based on: * The total number of actions from each type, with ClickOps carrying the most weight, followed by API, and Infrastructure as Code (IaC) carrying the least weight. * Service type, with different service types having varying weights.\ For example, in AWS, services like IAM, KMS, and EC2 are considered more sensitive than others. The severity levels are: ### 🟢 Optimal Expected Resources: Resources managed through IaC, representing best practices. ### 🟡 Low Expected Resources: Resources with minor manual interactions, mostly managed through scripts or CLI tools. ### 🟠 Medium Expected Resources: Resources with a balanced mix of manual and automated interactions. ### 🔴 High Expected Resources: Resources primarily managed manually, indicating a high risk of misconfigurations and inefficiencies. ### 🔘 Ignored Expected Resources: Resources explicitly labeled as ignored by users, either temporarily or permanently, to focus on other resources during migration or management efforts. ## Resetting Severity of a Resource Cloud Compass helps locate resources that are not managed in IaC, or that include some manual interactions. This should make spotting and remediating non-managed or drifted resources easier. When you add a resource to your IaC, or when you've prevented manual interaction with the cloud resource, you will slowly see the severity of the resource change in Cloud Compass, as more events related to the resource are processed over time. If you'd like to see the resource's severity recalculated more quickly, you can pick your resources in Cloud Compass and then click the `Reset severity` button. This will force Cloud Compass to ignore all past events and start calculating the resource's severity from scratch on the next cloud event affecting the resource. ## Take action By selecting a resource you have the following options: * Generate IaC Code to start migrating your resources (supports OpenTofu and Terraform) * Mark or unmark a resource's severity as Ignored. More info on the "Ignored" severity can be found [here](/guides/cloud-compass/cloud-compass/#evaluating-management-severity). * Reset a resource's severity until the next change event ### Generating IaC code 1. Choose your preferred IaC framework ![IaC framework selector for generating IaC code showing OpenTofu and Terraform options](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/0169b3b-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=53add794e7848c32b45a8ef2b424ea32) 2. IaC code is generated for your resources. Please make sure to follow the instructions ![Generated IaC code block for the selected resource with instructions for importing it](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/d678429-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=07f83268f68619045cbdebebc0372ea8) ## Conclusion We know that understanding what's going on in your cloud environment can be a daunting task. Cloud Compass aims to make it easier by providing a clear breakdown of your organization's cloud culture. Track IaC coverage, focus on the most risky resource management practices, and create a better overall cloud strategy to avoid errors and misconfigurations. By following the steps above, you can enhance your cloud resource management with Cloud Compass, gaining deeper insights and improving governance. ## Next steps * [Connect an Azure subscription](/guides/cloud-compass/cloud-compass/configure-an-azure-cloud-account) * [Connect a GCP project](/guides/cloud-compass/cloud-compass/configure-a-gcp-cloud-account) * [Query cloud resources in Cloud Analyst](/guides/cloud-analyst/cloud-analyst), an add-on whose data model includes cloud resources and change events # Configure a GCP cloud account Source: https://docs.envzero.com/guides/cloud-compass/cloud-compass/configure-a-gcp-cloud-account Connect a GCP project to env zero Cloud Compass by enabling the Cloud Logging API, creating a logging.viewer service account, and configuring Workload Identity. ## Configure a Cloud Account Cloud accounts are listed and managed in the Cloud Compass dashboard under [Settings](/guides/cloud-compass/cloud-compass#settings). ![Cloud Account configuration wizard for GCP showing the initial setup form](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/f21ecc5cfaa193a33f4100a3d4f8f092b3ab8830d2bb9008758ff2dfac0e2d0d-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=8d94993433def6aef3112c9c2208aee8) ### Requirements To successfully integrate your GCP account with env zero, ensure the following prerequisites are met in your GCP project: #### Enable Cloud Logging API for your GCP project The Cloud Logging API must be enabled for your GCP project to allow env zero to read log data. * Verify the Cloud Logging API status * If not enabled, proceed to enable it. ![GCP APIs and Services console showing the Cloud Logging API status verification page](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/46234e129ab59f4c9f0d16bb1a2483af3a8922c004f08c8f30fd3a4dc257e4dc-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=db4e8d7f759d86bf8cd2217cef19bb4a) #### Create a Service Account with permissions to read logs You need a dedicated Service Account that env zero will use to read logs from your GCP project. * Navigate to IAM & Admin > Service Accounts in the GCP Console * Create a new `Service Account` * Ensure this Service Account is granted permissions to read logs. The [predefined roles/logging.viewer role](https://cloud.google.com/logging/docs/access-control#logging.viewer) is recommended for this purpose as it provides necessary read access to logs ![GCP IAM service accounts page with the new service account created and logging.viewer role assigned](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/616c5703d5046341d005d904b9b479ffc01d17a2f3af1e2a1c985287fc8b87ab-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=93cf18c61df8fd85bd24b448024ef968) #### Create a Workload Identity Pool and OIDC Provider Workload Identity Federation enables secure, keyless authentication for external identities like env zero. * Navigate to IAM & Admin > Workload Identity Federation * Create a new `Workload Identity Pool` * Within this pool, create a new `Workload Identity OIDC Provider` * For detailed instructions on this process, refer to the [env zero guide on OIDC with Google Cloud Platform](/guides/integrations/oidc-integrations/oidc-with-google-cloud-platform/#workload-identity-federation-pool-and-provider). ![GCP Workload Identity Federation page showing a new pool and OIDC provider being created](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/ad4832f35bd92ca701831098540ba162505c1078585fc7c63e2d82782ae6ef07-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=d5c2f4fe98df37964a2841ac3d1b54a7) #### Grant impersonation rights to the OIDC principal on the Service Account This step connects your newly created Service Account with the Workload Identity Pool, allowing env zero (via the OIDC provider) to impersonate the Service Account and assume its permissions. * From within your `Workload Identity Pool`, click on `Grant Access` * Select the `Grant access using service account impersonation` radio button * Choose the `Service Account` you created * For the `Subject` value, copy it directly from the env zero application by clicking on `Show OIDC` Token in the Cloud Account Wizard. This value uniquely identifies the env zero organization within your OIDC setup ![Workload Identity Pool Grant Access dialog with service account impersonation and Subject value from env zero](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/8e6023e6f25256e534c071bb22acb2bcad7b06e5641dfaf9fc99fa6ef8dcaa7b-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=d25ff2ecbf79ee2218dd4c9936ee6900) ![env zero Cloud Account wizard showing the Show OIDC Token button to copy the Subject value for GCP](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/0bbdfe9b899642ba3de7680f4a7e0488343437e1e7d9ad87d791e584e488a206-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=c503a5d674f3c20b6c67b95a31396117) #### Setting Up Access Configuration Once the GCP prerequisites are satisfied, you will configure the Cloud Account in env zero. ##### Fill the Account Config form ![env zero Cloud Account configuration form with Account name, Project ID, and JSON configuration fields](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/f1ffd2b0d5df98fdfd3d9ee5c7ec263b446efdd0b9029c0178a6c2131bfb31e0-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=7b7c78eb13e7eb046bfb089a30d1af5c) In the env zero Cloud Account configuration form, you'll need to specify the following details: `Account name`: A descriptive name for your account in env zero (for identification purposes only) `Project ID`: Your Google Cloud Project ID (the alphanumeric string identifier) `JSON configuration file content`: The content of the credential configuration file, explained in the next step. ##### Download the JSON configuration file content This JSON file contains the necessary credentials for env zero to authenticate with your GCP Workload Identity Pool Provider. * In your `Workload Identity Pool`, navigate to the `Connected Service Accounts` tab * Locate the `Service Account` you connected to the pool and click the `Download` button next to it * In the download dialog: * Select the `OIDC provider` you previously created * Enter "file.json" in the `OIDC ID token path` field * Select "json" in the `Format type` dropdown * Keep "access\_token" as the value in the `Subject` token field name * Click `Download config` ![GCP Connected Service Accounts download dialog with OIDC provider selected and JSON format chosen](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/fabf87b66e0770b8c777b8d64d51e43ed5280dc2f1a009c7b516367150f313c5-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=fc0d5180f1108a0b13e754518ca9981d) ## Next steps Once scans are running, map the GCP resources you deploy through env zero back to their environments with [Link environments to Cloud Compass](/guides/cloud-compass/cloud-compass/linking-environments-to-cloud-compass-resources). # Configure an Azure cloud account Source: https://docs.envzero.com/guides/cloud-compass/cloud-compass/configure-an-azure-cloud-account Connect an Azure subscription to env zero Cloud Compass by exporting activity logs to Log Analytics and granting OIDC permissions with Log Analytics Reader. ## Configure a Cloud Account You manage Cloud Compass cloud accounts from the [Settings](/guides/cloud-compass/cloud-compass#settings) section of the Cloud Compass dashboard. ![Cloud Account configuration wizard for Azure showing the initial setup form](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/eab87935ae549248283cdc93a2c6b339ca4e267b39929cf7b41b084368d683d6-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=b0f94b2f581709c5849e39c684e80f52) ## Requirements ### Export Activity Logs to an Azure Log Activity Workspace * Open the Azure Console and login to the relevant tenant * Go to the *Activity Log* service * Follow [Azure official procedure](https://learn.microsoft.com/en-us/azure/azure-monitor/essentials/activity-log?tabs=powershell#send-to-log-analytics-workspace) to send the activity logs to a Log Analytics Workspace * env zero reads and uses the *Administrative* logs only: ![Azure Diagnostic settings with Administrative log category selected for export to Log Analytics Workspace](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/ce2e715b63d1cd05d8293f31dc78283280816b65524179ba214366aab83db42e-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=983bf496f90e4a77686b0f436299d021) ### Grant permissions to env zero via OIDC * Open the Azure Console and login to the relevant tenant * Go to the *Microsoft Entra ID* service * Follow [this procedure](/guides/integrations/oidc-integrations/oidc-with-azure/#azure-ad-app-+-federated-credential) to configure a proper *App registration* * After the App registration is created, Go to the *Log Analytics Workspaces* service * Select the relevant Log Analytics Workspace, and select *Access Control (IAM)* from the left pane menu ![Azure Log Analytics Workspace Access Control (IAM) pane for assigning the Log Analytics Reader role](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/8f6d9c134d66017ba5849eabf46c7ab4d907d67752d4f90c65e0c8d9effafef2-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=70b67ad69b71ab0ce11ec57abb47ec00) * Click *+ Add* and select *Add role assignment* * Add the **Log Analytics Reader** permission to the relevant App registration To enrich the data and provide better insights into the account, the **Application.Read.All** permission is required. This permission enables the app to retrieve Azure AD application details, helping map app IDs to human-readable names for better account understanding. #### Adding the Permission in Azure Portal 1. Go to **Azure Active Directory** in the Azure portal. 2. Select your app under **App registrations**. 3. Navigate to **API permissions**, click **Add a permission**, select **Microsoft Graph**, choose **Application permissions**, and add **Application.Read.All**. 4. Click **Grant admin consent for \** under **Configured permissions**. You must have a role like Global Administrator to perform this action. #### Adding the Permission with Azure CLI You can also use the Azure CLI for this: 1. Add the permission: ```bash theme={null} az ad app permission add --id --api 00000003-0000-0000-c000-000000000000 --api-permissions 9a5d68dd-52b0-4cc2-bd40-abcf44ac3a30=Role ``` 2. Grant admin consent: ```bash theme={null} az ad app permission admin-consent --id ``` ## Next steps If you deploy Azure resources with env zero, [Link environments to Cloud Compass](/guides/cloud-compass/cloud-compass/linking-environments-to-cloud-compass-resources) explains how those resources are matched to their environments. # Configure an AWS cloud account Source: https://docs.envzero.com/guides/cloud-compass/cloud-compass/configure-cloud-accounts Connect your AWS account to env zero Cloud Compass by granting the cloud-scanner IAM role access to your S3 CloudTrail bucket and optionally KMS decryption. ## Configure a Cloud Account ![Cloud Account configuration wizard for AWS showing the initial setup form](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/b05512167de1147ec7998cdab31f0f59eedc824976e1093d090e988396f314c6-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=54409d0630b309e681739d1b91e62419) > [!WARNING] > > Additional Costs for Using Cloud Compass with AWS > > There could be additional costs for enabling Cloud Compass with AWS that only comes from outbound S3 traffic. This refers to data transferred from S3 buckets to external destinations, which will be charged according to AWS's standard S3 outbound data transfer rates. ### Requirements #### Ensure Active Cloud Trail * Open the AWS Console and login to the relevant account * Go to CloudTrail and in the left hand side menu select `Trails` * Make sure the trail is in a Logging status ![AWS CloudTrail Trails list showing a trail in Logging status](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/beb3073-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=1be5719afd8e4ce0d293260920ccaa3d) #### Grant Bucket Permissions * Go to S3 Console and choose the relevant bucket based on the name of the S3 bucket in the Trails. You can also click on the bucket name from the previous image. * Choose permission tab ![S3 bucket details page with the Permissions tab selected for the CloudTrail log bucket](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/be27527-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=14b6f88188d414e0f1bbf6d07621799c) * Go To Bucket Policy and click `Edit` * ![S3 bucket policy section with the Edit button to add the env zero read policy](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/c60858f-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=e9ac311ab85042dfbc5c618c5afa8205) Add the following policy to the list: ```json Policy theme={null} { "Sid": "AllowEnvZeroToReadCloudTrailEvents", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::913128560467:role/env0-cloud-scanner" }, "Action": [ "s3:GetBucketLocation", "s3:GetObject", "s3:ListBucket" ], "Resource": [ "arn:aws:s3:::", "arn:aws:s3:::/*" ] } ``` * Replace the placeholder ``with the bucket name. * Click on the `Save Changes` button * Click on the edit button in the Object Ownership section ![S3 bucket Object Ownership section with the edit button to select ACLs disabled mode](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/1c934f5-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=494e1a31f80d97ab323c933df038b052) * Select the `ACLs disabled (recommended)` option and click on the `Save Changes` button > [!WARNING] > > Object Ownership Mode > > We only able to read the cloud trails events when the Object Ownership in mode "ACLs disabled" > > ![S3 bucket Object Ownership set to ACLs disabled (recommended) option selected](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/ae3a3b5-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=1111f3c300e735b8060320393b40f3d1) #### Grant Decrypt Permission * This requirement is only necessary if encryption is enabled on the trail. * You can check if it is enabled by opening the trail and check if `Log file SSE-KMS encryption` is Enabled. ![AWS CloudTrail trail details showing Log file SSE-KMS encryption enabled status](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/da6f35b-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=91f3a9f630852a4f555ee45d1a7bc0b2) * If it is enabled, you should grant permission to the env zero role to decrypt the logs. * Open the "KMS Key Policy" - by clicking on the key URL from the previous image. ![AWS KMS Key Policy page showing the Edit button to add decrypt permission for the env zero role](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/0a7a073-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=79324b1966d33db4e12ae9314ed3f40b) * Click Edit, and add this policy to the list: ```json Policy theme={null} { "Sid": "AllowEnv0ToDecryptTrailLogs", "Effect": "Allow", "Principal": { "AWS": "arn:aws:iam::913128560467:role/env0-cloud-scanner" }, "Action": "kms:Decrypt", "Resource": "*" } ``` * Click `Save Changes` #### Setting Up Bucket Configuration Here you should specify account config including: * Account name (for identification only) * Bucket Name \[1] * Account ID \[1] * Prefix \[1] `(optional)` - this should match the prefix (if specified) when configuring the s3 bucket. See [AWS docs](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/tutorial-trail.html#:~:text=To%20make%20it%20easier%20to%20find%20your%20logs%2C%20create%20a%20new%20folder%20\(also%20known%20as%20a%20prefix\)%20in%20an%20existing%20bucket%20to%20store%20your%20CloudTrail%20logs). * Regions \[1] These fields are used to build the `Scanned Bucket URL` which will be used to fetch your cloud events. ![Bucket configuration form with fields for Account name, Bucket Name, Account ID, Prefix, and Regions](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/89a0617-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=2774c9e43e65b7c3f938fc9003c6780e) Once you have created your account, env zero will start fetching historical data for the past 90 days. The [Insights tab](/guides/cloud-compass/cloud-compass#insights) will show that a data fetching run has started. This process might take a few minutes, depending on the amount of events we need to ingest. ![Cloud Compass Insights tab showing a data fetching run in progress after account creation](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/1f52d0c-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=239b2c0fb5bbcd7e55bc1f179c8f82c0) Once the data is ready, you will be able to start exploring the dashboard insights. For more information about using the dashboard, click [here](/guides/cloud-compass/cloud-compass/#utilizing-the-cloud-compass-dashboard). env zero will now run on a daily basis to fetch new cloud activity, ensuring an accurate and up-to-date view of your cloud environment. ## Next steps To see which env zero environment each scanned AWS resource belongs to, read [Link environments to Cloud Compass](/guides/cloud-compass/cloud-compass/linking-environments-to-cloud-compass-resources). # Link environments to Cloud Compass Source: https://docs.envzero.com/guides/cloud-compass/cloud-compass/linking-environments-to-cloud-compass-resources Map env zero environments to discovered cloud resources in Cloud Compass using a resource identification engine that catalogs resources after each deployment. To use [Cloud Compass](/guides/cloud-compass/cloud-compass) and gain visibility into your existing cloud resources, env zero performs an identification and cataloging process for your resources at the end of each run. This lets you immediately view, directly from the Cloud Compass table, which [environments](/guides/admin-guide/environments) these resources belong to. ![Cloud Compass resource table with the Environment column showing the linked env zero environment name](https://mintcdn.com/envzero-b61043c8/DEMw5onAg75H1sCr/images/guides/cloud-compass/cloud-compass/87f70c07f0dbc1489d3ba17d366ada52a6d938d0142012b694e189a666ec429d-image.png?fit=max\&auto=format\&n=DEMw5onAg75H1sCr\&q=85\&s=da20a5c6da841095f3b488967ddb2419) You can see it under the 'Environment' column. > [!TIP] > > Supported Providers > > AWS - [https://search.opentofu.org/provider/hashicorp/aws/latest](https://search.opentofu.org/provider/hashicorp/aws/latest) > > Azure - [https://search.opentofu.org/provider/hashicorp/azurerm/latest](https://search.opentofu.org/provider/hashicorp/azurerm/latest) > > GCP - [https://registry.terraform.io/providers/hashicorp/google/latest](https://registry.terraform.io/providers/hashicorp/google/latest) ## Resource Matching Identifying and matching resources is no simple task, and we’ve developed a specialized engine to perform these matches and ensure unique identification. However, we may not be able to match all resources. If you encounter any gaps, feel free to contact our support team. ### Tips for Improving Resource Identification #### AWS For each provider block add those data resources blocks. ```yaml theme={null} provider "aws" { region = "us-east-1" } provider "aws" { alias = "eu-west-1" region = "eu-west-1" } data "aws_region" "current" {} data "aws_caller_identity" "current" {} data "aws_region" "west" { provider = aws.eu-west-1 } data "aws_caller_identity" "west" { provider = aws.eu-west-1 } ``` ## Next steps To query environments together with their matched cloud resources, see the Cloud Analyst [env zero model](/guides/cloud-analyst/cloud-analyst/env-zero-model), where state resources connect to cloud resources. # OpenTofu project Source: https://docs.envzero.com/guides/community-and-resources/community-and-open-source/opentofu env zero is a founding member of OpenTofu, the open-source Terraform-compatible IaC tool backed by the Linux Foundation with a large provider ecosystem. env zero is proud to be a founding member and active contributor to [OpenTofu](https://opentofu.org/), the open-source Infrastructure-as-Code (IaC) tool that serves as a drop-in replacement for Terraform. ## Our involvement As one of the founding companies behind OpenTofu, env zero helped establish this community-driven initiative in response to HashiCorp's license change from open-source to the Business Source License (BUSL). We believe that Infrastructure-as-Code tools should remain open-source and accessible to the entire community. env zero continues to actively contribute to OpenTofu's development and supports its mission to provide a reliable, flexible, and community-driven alternative to Terraform. ## Key benefits OpenTofu offers several advantages for Infrastructure-as-Code management: * **Drop-in replacement**: Seamlessly works with existing Terraform configurations * **Open-source**: Maintains the open-source principles that made Terraform successful * **Community-driven**: Developed by a diverse community of contributors * **Feature parity**: Maintains compatibility with Terraform while adding new capabilities * **Extensive ecosystem**: Access to 3,900+ providers and 23,600+ modules ## Getting started with OpenTofu To learn more about OpenTofu and get started, visit the [official OpenTofu website](https://opentofu.org/). > [card] [Visit OpenTofu](https://opentofu.org/) > > Explore OpenTofu's documentation, download the tool, and join the community > [!NOTE] > > OpenTofu is fully compatible with env zero's platform, allowing you to [use it in your Infrastructure-as-Code workflows](/guides/admin-guide/templates/opentofu) alongside Terraform, Pulumi, and [other supported tools](/guides/admin-guide/templates#template-types). ## Next steps If you run into problems moving your templates to OpenTofu, [contact env zero support](/guides/community-and-resources/support-and-help/support). # Terratag project Source: https://docs.envzero.com/guides/community-and-resources/community-and-open-source/terratag Terratag is the env zero CLI tool for applying consistent tags to AWS, GCP, and Azure resources across Terraform and Terragrunt codebases automatically. [Terratag](https://www.terratag.io/) is a CLI tool developed by env zero that applies tags or labels across your Infrastructure-as-Code (IaC) codebase. Terratag automatically applies consistent tags to AWS, GCP, and Azure resources across your Terraform or Terragrunt files. ## Getting started Visit the [official Terratag website](https://www.terratag.io/) to download the binary and view additional documentation. > [card] [Visit Terratag](https://www.terratag.io/) > > Download Terratag and view full documentation ## CLI flags All flags can also be set via environment variables using the pattern `TERRATAG_` (for example, `-tags` can be set with `TERRATAG_TAGS`). Command-line flags take precedence over environment variables. | Flag | Default | Description | | :- | :- | :- | | `-tags` | *(required)* | Tags to apply, as a valid JSON object. Example: `'{"env":"prod","team":"platform"}'` | | `-dir` | `.` | Directory to recursively search for `.tf` files | | `-type` | `terraform` | IaC type. Valid values: `terraform`, `terragrunt`, `terragrunt-run-all` | | `-filter` | `.*` | Apply tags only to resource types matching this regex | | `-skip` | *(none)* | Exclude resource types matching this regex from tagging | | `-skipTerratagFiles` | `true` | Skip files that were previously tagged by Terratag | | `-rename` | `true` | Rename tagged files to `.terratag.tf`. Set to `false` to edit files in place | | `-keep-existing-tags` | `false` | Preserve existing tags when merging. By default, new tags override existing ones | | `-default-to-terraform` | `false` | Use Terraform even when OpenTofu is installed | | `-verbose` | `false` | Enable verbose logging | | `-version` | `false` | Print the version and exit | > [!NOTE] > > Terratag is part of the env zero platform ecosystem and integrates with env zero's Infrastructure-as-Code management capabilities. env zero uses it to tag resources for [cost monitoring](/guides/cost-monitoring/cost-monitoring) and to apply [custom resource tags](/guides/admin-guide/additional-controls#adding-custom-resource-tagging). ## Next steps For questions about Terratag behavior in your deployments, reach out to [env zero support](/guides/community-and-resources/support-and-help/support). # env zero API access Source: https://docs.envzero.com/guides/community-and-resources/support-and-help/api-access Authenticate to the env zero REST API with an API key, make a first request, and handle rate limits, pagination, and errors. The env zero REST API is served from `https://api.env0.com`. The [API reference](/api-reference) lists every endpoint. This page covers what applies to all of them: authentication, rate limits, pagination, and errors. To work from a terminal or CI without writing HTTP calls, use the [env zero CLI](/guides/community-and-resources/support-and-help/env-zero-cli). ## Authentication The API uses HTTP Basic authentication. Send the API key ID as the username and the API key secret as the password on every request. | Key | Created in | Permissions | | :- | :- | :- | | Admin API key | **Organization Settings** > **API Keys**, by an organization admin | Organization Admin | | User API key | **Organization Settings** > **API Keys**, by an organization admin | The roles you assign it, like a user | | Personal API key | **Personal settings** > **Personal API Keys**, by any user | The permissions of the user who created it | Admin and user API keys can also be [read-only](/guides/admin-guide/user-role-and-team-management/api-keys#read-only-api-key). To create and delete keys, see [API keys](/guides/admin-guide/user-role-and-team-management/api-keys). The CLI manages them with [`env0 api-key` and `env0 personal-api-key`](/guides/community-and-resources/support-and-help/env-zero-cli/command-reference#api-keys). env zero caches a successful authentication for up to 1 hour. Deleting a key, or changing its permissions, can take up to 1 hour to apply. If your organization has an [IP allowlist](/guides/overview/security-overview/ip-allowlisting), or the key has its own [allowed IPs](/guides/overview/security-overview/ip-allowlisting#allowed-ips-for-one-api-key), API key requests from addresses outside them fail with `401`. ## Make your first request **1. Create an API key** Create a key as described in [API keys](/guides/admin-guide/user-role-and-team-management/api-keys). The secret is shown once, so copy the key ID and secret before you close the dialog. **2. Export the key** ```bash theme={null} export ENV0_API_KEY_ID="" export ENV0_API_KEY_SECRET="" ``` The env zero CLI reads the same variables. **3. List your organizations** ```bash theme={null} curl -s -u "$ENV0_API_KEY_ID:$ENV0_API_KEY_SECRET" https://api.env0.com/organizations | jq '.[] | {id, name}' ``` The response lists each organization the key can access: ```json theme={null} { "id": "3f2b8c1e-7d4a-4e9b-a6c5-0b1d2e3f4a5b", "name": "Acme" } ``` Pass an organization `id` as the `organizationId` query parameter to endpoints such as [List Projects](/api-reference/projects/list-projects) and [List Environments](/api-reference/environments/list-environments). ## Rate limits Requests are counted per source IP address, HTTP method, and URL path, over the last 60 seconds: | Requests | Limit per 60 seconds | | :- | :- | | `GET /environments`, `POST` to any path that starts with `/environments`, and `PUT` to any path under `/environments/deployments/` | 200 | | All other requests | 1,000 | The URL path is counted without the query string. `POST /environments//deployments` and `POST /environments//deployments` have separate limits. `GET /environments?projectId=` and `GET /environments?projectId=` share one. A request over the limit gets `429 Too Many Requests` with a plain-text body. There is no `Retry-After` header. Back off and retry. Requests succeed again once the count for the last 60 seconds drops below the limit. ## Pagination List endpoints page in one of three ways. Each endpoint's API reference page lists the parameters it accepts. Endpoints without paging parameters, such as [List Organizations](/api-reference/organization/list-organizations), return every row in one response. ### Offset and limit [List Environments](/api-reference/environments/list-environments) and [List Deployments](/api-reference/environments/list-deployments) take `limit` (rows per page) and `offset` (rows to skip, default `0`). List Environments returns at most 100 rows per page. ```bash theme={null} curl -s -u "$ENV0_API_KEY_ID:$ENV0_API_KEY_SECRET" \ "https://api.env0.com/environments?organizationId=&limit=100&offset=100" ``` Advance `offset` by the number of rows each page returned, and stop when a page is empty. List Deployments can return fewer rows than `limit` while more remain, to keep the response under its size limit, so a short page is not always the last one. ### Page key [Fetch Audit Logs](/api-reference/audit-events/fetch-audit-logs) returns `events` and a `nextPageKey`. Pass `nextPageKey` as `offset` to get the next page. The last page has no `nextPageKey`. With filters, a page can have no events and still return a `nextPageKey`, so keep going until it is absent. `limit` defaults to 50, with a maximum of 1,000. ### Page number Cloud Compass resource lists, such as [List Cloud Compass Managed Resources Of An Environment](/api-reference/cloud-compass/list-cloud-compass-managed-resources-of-an-environment), take `page` (starting at `1`) and `pageSize`, and return the `total` row count. ## Errors Errors use standard HTTP status codes. Errors from env zero services have a plain-text body, so read it as text. A `401`, and a `403` for a path that doesn't exist, come from the API gateway instead and have a JSON body with a `message` field. A `400` body looks like this: ```text theme={null} /body must have required property 'name', /body must have required property 'organizationId' ``` | Status | Meaning | | :- | :- | | `400` | Invalid input. The message names the field. | | `401` | Missing or invalid credentials, or an address outside your organization's IP allowlist or the key's allowed IPs. The body is `{"message":"Unauthorized"}`. | | `403` | The key is missing a permission. The message names the permissions to add. A `403` whose message mentions `Credential` and `Signature` means the path or method does not exist. Check the URL against the [API reference](/api-reference). | | `404` | The resource does not exist. | | `409` | Conflict with an existing resource, such as an API key name already in use. | | `429` | Rate limit reached. See [Rate limits](#rate-limits). | | `500` | Unexpected error. The message includes a request ID. | Every response has an `x-amzn-requestid` header. Include it, or the request ID from a `500` message, when you [contact support](/guides/community-and-resources/support-and-help/support). ## Next steps To give AI assistants and IDEs access to env zero with an API key, set up the [env zero MCP server](/guides/community-and-resources/support-and-help/mcp-server). # env zero CLI Tool Source: https://docs.envzero.com/guides/community-and-resources/support-and-help/env-zero-cli Install the env zero CLI to deploy, inspect, and manage environments from your terminal or CI, with JSON output and stable exit codes for scripts. The env zero CLI is a single binary for managing your environments and deployments from the terminal or CI. It reads environments, deployments, plans, projects, and templates, and acts on them: create, deploy, destroy, archive, and approve, cancel, or abort a deployment. Output is JSON on stdout, errors go to stderr, and exit codes are stable, so it fits cleanly into scripts. > [!WARNING] > > The old CLI, the Node package `@env0/cli` version 1.x, is deprecated. The current CLI is a single binary and is the recommended way to use env zero from the terminal. Pin `@env0/cli@^1` to stay on the old one while you [migrate](#migration-from-v1). ## Prerequisites * An env zero account with appropriate permissions * A cloud credential assigned to the project you deploy into, so deployments can authenticate to your cloud provider ## Step 1: Install ```bash Homebrew theme={null} brew install env0/tap/env0 ``` ```bash npm theme={null} npm install -g @env0/cli@2 ``` Homebrew covers macOS and Linux. The npm package installs the same binary, where version 2 is the current CLI. Binaries are also on the [latest release](https://github.com/env0/homebrew-tap/releases/latest). Verify with `env0 version`. ## Step 2: Sign in On your own machine, sign in through the browser: ```bash theme={null} env0 login ``` This confirms a short code, signs you in, and lets you pick a default organization and project. The session is stored in your OS keychain when available, so later commands need no flags. Use `--no-browser` to print the URL instead, and `env0 status` or `env0 logout` to check or clear the session. ### From CI Browser login needs a terminal, so automation uses an API key instead (any env zero key works). Create one under **Organization Settings → API Keys**, or from a signed-in CLI: ```bash theme={null} env0 api-key create --name ci-runner --role User --project-role =Deployer --yes -o compact ``` `--role` is required. Use `env0 personal-api-key create --name --yes` instead for a key that carries your own permissions. See [API keys](/guides/community-and-resources/support-and-help/env-zero-cli/command-reference#api-keys) for which to choose. Set the returned `apiKeyId` and `apiKeySecret` as environment variables: ```bash theme={null} export ENV0_API_KEY_ID= export ENV0_API_KEY_SECRET= ``` > [!WARNING] > > Copy the API key secret when you create it. It is not shown again. > [!TIP] > > You can also pass `--api-key-id` and `--api-key-secret` on a single command. ## Step 3: Deploy `environment create` provisions a new environment and starts its first deployment. `environment deploy` runs a new deployment on one that already exists. Add `--wait` to either to block until it finishes and take the exit code from its result: ```bash theme={null} env0 environment create --name my-environment --project --template --wait env0 environment deploy --wait ``` To create from a git repository instead, use `--repository` with `--type` (for example `terraform`) and `--organization`. While a deploy waits, step logs (git clone, then plan and apply for Terraform or OpenTofu) stream to stderr. Add `--ttl 2h` to `create` to have env zero destroy the environment after two hours. Actions take an environment id, not a name. Resolve a name to an id with: ```bash theme={null} env0 environment list --name my-environment --project -o compact | jq -r '.data[0].id' ``` ## Step 4: Approvals When an environment requires approval, its deployment pauses. Find the deployment id (the `deploy` output carries it at `.data.id`, or list the latest one): ```bash theme={null} env0 deployment list --environment --limit 1 -o compact | jq -r '.data[0].id' ``` Then act on it: ```bash approve theme={null} env0 deployment approve ``` ```bash cancel theme={null} env0 deployment cancel ``` Set the gate per run with `--requires-approval` on `environment deploy` or `destroy`, and stop a running deployment with `env0 deployment abort `. ## Step 5: Inspect, destroy, and archive Read commands print JSON for `jq`. Use `-o compact` for one line or `-o table` for a readable view: ```bash theme={null} env0 environment list --project env0 context env0 deployment logs ``` `env0 context` returns an environment's state, recent deployments, and a drift or failure summary in one call, so it is a fast way to see why something failed. Every command and flag is listed in the [command reference](/guides/community-and-resources/support-and-help/env-zero-cli/command-reference). Destroy an environment when you no longer need it. This deletes real infrastructure, so it requires confirmation: ```bash theme={null} env0 environment destroy --yes ``` Archiving is the other way to clear an environment. It tells env zero to stop tracking the environment without running a deployment, so its cloud resources are left alone: ```bash theme={null} env0 environment archive ``` Use it when you want to keep the infrastructure, and when Destroy is not available because the environment has never deployed. See [mark an environment as inactive](/guides/admin-guide/environments#mark-an-environment-as-inactive) for what changes. To bring an archived environment back, redeploy it with `env0 environment deploy `. Projects archive the same way, with one difference: [archiving a project cannot be undone](/guides/admin-guide/projects#archive-a-project). ```bash theme={null} env0 project archive ``` ## Use the CLI with AI agents The CLI is built for agents and scripts, not only people: JSON on stdout, errors on stderr, [stable exit codes](/guides/community-and-resources/support-and-help/env-zero-cli/command-reference#exit-codes), and `env0 context` for one-request diagnosis. In an agent or CI context, authenticate with the `ENV0_API_KEY_ID` and `ENV0_API_KEY_SECRET` environment variables rather than browser login. ### Install the skill `env0 skill install` writes a usage guide into your coding agent's config, so it knows the commands, flags, and output without you explaining them: ```bash theme={null} env0 skill install ``` It installs for Claude Code by default. Use `--agent cursor`, `--agent codex`, or `--agent copilot` for others, `--global` to install for your user account instead of the project, or `--path` for a specific file. `env0 skill show` prints the guide and `env0 skill uninstall` removes it. The same guide ships as an asset on every release, so you can download it without the CLI from the [latest release](https://github.com/env0/homebrew-tap/releases/latest). ## Migration from v1 The old CLI was the Node package `@env0/cli` version 1.x. The current CLI covers the same actions and adds a full read and diagnosis surface, but it is not a drop-in replacement: it targets environments by id, renames two environment variables, and prints JSON by default instead of streaming logs. Pin the old one while you migrate: ```bash theme={null} npm install -g @env0/cli@^1 ``` ### Install and authentication | v1 | Current CLI | | :- | :- | | `npm install -g @env0/cli` | `brew install env0/tap/env0` or `npm install -g @env0/cli@2` | | `env0 configure` | `env0 login`, then `env0 project use ` | | `ENV0_API_KEY` | `ENV0_API_KEY_ID` | | `ENV0_API_SECRET` | `ENV0_API_KEY_SECRET` | `ENV0_ORGANIZATION_ID`, `ENV0_PROJECT_ID`, and `ENV0_API_URL` are unchanged. `ENV0_ENVIRONMENT_NAME` and `ENV0_BLUEPRINT_ID` are no longer read. ### Commands | v1 | Current CLI | | :- | :- | | `env0 deploy` (existing environment) | `env0 environment deploy ` | | `env0 deploy` (first run, creates it) | `env0 environment create --template ` (or `--repository`) | | `env0 destroy` | `env0 environment destroy --yes` | | `env0 approve` | `env0 deployment approve ` | | `env0 cancel` | `env0 deployment cancel ` | ### Flags Legacy flags map across, though some now belong to a specific command: * `environment deploy`: `-v` to `--var`, `-q` to `--secret`, `-u` to `--tf-var`, `-r` to `--revision`, `-t` to a repeatable `--target`, `-a` to `--requires-approval` * `environment destroy`: `-a` to `--requires-approval`, `-z` to `--skip-state-refresh`, plus `--checkout-updated-code` * `environment create`: `-w` to `--workspace-name` (set once at creation, cannot change later), plus the same variable, `--revision`, and `--requires-approval` flags as deploy The old CLI acted by name and blocked while streaming logs to stdout. The current CLI acts by id and returns the started deployment right away. Add `--wait` to block and stream logs to stderr, or run `env0 deployment logs --follow` to stream them to stdout. ## Next steps * [Deploy a workflow from the CLI](/guides/community-and-resources/support-and-help/env-zero-cli/workflows), with a different branch and variables per sub-environment * [Manage API keys](/guides/admin-guide/user-role-and-team-management/api-keys) for CI and other automation * [Troubleshoot CLI errors](/guides/community-and-resources/support-and-help/env-zero-cli/troubleshooting) when a command fails or returns unexpected results # env zero CLI command reference Source: https://docs.envzero.com/guides/community-and-resources/support-and-help/env-zero-cli/command-reference Every env zero CLI command and flag, with authentication and stored context, the JSON output envelope, pagination, exit codes, and telemetry. This page covers env zero CLI version 2.7.0. Run `env0 --help` to print the flags of the version you have installed. To install the CLI and run a first deployment, see [env zero CLI](/guides/community-and-resources/support-and-help/env-zero-cli). ## Global flags and environment variables Every command accepts these flags: | Flag | Environment variable | Default | Description | | :- | :- | :- | :- | | `--api-key-id` | `ENV0_API_KEY_ID` | none | API key id | | `--api-key-secret` | `ENV0_API_KEY_SECRET` | none | API key secret | | `--api-url` | `ENV0_API_URL` | `https://api.env0.com` | env zero API host | | `-o`, `--output` | none | `json` | Output format: `json`, `compact`, or `table` | The CLI also reads these environment variables: | Variable | Description | | :- | :- | | `ENV0_ORGANIZATION_ID` | Organization, by id or name, for commands that take `--organization` | | `ENV0_PROJECT_ID` | Project for commands that take `--project` | | `ENV0_CONFIG_HOME` | Directory for stored context. The CLI writes to an `env0` folder inside it. Defaults to your OS user config directory. | | `ENV0_TELEMETRY_DISABLED`, `DO_NOT_TRACK` | Turn off [telemetry](#telemetry) | | `ENV0_CLIENT` | Tag that telemetry reports instead of `cli`. Set it when you embed the CLI in another tool. | Each value resolves in this order: flag, then environment variable, then stored context, then default. In CI and agents, set the environment variables so each run is explicit and does not depend on stored state. Anywhere a command takes an organization (`--organization`, `ENV0_ORGANIZATION_ID`, or the argument of `organization use` and `organization get`), you can pass the organization's name instead of its id. The name must match exactly one organization your credentials can see, ignoring case and extra spaces. Several matches exit `2` and list their ids, no match exits `4`, and a name made only of spaces exits `64`. A value shaped like a UUID is always treated as an id. A name costs one extra request to list your organizations, so scripts should pass ids. ## Sign-in and stored context `env0 login` stores credentials and a default host, organization, and project, so later commands need no flags. * **Browser sign-in.** With no API key set and a terminal attached, `login` opens a browser sign-in and asks you to confirm a short code. `--no-browser` prints the URL instead. * **API key.** When `--api-key-id` and `--api-key-secret` (or `ENV0_API_KEY_ID` and `ENV0_API_KEY_SECRET`) are set, `login` validates and stores that key. * **No key and no terminal.** `login` exits `3`. CI and agents should set the API key environment variables and skip `login`. On a terminal, `login` then asks you to pick an organization and project, and the `--organization` and `--project` flags skip the matching picker. Without a terminal, it stores the `--organization` and `--project` you pass. Credentials are stored in the OS keychain. If the keychain write fails, the CLI writes them to a plain-text file readable only by your user, prints a `warning:` line on stderr naming the file, and still exits `0`. `env0 logout` removes that file. Credentials are scoped to the API host they were issued for. Signing in to a second host does not sign you out of the first, and a host you have not signed in to exits `3` even when another host is authenticated. The host, organization, and project are stored once, in `config.json`, so switching hosts means running `login` again. Browser sign-in works out which env zero tenant to use from the API host. For a host outside `env0.com`, it exits `64` unless you pass `--tenant`. API keys work against any host. ## Output Every command prints one JSON envelope, except `env0 skill show` (raw Markdown), `env0 deployment logs --follow` (a [log stream](#deployment-logs)), and [`env0 api`](#api) (the raw response body). Data goes to stdout and errors go to stderr: ```json theme={null} { "apiVersion": "0.1", "data": { } } ``` ```json theme={null} { "apiVersion": "0.1", "error": { "type": "not_found", "message": "...", "hint": "...", "host": "https://api.env0.com" } } ``` * `-o json` prints indented JSON. `-o compact` prints the same JSON on one line, for `jq`. `-o table` prints aligned columns. * On error, stdout is empty and the exit code is non-zero, so `env0 ... -o compact | jq .data` is safe. * Arrays are always arrays. An empty result is `[]`, never `null` or a missing key. * `error.host` names the host the CLI was pointed at. It is absent for `usage` errors and for failures before a host is chosen. Credentials and paths are removed from it. ### Pagination `environment list`, `deployment list`, and `plan list` return at most 100 rows by default and add a `page` object next to `data`: ```json theme={null} { "apiVersion": "0.1", "data": [ ], "page": { "truncated": true, "nextOffset": 100 } } ``` `"truncated": true` means more rows exist. Pass `--all` to fetch every page. `--limit` accepts 1 to 100. `organization list`, `project list`, and `template list` are not paginated. They return the whole collection and take no `--limit` or `--all`. ## Exit codes | Code | `error.type` | Meaning | | :- | :- | :- | | `0` | none | Success | | `1` | `unknown` | Unexpected error, a `--wait` or `--follow` deployment that ended in a failed state, or an [`environment apply`](#environment-apply) or [`environment destroy -f`](#environment-destroy) in which any environment failed | | `2` | `user_input`, `conflict` | The backend rejected well-formed input, or the resource is in a conflicting state | | `3` | `auth` | Missing credentials, or no permission for the operation or resource | | `4` | `not_found` | The resource does not exist | | `64` | `usage` | Wrong invocation: unknown command or flag, missing or conflicting arguments, `--limit` outside 1 to 100, `--tail` below 1 or an unknown `--step` on `deployment logs`, or an unplaceable sign-in host | | `75` | `transient` | Retry later. Also returned when `--wait` hits its `--timeout` before the deployment finishes. | With `--wait` or `deployment logs --follow`, the exit code reflects the deployment's final status: | Final status | Exit code | | :- | :- | | `SUCCESS`, `SKIPPED`, `WAITING_FOR_USER` | `0` | | `FAILURE`, `INTERNAL_FAILURE`, `TIMEOUT`, `CANCELLED`, `ABORTED` | `1` | The deployment is printed to stdout in both cases, including `failedCommand` and `errorMessage` when it failed. `WAITING_FOR_USER` means the deployment needs approval, not that it failed. ## context ```bash theme={null} env0 context [--deployments ] [--inventory] ``` Returns an environment's state, recent deployments, and a failure summary in one call. Read `.data.summary` first, then `.data.deployments`, then [`deployment logs`](#deployment-logs) for the full error. | Flag | Default | Description | | :- | :- | :- | | `--deployments` | `5` | Number of recent deployments to include, 1 to 100 | | `--inventory` | off | Add an `inventory` block with the cloud resources behind the environment. See [Cloud inventory](#cloud-inventory). | The output has these keys: * `environment`: the same object `environment get` returns. * `deployments`: recent deployments, newest first. * `summary`: drift status and the latest deployment's status and type. When that deployment failed (`FAILURE`, `INTERNAL_FAILURE`, or `TIMEOUT`), it also carries `failedCommand`, a truncated `errorMessage`, and `exitCode`. It carries `costEstimation` when the environment has one. * `subEnvironments`: for a workflow environment, each sub-environment's alias, plus the revision and status of its latest deployment. * `inventory`: only with `--inventory`. It holds `resources` (the count of cloud resources the environment manages), `unmanaged` (the count of resources [Cloud Compass](#cloud-inventory) attributes to the environment that its state does not hold), `drifted` (the count of drifted resources), `resourceTypes` (a list with the managed and drifted counts for each resource type), and `insights` (CloudQuery insight counts by severity on those resources). `resources` is absent when Cloud Compass cannot read the environment's managed state. `drifted` and the drift in `resourceTypes` are absent when drift detection is off for the environment or Cloud Compass cannot read drift. A Cloud Compass problem never fails `context`: with no connection the block is `{"connected": false, "reason": "..."}`, and on any other error it carries only `error`. ## Organizations ### organization list ```bash theme={null} env0 organization list ``` Lists every organization you can access. `org` is an alias for `organization`. ### organization get ```bash theme={null} env0 organization get ``` ### organization use ```bash theme={null} env0 organization use [] ``` Stores a default organization for later commands. Takes an organization name or id. Without one on a terminal, it shows a picker you can type to filter. ## Projects ### project list ```bash theme={null} env0 project list [--organization ] ``` Lists every project in the organization. ### project get ```bash theme={null} env0 project get ``` ### project create ```bash theme={null} env0 project create --name [--organization ] [flags] ``` | Flag | Description | | :- | :- | | `--name` | Project name. Required. | | `--organization` | Organization to create the project in | | `--description` | Project description | | `--parent` | Parent project id, to nest the new project under it | | `--tag` | Project tag. Repeatable. | The new project does not become your stored project. Pass its id (`.data.id`) as `--project` to later commands, or run `env0 project use `. Requires permission to create projects in the organization. ### project archive ```bash theme={null} env0 project archive ``` Archives the project. `project get` and `project list` still return it with `isArchived: true`. The CLI cannot unarchive a project, and [archiving a project cannot be undone](/guides/admin-guide/projects#archive-a-project). ### project use ```bash theme={null} env0 project use [] ``` Stores a default project, and its organization, for later commands. Without an argument on a terminal, it shows a picker of the stored organization's projects that you can type to filter. A name, or a `Parent / Child` path, is looked up in the current organization and must match exactly, ignoring case. A full path wins over a nested project's own name, so `web` picks a top-level `Web` before `Platform / Web`. Archived projects are skipped. Several matches exit `2` and list their ids. No match exits `4` and names similar projects. ## Templates ### template list ```bash theme={null} env0 template list (--organization | --project ) ``` Lists templates in exactly one scope. Passing both flags, or neither with no stored context, exits `64`. ### template get ```bash theme={null} env0 template get ``` ### template create ```bash theme={null} env0 template create --name --repository --type [flags] ``` | Flag | Description | | :- | :- | | `--name` | Template name. Required. | | `--repository` | Git repository URL. Required. A trailing `.git` is removed. | | `--type` | IaC type, for example `terraform`, `opentofu`, `terragrunt`, or `workflow`. Required. | | `--organization` | Organization to create the template in. Required unless stored. | | `--project` | Project to assign the new template to. Defaults to the stored project. | | `--path` | Path to the IaC code in the repository | | `--revision` | Default branch or tag | | `--iac-version` | IaC tool version. Terraform defaults to `RESOLVE_FROM_TERRAFORM_CODE`, OpenTofu to `latest`. | | `--vcs-connection-id` | [VCS connection](#vcs-list) for a private repository | | `--github-installation-id` | GitHub App installation id for a private repository | | `--token-id` | VCS token id for a private repository | | `--gitlab` | The repository is hosted on GitLab | Requires permission to manage templates in the organization. ### template assign ```bash theme={null} env0 template assign --project ``` Assigns a template to a project. `environment create --template` only deploys templates assigned to the target project. ### template delete ```bash theme={null} env0 template delete ``` Removes the template from `template list`. `template get` can still return the record. ## Environments `env` is an alias for `environment`. Actions take an environment id, not a name. ### environment list ```bash theme={null} env0 environment list [flags] ``` | Flag | Description | | :- | :- | | `--project` | Filter by project | | `--organization` | Filter by organization name or id | | `--name` | Filter by exact name. Not a substring match. | | `--tag` | Filter by `KEY` or `KEY=VALUE`. Repeatable. An environment matches if it carries any of the tags. | | `--limit` | Maximum rows, 1 to 100 | | `--all` | Fetch every page | All filters are optional and combine. The list does not include workflow sub-environments. To see them, run [`context`](#context) on the workflow environment. ### environment get ```bash theme={null} env0 environment get ``` The output always includes `tags`, as `{}` when the environment has none. ### environment create ```bash theme={null} env0 environment create --name --project (--template | --repository ) [flags] ``` Creates an environment and starts its first deployment. The output is that deployment. With `--wait`, its `environmentId` is the new environment's id. | Flag | Description | | :- | :- | | `--name` | Environment name. Required. | | `--project` | Project to create the environment in. Required unless stored. | | `--template` | Template to deploy. Use this or `--repository`. | | `--repository` | Git repository to deploy without a template. A trailing `.git` is removed. Requires `--type` and `--organization`. | | `--type` | IaC type for `--repository`, for example `terraform`, `opentofu`, `terragrunt`, or `workflow` | | `--organization` | Organization. Required with `--repository`. | | `--path` | Path to the IaC code in the repository, with `--repository` | | `--revision` | Branch or tag to deploy | | `--iac-version` | IaC tool version, with `--repository`. Terraform defaults to `RESOLVE_FROM_TERRAFORM_CODE`, OpenTofu to `latest`. | | `--vcs-connection-id` | [VCS connection](#vcs-list) for a private repository | | `--github-installation-id` | GitHub App installation id for a private repository | | `--token-id` | VCS token id for a private repository | | `--gitlab` | The repository is hosted on GitLab | | `--workspace-name` | Terraform workspace name. Set once at creation and cannot be changed. | | `--var` | Environment variable as `KEY=VALUE`. Repeatable. | | `--secret` | Sensitive environment variable as `KEY=VALUE`. Repeatable. | | `--tf-var` | Terraform variable as `KEY=VALUE`. Repeatable. | | `--requires-approval` | Require approval before each deployment, including the first | | `--ttl` | Lifespan as a duration (`2h`) or RFC 3339 timestamp, after which env zero destroys the environment. The minimum is `1h`. See [environment ttl](#environment-ttl-set). | | `--tag` | Tag as `KEY=VALUE`. Repeatable. Repeat a key to give it several values. | | `--comment` | Deployment comment | | `-f`, `--manifest` | Workflow manifest file, with `--template`. See [Deploy workflows with the CLI](/guides/community-and-resources/support-and-help/env-zero-cli/workflows). | | `--wait` | Wait for the deployment to finish. See [Waiting for a deployment](#waiting-for-a-deployment). | | `--quiet` | With `--wait`, do not stream logs to stderr | | `--poll-interval` | How often `--wait` polls. Default `5s`. | | `--timeout` | How long `--wait` waits. Default `1h`. | A `--repository` environment gets a single-use template that needs no cleanup. When no [cloud credential](/guides/getting-started/connect-your-cloud-account) is assigned to the project, pass provider credentials as `--secret`, for example `--secret AWS_ACCESS_KEY_ID=...`. An assigned credential keeps keys out of your shell history and process list. ### environment deploy ```bash theme={null} env0 environment deploy [flags] ``` Starts a deployment and prints it. A deployment started while another is running is queued, not rejected. | Flag | Description | | :- | :- | | `--revision` | Branch or tag to deploy | | `--target` | Resource target. Repeatable. | | `--var`, `--secret`, `--tf-var` | Variables, as on `environment create`. Repeatable. | | `--requires-approval` | Require approval for this deployment. `--requires-approval=false` skips it. Omit to keep the environment's setting. | | `--comment` | Deployment comment | | `-f`, `--manifest` | Workflow manifest file | | `--node` | Deploy only this workflow sub-environment, by alias | | `--run-from-here` | With `--node`, also deploy every sub-environment downstream of it | | `--wait`, `--quiet`, `--poll-interval`, `--timeout` | As on `environment create` | | `--pretty` | Print a readable summary and step headings instead of JSON. Cannot be combined with `-o`. | `--manifest`, `--node`, and `--run-from-here` are covered in [Deploy workflows with the CLI](/guides/community-and-resources/support-and-help/env-zero-cli/workflows). ### environment plan ```bash theme={null} env0 environment plan [flags] ``` Previews what a deployment would change without applying anything. It starts a dry run, which is a plan-only deployment, always waits for it, streams its logs to stderr, and prints the finished deployment to stdout. The deployment's `type` is `dryRun`, and its `planSummary` counts the planned changes. | Flag | Description | | :- | :- | | `--project` | Project to look the environment name up in. Defaults to `ENV0_PROJECT_ID` or the stored project. | | `--quiet` | Do not stream the plan's logs to stderr | | `--poll-interval` | How often the command polls. Default `5s`. | | `--timeout` | How long the command waits. Default `1h`. | * Pass an environment id or a name. A value shaped like a UUID is treated as an id. A name is looked up as `environment list --name` looks it up, except that archived environments are skipped. * Names are not unique within a project, so the CLI never guesses. No match exits `4`. Several matches exit `2` and list each match's id and status. An empty name exits `64`. * An archived environment is refused with exit `2`, because a dry run would unarchive it. * The exit code follows the dry run as `--wait` does: `0` when it finished, `1` when the plan failed (read `failedCommand` and `errorMessage`), and `75` when `--timeout` runs out while the dry run may still be running. * If the environment already has a deployment waiting for approval, the dry run queues behind it. The CLI says so on stderr, even with `--quiet`. * A dry run that stops at `WAITING_FOR_USER` while the command waits has finished its plan. The CLI cancels it so nobody can approve it, prints it with status `CANCELLED`, and exits `0`. * For a workflow environment, the workflow's own dry run has no steps and no `planSummary`. Each sub-environment runs its own dry run. When the workflow's dry run ends, stderr lists each sub-environment by alias with its status, plan counts, and deployment id. Read a sub-environment's full plan with [`deployment logs`](#deployment-logs). ### environment apply ```bash theme={null} env0 environment apply -f [flags] ``` Creates or deploys every environment a YAML or JSON file lists, in parallel. Use it to bring up a set of environments, such as a test workspace made of several workflow environments. | Flag | Description | | :- | :- | | `-f`, `--file` | File that lists the environments. Required. | | `--project` | Project for entries that do not set one. Defaults to `ENV0_PROJECT_ID` or the stored project. | | `--only-failed` | Skip environments whose latest deployment did not fail, and rerun only the failed sub-environments of a failed workflow | | `--wait` | Poll every started deployment until it reaches a final status | | `--poll-interval` | How often `--wait` polls. Default `5s`. | | `--timeout` | How long `--wait` waits for each deployment. Default `1h`. | Each entry is a deploy manifest, with the same `revision`, `variables`, and `subEnvironments` as [`--manifest`](/guides/community-and-resources/support-and-help/env-zero-cli/workflows), plus these fields: | Field | Description | | :- | :- | | `name` | Environment name. Required. | | `template` | Template to create the environment from. Used only when the environment does not exist yet. | | `project` | Project id. Defaults to `--project`, `ENV0_PROJECT_ID`, or the stored project. | | `requiresApproval` | Approval gate for every create and deploy of this entry. Omit it to keep the environment's setting, or the project's default for a new environment. | | `ttl` | Lifespan, as with [`environment create --ttl`](#environment-create). Applies only on create. | | `tags` | Tags as `KEY=VALUE`. Repeat a key for several values. Applies only on create. | ```yaml theme={null} environments: - name: payments-test template: requiresApproval: false ttl: 8h tags: [team=payments, purpose=test] variables: - name: DISABLE_REWARDS value: "false" - name: wallet-test template: subEnvironments: wallet-api: revision: feature/new-limits ``` ```bash theme={null} env0 environment apply -f workspace.yaml --wait -o compact env0 environment apply -f workspace.yaml --only-failed --wait -o compact ``` * An environment is found by its exact name in its project, and case counts. Archived environments are ignored. If none exists, `apply` creates it from `template`. If one exists, `apply` redeploys it with the entry's revision, variables, and sub-environment overrides. Two live environments with the same name exit `2`. * Most checks run before anything changes. An unknown field, an entry listed twice, a missing `template` for an environment that does not exist yet, a bad `ttl` or tag, or sub-environment overrides for an environment that is not a workflow exit `64`, and nothing is created or deployed. A wrong sub-environment alias gets the same result only where `apply` can read the workflow's aliases up front, which is an existing workflow environment that has already read its workflow file. For a new workflow environment, or an existing one that has never read its workflow file because its first deployment failed early or has not reached it, `apply` checks aliases only after it creates the environment or starts the deployment. A wrong alias there becomes that environment's `error` with type `usage`, the command exits `1`, and the other environments still deploy. * env zero rejects approval on workflow environments. In a project that requires approval by default, a workflow entry needs `requiresApproval: false` to be created. * Environments run in parallel, each as its own deployment. Inside a workflow, `needs:` still orders the sub-environments. * With `--only-failed`, an environment is skipped unless it does not exist, has never been deployed, or its latest deployment ended in `FAILURE`, `INTERNAL_FAILURE`, `TIMEOUT`, `CANCELLED`, or `ABORTED`. In a failed workflow environment, when every failed sub-environment is one sub-environment or downstream of it, only that part runs again, as a `--run-from-here` run. Otherwise the whole workflow is redeployed, for example when failures start in two or more sub-environments that do not depend on each other, or when the entry sets a top-level `revision`. * `--wait` does not stream logs, because the deployments run in parallel. Follow one with `deployment logs --follow`. The output lists every entry in file order, with these fields: | Field | Description | | :- | :- | | `name`, `projectId`, `environmentId` | The entry and the environment it resolved to | | `action` | `create`, `deploy`, `retry`, or `skip` | | `nodes` | For a `retry`, the sub-environment it reran from | | `deployments` | Each deployment the entry started, in its final state with `--wait` | | `error` | `type` and `message`, when a request for that environment failed | One environment failing does not stop the others. The exit code is `0` when every environment started and, with `--wait`, none ended in a failed state. It is `1` when any environment has an `error` or a failed deployment, and the full result is still printed. A `--wait` that times out is that environment's `error`, with type `transient`. ### environment destroy ```bash theme={null} env0 environment destroy ( | -f ) --yes [flags] ``` Destroys the environment's resources. This cannot be undone, so it requires `--yes` (or `--force`) and has no prompt. On an environment that requires approval, the destroy waits at `WAITING_FOR_USER` like any deployment. | Flag | Description | | :- | :- | | `--yes`, `--force` | Confirm the destroy. Required. | | `--skip-state-refresh` | Skip the state refresh during the destroy plan | | `--checkout-updated-code` | Check out the latest revision before destroying | | `--requires-approval` | Require approval for this destroy. `--requires-approval=false` skips it. | | `--comment` | Destroy comment | | `--node` | Destroy only this workflow sub-environment, by alias. The workflow environment itself stays. | | `-f`, `--file` | Destroy every environment an [`environment apply`](#environment-apply) file lists, instead of one id | | `--project` | With `--file`, project for entries that do not set one | | `--wait`, `--quiet`, `--poll-interval`, `--timeout`, `--pretty` | As on `environment deploy` | With `--file`, `destroy` takes the same file as `apply`, so a workspace comes down with the file that brought it up. Entries need no `template`. ```bash theme={null} env0 environment destroy -f workspace.yaml --yes --wait -o compact ``` * Environments are found as `apply` finds them, and every lookup runs before anything is destroyed. `destroy -f` shares the parse-level file validation of `apply`, such as an unknown field, an entry listed twice, or a bad `ttl` or tag, and its environment lookups, so a file that fails those is rejected here too. It does not require `template`, and it does not verify workflow aliases or whether the target supports sub-environment overrides, so a file that `apply` rejects for those with exit `64` still destroys the environments it names. It still validates the variable names and types in sub-environment overrides, and an invalid type exits `64` before any request. * Nothing to destroy is a `skip`, not an error: an environment that does not exist, one never deployed, one already destroyed, or one that already has an unfinished destroy. A rerun never queues a second destroy. * The destroys run in parallel. A workflow environment is destroyed as a unit, with its sub-environments destroyed in reverse `needs:` order. * env zero archives each environment once its destroy succeeds. An environment whose destroy fails or waits for approval stays live. After you fix or approve it, run the same command again to destroy what is left. * `--requires-approval` applies to every destroy. Without it, an entry's `requiresApproval` applies, then the environment's own setting. * `--node` and `--pretty` work only with a single environment id, and `--wait` does not stream logs. * The output lists every entry in file order, with `name`, `projectId`, `environmentId`, `action` (`destroy` or `skip`), `deployments`, and `error`. The exit code is `1` when any environment has an `error` or a failed destroy. A destroy waiting for approval still exits `0`. ### environment archive ```bash theme={null} env0 environment archive ``` Marks the environment inactive without running a deployment, so its cloud resources stay. Run `destroy` first to remove them. See [mark an environment as inactive](/guides/admin-guide/environments#mark-an-environment-as-inactive). ### environment tag list ```bash theme={null} env0 environment tag list [] [--organization ] ``` With an id, prints that environment's tags, for example `{"team": ["eng", "payments"]}`. Without one, prints every tag key and value used in the organization. `tags` is an alias for `tag`. ### environment tag set ```bash theme={null} env0 environment tag set KEY=VALUE [KEY=VALUE...] ``` Replaces the whole value list of each key you name and leaves other keys alone. To keep an existing value, pass it again: `team=eng team=payments`. Prints the updated environment. ### environment tag remove ```bash theme={null} env0 environment tag remove KEY [KEY...] ``` Removes each key with all of its values. Passing `KEY=VALUE` exits `64`. Tag limits and permissions are listed in [Environment tags](/guides/admin-guide/environments/tags#limits). Tags are visible to anyone who can view the environment, so do not put secrets in them. ### environment ttl set ```bash theme={null} env0 environment ttl set ``` Replaces the environment's lifespan. A duration counts from now, not from the current end, so `ttl set 2h` can bring the end forward. The minimum is `1h`. Read the new end from `lifespanEndAt` in the output: env zero truncates it to the minute. ### environment ttl extend ```bash theme={null} env0 environment ttl extend ``` Adds the duration to the current end, or to now if the end has passed. On an environment with no TTL, exits `2`. `extend` reads the current end and then writes a new one, so a TTL change someone makes in between is overwritten. ### environment ttl clear ```bash theme={null} env0 environment ttl clear ``` Removes the TTL, so env zero never destroys the environment automatically. `lifespanEndAt` disappears from the output. For default and maximum TTLs, see [Configure policy TTL](/guides/policies-governance/policy-ttl). ### Waiting for a deployment `--wait` polls the deployment until it reaches a final status, then exits with the [code for that status](#exit-codes). It retries `5xx` and `429` responses. A deployment that reaches `WAITING_FOR_USER` stops the wait with exit `0`. Approve it with [`deployment approve`](#deployment-approve). While it waits, the deployment's step logs stream to stderr. Stdout still receives only the final deployment, so `--wait -o compact | jq` works. Logs keep their color on a terminal and lose it when redirected. Secrets are redacted before the logs reach the CLI. ## Deployments ### deployment list ```bash theme={null} env0 deployment list --environment [--limit ] [--all] ``` Lists deployments, newest first. Paginated, see [Pagination](#pagination). ### deployment get ```bash theme={null} env0 deployment get ``` Includes a truncated `errorMessage`, `failedCommand`, and `exitCode` for a failed deployment. ### deployment logs ```bash theme={null} env0 deployment logs [--step ] [--tail ] [--follow] [--poll-interval ] ``` Without `--follow`, returns the deployment's `status`, `failedCommand`, `exitCode`, full `errorMessage`, and `steps`, with color codes removed. Use it for the root cause of a failure: ```bash theme={null} env0 deployment logs -o compact | jq -r '.data.steps[] | select(.status == "FAIL") | .events[].message' ``` * `steps` lists every step in order, each with its `name`, `status`, and `events`: the log lines the env zero console shows for that step. A step that has not started has no events. A step with `available: false` has no events because env zero no longer stores its logs, which happens for some older deployments. * `output` holds the deployment's Terraform or OpenTofu outputs, not the console output, so it is often `{}`. * `--step ` returns only that step. Repeatable. Use a `name` from `steps`, not a `displayName`. An unknown name exits `64` and lists the valid names. * `--tail ` keeps the last `n` lines of each step. A step that lost earlier lines has `truncated: true`. * `-o table` prints the fields, then the log lines grouped by step. With `--follow` (`-f`), streams the logs to stdout until the deployment finishes, then exits like `--wait`. `--step` and `--tail` do not combine with `--follow`. The stream is text grouped by step. With `-o json` or `-o compact` it is newline-delimited JSON, one `{"step", "level", "message", "timestamp"}` object per line, with no envelope. `--poll-interval` defaults to `3s`. ### deployment approve ```bash theme={null} env0 deployment approve ``` Resumes a deployment at `WAITING_FOR_USER`. The status changes a few seconds later. Approving a deployment that has already moved on exits `2` and is harmless. Approval rights do not approve your own deployments automatically. ### deployment cancel ```bash theme={null} env0 deployment cancel ``` Cancels a `QUEUED` deployment, or rejects one at `WAITING_FOR_USER`. ### deployment abort ```bash theme={null} env0 deployment abort ``` Aborts an `IN_PROGRESS` deployment. `approve`, `cancel`, and `abort` return right away and take no `--wait`. To follow a resumed deployment, poll `deployment get` until its status leaves `WAITING_FOR_USER`, then run `deployment logs --follow`. ## Plans ### plan list ```bash theme={null} env0 plan list --environment [--limit ] [--all] ``` Lists plan summaries across an environment's deployments. Paginated, see [Pagination](#pagination). ### plan get ```bash theme={null} env0 plan get ``` Returns the plan stored with a deployment. Check `planAvailable` first: most deployments, including those at `WAITING_FOR_USER`, store no plan. With no plan, `resourceChanges` and `outputChanges` are `[]`, the same as a plan with no changes. * `resourceChanges[].action` shows `delete` and `recreate` only when a plan is stored. * The deployment's `planSummary` counts can be higher than the entries in `resourceChanges`. Use `resourceChanges` for the actual resources. * To see what drifted, run `plan get` on the latest deployment with `type` `driftDetection`. See [Drift detection](/guides/admin-guide/environments/drift-detection). ### Cost estimation `environment get` and `list`, `context` (under `summary` and each deployment), `plan get`, and `deployment get` and `list` include `costEstimation`: `totalMonthlyCost` and the deployment's `monthlyCostDiff`, as numbers with no currency. The `table` output assumes USD. The field is left out, which `jq` reads as `null`, when [cost estimation](/guides/policies-governance/cost-estimation) is off for the organization, the deployment produced no estimate, or the CLI could not read the estimate. ## Variables ### variable list ```bash theme={null} env0 variable list [--environment ] [flags] ``` Lists the variables configured on a scope, with sensitive values masked. `var` is an alias for `variable`. | Flag | Description | | :- | :- | | `--environment` | Environment whose variables to list. Its organization and project are used for the other scopes. | | `--project` | Project scope | | `--blueprint` | Template scope | | `--organization` | Organization scope. Required unless set by `--environment` or stored. | ## VCS connections ### vcs list ```bash theme={null} env0 vcs list [--organization ] [--type ] ``` Lists the organization's VCS connections. Pass a connection's `id` as `--vcs-connection-id` to `template create` or `environment create` for a private repository. Its `accessScope`, for example `Organization:acme`, must cover the repository's owner. `--type` filters by provider, for example `GitHub` or `GitLab`. ## Cloud inventory `env0 inventory` compares the cloud resources that exist with the ones env zero manages, through Cloud Compass. Cloud Compass reads the CloudQuery connection stored in the organization's settings, so the CLI needs no CloudQuery credential. Every inventory command takes `--organization`, by name or id, and uses the stored organization when you omit it. A resource is managed when Cloud Compass matched it to a resource in the state of an environment that still exists, or when it carries that environment's `env0_environment_id` tag. An unmanaged resource is one no environment manages. It may belong to other tooling, such as CloudFormation, CDK, or Terraform run outside env zero, or it may have been created by hand. Run [`inventory status`](#inventory-status) first. Data is only as fresh as the last CloudQuery sync. When Cloud Compass cannot read its managed state, `coverage` returns `managed`, `unmanaged`, `drifted`, and `managedPct` as `null` for that group (`?` in tables), and `list` returns `managed: null`. Treat those values as unknown, not as zero. ### inventory status ```bash theme={null} env0 inventory status [--organization ] ``` Shows whether Cloud Compass can read CloudQuery, how many resources env zero manages, and when each integration last synced. It exits `0` either way, so check `.data.connected`. When it is `false`, `.data.reason` says why, and every other inventory command fails with that reason. When it is `true`, `.data.managedResources` counts the managed resources. A count of `0` means no environment state has been matched yet, so every resource reads as unmanaged. An absent count means the count itself failed. Each integration's `lastRun.completedAt` shows its last sync, and `lastRun.statusReason: partial_success` means some resources were not synced. ### inventory coverage ```bash theme={null} env0 inventory coverage [flags] ``` Counts managed and unmanaged cloud resources, plus drifted resources and CloudQuery insights, grouped by account by default. | Flag | Description | | :- | :- | | `--by` | Group counts by `account` (default), `type`, `cloud`, `region`, `project`, or `environment` | | `--cloud` | Only this cloud, for example `aws`, `azure`, or `gcp` | | `--account` | Only this cloud account, by the name Cloud Compass shows | | `--region` | Only this region | | `--type` | Only this resource type, by its label, for example `S3 Bucket` | | `--search` | Only resources whose name, or one of whose tag keys or values, contains this text | | `--organization` | Organization name or id | `coverage` comes from a separate Cloud Compass count that includes nested records, so its totals can be higher than the `page.totalCount` of `inventory list`. ### inventory list ```bash theme={null} env0 inventory list [flags] ``` Lists cloud resources, optionally only those env zero does or does not manage. The filters of `coverage` apply, and these flags are added: | Flag | Description | | :- | :- | | `--managed` | Only resources an environment manages | | `--unmanaged` | Only resources no environment manages | | `--environment` | Only this environment's managed resources, each with its Terraform `address` and `module`. With `--unmanaged`, the cloud resources Cloud Compass attributes to the environment that its state does not hold. | | `--type` | Resource type label. With `--environment`, the Terraform type instead, for example `aws_s3_bucket`. | | `--limit` | Maximum resources to return. Default `100`. | | `--all` | Fetch every resource instead of stopping at `--limit` | `page.totalCount` is the full match count. The organization-wide list reads ten resources per request, so a large `--limit` or `--all` takes a while. Use `coverage` for counts. A good order is to run `coverage`, then `coverage --account --by type`, then `list --unmanaged --account --type