---
title: "Remediate Drift Deployment"
method: POST
path: "/environments/deployments/{id}/remediate-drift"
tags: ["Environments"]
---

# Remediate Drift Deployment

`POST /environments/deployments/{id}/remediate-drift`

Remediate a drifted environment, using a drift detection deployment ID

## Path parameters

- `id` string, required

## Request body

- EnvironmentApiRemediateDriftRequestBody

## Response `200`

- EnvironmentApiRemediateDriftResponse
  - `id` string
  - `createdAt` string, date-time
  - `updatedAt` string, date-time
  - `type` 'deploy' | 'destroy' | 'prPlan' | 'driftDetection' | 'task' | 'remotePlan' | 'dryRun' | 'moduleTest' | 'deploy' | 'destroy' | 'prPlan' | 'driftDetection' | 'task' | 'remotePlan' | 'dryRun' | 'moduleTest', required
  - `startedBy` string, required
  - `queuedAt` string, date-time, required
  - `startedAt` string, date-time, required
  - `finishedAt` string, date-time, required
  - `output` union, required
    - EnvironmentApiOutput
    - object[]
      - `moduleName` string, required
      - `output` EnvironmentApiOutput, required
    - EnvironmentApiOutput
    - object[]
      - `moduleName` string, required
      - `output` EnvironmentApiOutput, required
  - `error` object, required
  - `failedCommand` string
  - `stoppedByTimeoutReason` 'DEPLOYMENT_TIME_LIMIT_EXCEEDED' | 'AGENT_UNRESPONSIVE' | 'DEPLOYMENT_NOT_STARTED' | 'DEPLOYMENT_TIME_LIMIT_EXCEEDED' | 'AGENT_UNRESPONSIVE' | 'DEPLOYMENT_NOT_STARTED'
  - `customEnv0EnvironmentVariables` CustomEnv0EnvironmentVariables
    - `environmentId` string — The deployed Environment ID
    - `projectId` string — ENV0_PROJECT_ID
    - `projectName` string — The Project Name of the deployed Environment
    - `parentProjectIds` string
    - `parentProjectPath` string
    - `deploymentLogId` string — The deployment ID
    - `deploymentType` 'deploy' | 'destroy' | 'prPlan' | 'deploy' | 'destroy' | 'prPlan' | 'deploy' | 'destroy' | 'prPlan' — The deployment type.
    - `deploymentRevision` string — Available only when deployment revision defined
    - `workspaceName` string — The Terraform Workspace name used in the Environment
    - `rootDir` string — The root repository path
    - `organizationId` string
    - `templateId` string
    - `templateDir` string
    - `templateName` string
    - `environmentName` string
    - `environmentCreatorName` string
    - `environmentCreatorUserId` string
    - `environmentCreatorEmail` string
    - `deployerName` string
    - `deployerUserId` string
    - `deployerEmail` string
    - `reviewerName` string
    - `reviewerEmail` string
    - `reviewerUserId` string
    - `vcsProvider` 'gitlab' | 'github' | 'bitbucket' | 'bitbucketServer' | 'gitlabEnterprise' | 'githubEnterprise' | 'azureDevOps' | 'gitlab' | 'github' | 'bitbucket' | 'bitbucketServer' | 'gitlabEnterprise' | 'githubEnterprise' | 'azureDevOps' | 'gitlab' | 'github' | 'bitbucket' | 'bitbucketServer' | 'gitlabEnterprise' | 'githubEnterprise' | 'azureDevOps' | 'gitlab' | 'github' | 'bitbucket' | 'bitbucketServer' | 'gitlabEnterprise' | 'githubEnterprise' | 'azureDevOps'
    - `prAuthor` string — pr author. available only in PR Plan
    - `prNumber` string — the pr number. available only in PR Plan
    - `prSourceRepository` string — the source repository. available only in PR Plan for the [VCSs supporting fork PR Plans](https://arc.net/l/quote/uoqvkxmq))"
    - `prSourceBranch` string — the source branch. available only in PR Plan
    - `prTargetBranch` string — the target branch. available only in PR Plan
    - `commitHash` string — the commit hash
    - `commitUrl` string — the commit url
    - `oidcToken` string — The OIDC Token - read more here(https://docs.envzero.com/docs/oidc-integrations) on how to enable it and use it
    - `vcsAccessToken` string — When using a native VCS integration, this will represent the access token we use to clone the repository
    - `tfPlanJson` string — The file path to a JSON representation of a Terraform Plan file
    - `cliArgsPlan` string — add additional cli arguments when running a plan
    - `cliArgsApply` string — add additional cli arguments when running the `apply` command
    - `discoveryRepositoryUrl` string — Repository URL to write PR comments to. Used for prPlan deployments to override the target repo for comments.
    - `discoveryPrNumber` string — PR number to write comments to. Used for prPlan deployments to override the target PR.
    - `discoveryVCS` 'gitlab' | 'github' | 'bitbucket' | 'bitbucketServer' | 'gitlabEnterprise' | 'githubEnterprise' | 'azureDevOps' | 'gitlab' | 'github' | 'bitbucket' | 'bitbucketServer' | 'gitlabEnterprise' | 'githubEnterprise' | 'azureDevOps' | 'gitlab' | 'github' | 'bitbucket' | 'bitbucketServer' | 'gitlabEnterprise' | 'githubEnterprise' | 'azureDevOps' | 'gitlab' | 'github' | 'bitbucket' | 'bitbucketServer' | 'gitlabEnterprise' | 'githubEnterprise' | 'azureDevOps'
  - `costEstimation` InfracostCostEstimation, required
    - `totalMonthlyCost` number, required
    - `monthlyCostDiff` number, required
    - `projects` InfracostCostEstimationProject[], required
      - `diff` object, required
        - `totalMonthlyCost` string, required
  - `status` 'IN_PROGRESS' | 'WAITING_FOR_USER' | 'TIMEOUT' | 'FAILURE' | 'SUCCESS' | 'CANCELLED' | 'INTERNAL_FAILURE' | 'ABORTING' | 'ABORTED' | 'QUEUED' | 'SKIPPED' | 'NEVER_DEPLOYED' | 'IN_PROGRESS' | 'WAITING_FOR_USER' | 'TIMEOUT' | 'FAILURE' | 'SUCCESS' | 'CANCELLED' | 'INTERNAL_FAILURE' | 'ABORTING' | 'ABORTED' | 'QUEUED' | 'SKIPPED' | 'NEVER_DEPLOYED' | 'IN_PROGRESS' | 'WAITING_FOR_USER' | 'TIMEOUT' | 'FAILURE' | 'SUCCESS' | 'CANCELLED' | 'INTERNAL_FAILURE' | 'ABORTING' | 'ABORTED' | 'QUEUED' | 'SKIPPED' | 'NEVER_DEPLOYED', required
  - `blueprintId` string, required
  - `blueprintName` string, required
  - `blueprintRepository` string, required
  - `blueprintRevision` string, required
  - `blueprintPath` string, required
  - `blueprintType` union, required
    - 'opentofu' | 'terraform' | 'terragrunt' | 'pulumi' | 'k8s' | 'cloudformation' | 'helm' | 'ansible' | 'opentofu' | 'terraform' | 'terragrunt' | 'pulumi' | 'k8s' | 'cloudformation' | 'helm' | 'ansible' | 'opentofu' | 'terraform' | 'terragrunt' | 'pulumi' | 'k8s' | 'cloudformation' | 'helm' | 'ansible' | 'opentofu' | 'terraform' | 'terragrunt' | 'pulumi' | 'k8s' | 'cloudformation' | 'helm' | 'ansible' | 'opentofu' | 'terraform' | 'terragrunt' | 'pulumi' | 'k8s' | 'cloudformation' | 'helm' | 'ansible'
    - 'workflow'
    - 'module'
    - 'opentofu' | 'terraform' | 'terragrunt' | 'pulumi' | 'k8s' | 'cloudformation' | 'helm' | 'ansible' | 'opentofu' | 'terraform' | 'terragrunt' | 'pulumi' | 'k8s' | 'cloudformation' | 'helm' | 'ansible' | 'opentofu' | 'terraform' | 'terragrunt' | 'pulumi' | 'k8s' | 'cloudformation' | 'helm' | 'ansible' | 'opentofu' | 'terraform' | 'terragrunt' | 'pulumi' | 'k8s' | 'cloudformation' | 'helm' | 'ansible' | 'opentofu' | 'terraform' | 'terragrunt' | 'pulumi' | 'k8s' | 'cloudformation' | 'helm' | 'ansible'
    - 'workflow'
    - 'module'
  - `comment` string
  - `environmentId` string, required
  - `resourceCount` number, required
  - `resources` EnvironmentApiEnvironmentResource[]
    - `provider` string, required
    - `type` string, required
    - `name` string, required
    - `moduleName` string
    - `mode` 'managed' | 'data' | 'managed' | 'data'
  - `startedByUser` User, required
    - `email` string
    - `user_id` string
    - `created_at` string
    - `updated_at` string
    - `app_metadata` AppMetadata
      - `organizations` UserOrganization[]
        - `id` string, required
        - `role` string
        - `name` string
      - `isApiKey` boolean
      - `isAutogeneratedTerraformDeployer` boolean
      - `apiKeyType` 'oidc'
      - `createdBy` string
      - `organizationId` string
      - `isSystemUser` boolean
      - `readOnly` boolean
    - `picture` string
    - `name` string
    - `last_login` string
    - `given_name` string
    - `family_name` string
    - `blocked` boolean
  - `isScheduledRun` boolean, required
  - `abortedBy` string, required
  - `abortedByUser` User, required
    - `email` string
    - `user_id` string
    - `created_at` string
    - `updated_at` string
    - `app_metadata` AppMetadata
      - `organizations` UserOrganization[]
        - `id` string, required
        - `role` string
        - `name` string
      - `isApiKey` boolean
      - `isAutogeneratedTerraformDeployer` boolean
      - `apiKeyType` 'oidc'
      - `createdBy` string
      - `organizationId` string
      - `isSystemUser` boolean
      - `readOnly` boolean
    - `picture` string
    - `name` string
    - `last_login` string
    - `given_name` string
    - `family_name` string
    - `blocked` boolean
  - `gitUser` string
  - `gitAvatarUrl` string
  - `prNumber` string
  - `triggerName` union
    - 'user' | 'terraform-cli' | 'workflow' | 'user' | 'terraform-cli' | 'workflow' | 'user' | 'terraform-cli' | 'workflow'
    - 'cd' | 'prPlan' | 'driftDetection' | 'ttl' | 'scheduled' | 'comment' | 'import' | 'driftRemediation' | 'cd' | 'prPlan' | 'driftDetection' | 'ttl' | 'scheduled' | 'comment' | 'import' | 'driftRemediation' | 'cd' | 'prPlan' | 'driftDetection' | 'ttl' | 'scheduled' | 'comment' | 'import' | 'driftRemediation'
    - 'user' | 'terraform-cli' | 'workflow' | 'user' | 'terraform-cli' | 'workflow' | 'user' | 'terraform-cli' | 'workflow'
    - 'cd' | 'prPlan' | 'driftDetection' | 'ttl' | 'scheduled' | 'comment' | 'import' | 'driftRemediation' | 'cd' | 'prPlan' | 'driftDetection' | 'ttl' | 'scheduled' | 'comment' | 'import' | 'driftRemediation' | 'cd' | 'prPlan' | 'driftDetection' | 'ttl' | 'scheduled' | 'comment' | 'import' | 'driftRemediation'
    - 'user' | 'terraform-cli' | 'workflow' | 'user' | 'terraform-cli' | 'workflow' | 'user' | 'terraform-cli' | 'workflow'
    - 'cd' | 'prPlan' | 'driftDetection' | 'ttl' | 'scheduled' | 'comment' | 'import' | 'driftRemediation' | 'cd' | 'prPlan' | 'driftDetection' | 'ttl' | 'scheduled' | 'comment' | 'import' | 'driftRemediation' | 'cd' | 'prPlan' | 'driftDetection' | 'ttl' | 'scheduled' | 'comment' | 'import' | 'driftRemediation'
  - `driftDetected` boolean
  - `plan` DeploymentApiPlanPlan
    - `resourceChanges` DeploymentApiPlanPlanResourceChange[], required
      - `id` string
      - `cloudId` string
      - `moduleName` string
      - `driftByCloud` boolean
      - `name` string, required
      - `providerName` string, required
      - `type` string, required
      - `path` string, required
      - `action` 'create' | 'update' | 'delete' | 'recreate' | 'metadata' | 'create' | 'update' | 'delete' | 'recreate' | 'metadata', required
      - `attributes` DeploymentApiPlanAttributeChange[], required
        - `name` string, required
        - `before` unknown
        - `after` unknown
      - `importing` DeploymentApiPlanResourceImportData
        - `id` string, required
      - `actionReason` 'replace_because_tainted' | 'replace_because_cannot_update' | 'replace_by_request' | 'delete_because_no_resource_config' | 'delete_because_no_module' | 'delete_because_wrong_repetition' | 'delete_because_count_index' | 'delete_because_each_key' | 'read_because_config_unknown' | 'read_because_dependency_pending' | 'replace_because_tainted' | 'replace_because_cannot_update' | 'replace_by_request' | 'delete_because_no_resource_config' | 'delete_because_no_module' | 'delete_because_wrong_repetition' | 'delete_because_count_index' | 'delete_because_each_key' | 'read_because_config_unknown' | 'read_because_dependency_pending'
      - `createBeforeDestroy` boolean
      - `previousAddress` string
    - `outputChanges` DeploymentApiPlanPlanOutputChange[], required
      - `moduleName` string
      - `name` string, required
      - `action` 'create' | 'update' | 'delete' | 'recreate' | 'metadata' | 'create' | 'update' | 'delete' | 'recreate' | 'metadata', required
      - `attributes` DeploymentApiPlanAttributeChange[], required
        - `name` string, required
        - `before` unknown
        - `after` unknown
  - `planSummary` DeploymentApiPlanPlanSummary
    - `added` number, required
    - `changed` number, required
    - `destroyed` number, required
    - `imported` number
  - `isSkippedApply` boolean
  - `workflowDeploymentId` string
  - `workflowFile` EnvironmentApiWorkflowEnvironmentsWorkflowFile
    - `settings` object
      - `environmentRemovalStrategy` 'destroy' | 'detach' | 'destroy' | 'detach'
    - `environments` object, required
  - `workflowDeploymentOptions` WorkflowDeploymentOptions
    - `node` string, required
    - `operation` 'run-from-here' | 'single-node-deploy' | 'single-node-destroy' | 'run-from-here' | 'single-node-deploy' | 'single-node-destroy', required
  - `stateVersionId` string
  - `reviewersUsers` EnvironmentApiReviewerUser[], required
    - `user` User, required
      - `email` string
      - `user_id` string
      - `created_at` string
      - `updated_at` string
      - `app_metadata` AppMetadata
        - `organizations` UserOrganization[]
          - `id` string, required
          - `role` string
          - `name` string
        - `isApiKey` boolean
        - `isAutogeneratedTerraformDeployer` boolean
        - `apiKeyType` 'oidc'
        - `createdBy` string
        - `organizationId` string
        - `isSystemUser` boolean
        - `readOnly` boolean
      - `picture` string
      - `name` string
      - `last_login` string
      - `given_name` string
      - `family_name` string
      - `blocked` boolean
    - `action` 'approved' | 'cancelled' | 'approved' | 'cancelled', required
  - `reviewers` EnvironmentApiReviewer[], required
    - `userId` string, required
    - `action` 'approved' | 'cancelled' | 'approved' | 'cancelled', required
  - `reviewedBy` string
  - `reviewedByUser` User
    - `email` string
    - `user_id` string
    - `created_at` string
    - `updated_at` string
    - `app_metadata` AppMetadata
      - `organizations` UserOrganization[]
        - `id` string, required
        - `role` string
        - `name` string
      - `isApiKey` boolean
      - `isAutogeneratedTerraformDeployer` boolean
      - `apiKeyType` 'oidc'
      - `createdBy` string
      - `organizationId` string
      - `isSystemUser` boolean
      - `readOnly` boolean
    - `picture` string
    - `name` string
    - `last_login` string
    - `given_name` string
    - `family_name` string
    - `blocked` boolean
  - `targets` string[]
  - `variables` EnvironmentApiVariable[]
    - `id` string — The ID of the configuration property. If provided, will act as an update. Otherwise, a new configuration property will be created.
    - `name` string, required
    - `scope` 'SET' | 'GLOBAL' | 'BLUEPRINT' | 'SUB_ENVIRONMENT_BLUEPRINT' | 'PROJECT' | 'WORKFLOW' | 'ENVIRONMENT' | 'DEPLOYMENT' | 'SET' | 'GLOBAL' | 'BLUEPRINT' | 'SUB_ENVIRONMENT_BLUEPRINT' | 'PROJECT' | 'WORKFLOW' | 'ENVIRONMENT' | 'DEPLOYMENT' | 'SET' | 'GLOBAL' | 'BLUEPRINT' | 'SUB_ENVIRONMENT_BLUEPRINT' | 'PROJECT' | 'WORKFLOW' | 'ENVIRONMENT' | 'DEPLOYMENT' | 'SET' | 'GLOBAL' | 'BLUEPRINT' | 'SUB_ENVIRONMENT_BLUEPRINT' | 'PROJECT' | 'WORKFLOW' | 'ENVIRONMENT' | 'DEPLOYMENT' | 'SET' | 'GLOBAL' | 'BLUEPRINT' | 'SUB_ENVIRONMENT_BLUEPRINT' | 'PROJECT' | 'WORKFLOW' | 'ENVIRONMENT' | 'DEPLOYMENT', required
    - `scopeId` string — The ID of the entity of the provided `scope`. e.g. a project's ID when the provided `scope` is `PROJECT`. Inapplicable for `GLOBAL` scope, as it has no specific entity.
    - `value` string
    - `isSensitive` boolean
    - `type` 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1, required
    - `schema` PartialJSONSchema7
      - `type` 'string' | 'array' | 'string' | 'array' | 'string' | 'array' | 'string' | 'array' | 'string' | 'array'
      - `enum` string[]
      - `format` 'HCL' | 'JSON' | 'ENVIRONMENT_OUTPUT' | 'HCL' | 'JSON' | 'ENVIRONMENT_OUTPUT' | 'HCL' | 'JSON' | 'ENVIRONMENT_OUTPUT' | 'HCL' | 'JSON' | 'ENVIRONMENT_OUTPUT' | 'HCL' | 'JSON' | 'ENVIRONMENT_OUTPUT'
    - `userId` string
    - `updatedAt` string, date-time
    - `projectId` string
  - `gitMetadata` EnvironmentApiGitMetadata
    - `commit` string, required
    - `branch` string, required
    - `timestamp` string, date-time, required
  - `providerVersions` union
    - object
    - object
    - object
    - object
  - `moduleVersions` union
    - object
    - object
    - object
    - object
  - `stateFileHash` union
    - object
      - `value` string, required
    - object
    - object
      - `value` string, required
    - object
  - `driftCause` object
    - `unappliedCommits` EnvironmentApiDriftCauseUnappliedCommit[], required
      - `userEmail` string, required
      - `timestamp` string, date-time, required
      - `commitHash` string, required

---

[API](https://skmtc.dev/envzero/apis/env0-api.md) · [All operations](https://skmtc.dev/envzero/apis/env0-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/envzero/env0-api/revisions/513441cbe9dc/schema)
