---
title: "Edit Terraform"
method: PUT
path: "/terraform/{terraformId}"
tags: ["Terraform Main Calls"]
---

# Edit Terraform

`PUT /terraform/{terraformId}`

## Request

- Base URL: `https://api.qovery.com`
- URL: `https://api.qovery.com/terraform/{terraformId}`
- Auth: one of:
  - API key in header `Authorization`
  - HTTP bearer
- TypeScript: <https://skmtc.dev/qovery/apis/qovery-api/docs/terraform/:terraformId/put.ts> (a function with typed inputs; its response is checked against the schema)

## Request body

- TerraformRequest
  - `name` string, required
  - `description` string, required
  - `auto_approve` boolean, required
  - `auto_deploy` boolean, required
  - `terraform_files_source` object, required
    - `git_repository` TerraformGitRepositoryRequest
      - `url` string, required
      - `branch` string
      - `root_path` string
      - `git_token_id` string
  - `terraform_variables_source` TerraformVariablesSourceRequest, required
    - `tf_var_file_paths` string[], required
    - `tf_vars` TerraformVarKeyValue[], required
      - `key` string
      - `value` string
      - `secret` boolean
  - `backend` union, required: Configuration for Terraform backend - exactly one backend type must be specified
    - object
      - `kubernetes` TerraformBackendKubernetes, required: Kubernetes-specific backend configuration
    - object
      - `user_provided` TerraformBackendUserProvided, required: User-provided backend configuration
  - `provider` 'TERRAFORM', required
  - `provider_version` TerraformProviderVersion, required
    - `read_from_terraform_block` boolean
    - `explicit_version` string, required
  - `timeout_sec` integer
  - `icon_uri` string, uri
  - `job_resources` TerraformRequestJobResources, required
    - `cpu_milli` integer, required
    - `ram_mib` integer, required
    - `gpu` integer, required
    - `storage_gib` integer, required
  - `use_cluster_credentials` boolean
  - `action_extra_arguments` object: The key represent the action command name i.e: "plan" The value represent the extra arguments to pass to this command i.e: {"apply", ["-lock=false"]} is going to prepend `-lock=false` to terraform apply commands

## Response `200`

Edit Terraform

- TerraformResponse: A Terraform service
  - `id` string, uuid, required
  - `created_at` string, date-time, required
  - `updated_at` string, date-time
  - `name` string, required: name is case insensitive
  - `description` string
  - `timeout_sec` integer, required
  - `auto_approve` boolean, required
  - `auto_deploy` boolean, required
  - `terraform_files_source` object
    - `git` object
      - `git_repository` ApplicationGitRepository
        - `has_access` boolean
        - `provider` 'BITBUCKET' | 'GITHUB' | 'GITLAB', required
        - `owner` string, required
        - `url` string, uri, required
        - `name` string, required: repository name
        - `branch` string
        - `root_path` string
        - `deployed_commit_id` string: Git commit ID corresponding to the deployed version of the app
        - `deployed_commit_date` string, date-time: Git commit date corresponding to the deployed version of the app
        - `deployed_commit_contributor` string: Git commit user corresponding to the deployed version of the app
        - `deployed_commit_tag` string
        - `git_token_id` string, nullable
        - `git_token_name` string, nullable
  - `icon_uri` string, uri, required: Icon URI representing the terraform service.
  - `service_type` 'APPLICATION' | 'DATABASE' | 'CONTAINER' | 'JOB' | 'HELM' | 'TERRAFORM', required: type of the service (application, database, job, ...)
  - `terraform_variables_source` TerraformVariablesSourceResponse, required
    - `tf_var_file_paths` string[], required
  - `provider` 'TERRAFORM', required
  - `backend` union, required: Configuration for Terraform backend - exactly one backend type must be specified
    - object
      - `kubernetes` TerraformBackendKubernetes, required: Kubernetes-specific backend configuration
    - object
      - `user_provided` TerraformBackendUserProvided, required: User-provided backend configuration
  - `provider_version` TerraformProviderVersion, required
    - `read_from_terraform_block` boolean
    - `explicit_version` string, required
  - `job_resources` TerraformJobResourcesResponse, required
    - `cpu_milli` integer, required
    - `ram_mib` integer, required
    - `gpu` integer, required
    - `storage_gib` integer, required
  - `environment` ReferenceObject, required
    - `id` string, uuid, required
  - `use_cluster_credentials` boolean, required
  - `action_extra_arguments` object, required: The key represent the action command name i.e: "plan" The value represent the extra arguments to pass to this command i.e: {"apply", ["-lock=false"]} is going to prepend `-lock=false` to terraform apply commands

## Other responses

- `400`: Bad request
- `401`: Access token is missing or invalid
- `403`: Access forbidden
- `404`: Resource not found
- `409`: Terraform name within the environment is already taken

---

[API](https://skmtc.dev/qovery/apis/qovery-api.md) - [All operations](https://skmtc.dev/qovery/apis/qovery-api/llms.txt) - [OpenAPI document](https://skmtc.dev/qovery/apis/qovery-api/revisions/93c4960a44ba?raw)
