> ## Documentation Index
> Fetch the complete documentation index at: https://www.qovery.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Edit Terraform



## OpenAPI

````yaml /api-reference/openapi.yaml put /terraform/{terraformId}
openapi: 3.0.0
info:
  version: 1.0.4
  title: Qovery API
  description: >
    - Qovery is the fastest way to deploy your full-stack apps on any Cloud
    provider.

    - ℹ️ The API is stable and still in development.
  contact:
    name: Qovery Product Team
    url: https://www.qovery.com
    email: support+api+documentation@qovery.com
  x-logo:
    url: https://console.qovery.com/assets/logos/logo-white.svg
    altText: Qovery
servers:
  - url: https://api.qovery.com
security:
  - bearerAuth: []
  - ApiKeyAuth: []
tags:
  - name: Account
  - name: Account Info
  - name: Alert Receivers
  - name: Alert Rules
  - name: Admin
  - name: ArgoCD
  - name: Application
  - name: Application Actions
  - name: Application Configuration
  - name: Application Database
  - name: Application Deployment Restriction
  - name: Application Deployment History
  - name: Application Environment Variable
  - name: Application Logs
  - name: Application Main Calls
  - name: Application Secret
  - name: Application Annotations Group
  - name: Applications
  - name: AutoscalingPolicy
  - name: Container
  - name: Container Actions
  - name: Container Configuration
  - name: Container Database
  - name: Container Deployment History
  - name: Container Environment Variable
  - name: Container Logs
  - name: Container Main Calls
  - name: Container Registry
  - name: Container Secret
  - name: Container Annotations Group
  - name: Containers
  - name: Deployment Stage Main Calls
  - name: Job
  - name: Job Actions
  - name: Job Configuration
  - name: Job Database
  - name: Job Deployment Restriction
  - name: Job Deployment History
  - name: Job Environment Variable
  - name: Job Logs
  - name: Job Main Calls
  - name: Job Registry
  - name: Job Secret
  - name: Job Annotations Group
  - name: Jobs
  - name: KedaTriggerAuthentication
  - name: Helm
  - name: Helm Actions
  - name: Helm Configuration
  - name: Helm Database
  - name: Helm Deployment Restriction
  - name: Helm Deployment History
  - name: Helm Logs
  - name: Helm Main Calls
  - name: Helm Repository
  - name: Helms
  - name: Backups
  - name: Billing
  - name: Cloud Provider
  - name: Cloud Provider Credentials
  - name: Clusters
  - name: Custom Domain
  - name: Container Custom Domain
  - name: Database
  - name: Database Actions
  - name: Database Application
  - name: Database Container
  - name: Database Deployment History
  - name: Database Main Calls
  - name: Database Annotations Group
  - name: Databases
  - name: Environment
  - name: Environment Actions
  - name: Environment Deployment History
  - name: Environment Deployment Rule
  - name: Environment Logs
  - name: Environment Main Calls
  - name: Environment Secret
  - name: Environment Variable
  - name: Environments
  - name: Git
  - name: Github App
  - name: Git repositories
  - name: Members
  - name: Organization
  - name: Organization Account Git Repositories
  - name: Organization Cluster Lock
  - name: Organization Main Calls
  - name: Organization Custom Role
  - name: Organization Event
  - name: Organization Api Token
  - name: Organization Webhook
  - name: Organization Annotations Group
  - name: Organization Labels Group
  - name: Organization Enterprise Connection
  - name: Project
  - name: Project Deployment Rule
  - name: Project Environment Variable
  - name: Project Main Calls
  - name: Project Secret
  - name: Projects
  - name: Referral & Rewards
  - name: Secret Manager Access
  - name: Terraforms
  - name: Terraform Main Calls
  - name: Terraform Resources
  - name: Terraform Deployment History
  - name: Terraform Deployment Restriction
  - name: Container Registries
  - name: Helm Repositories
  - name: User Sign Up
  - name: Variable Main Calls
  - name: Helm Custom Domain
  - name: Lifecycle Template Main Calls
paths:
  /terraform/{terraformId}:
    parameters:
      - $ref: '#/components/parameters/terraformId'
    put:
      tags:
        - Terraform Main Calls
      summary: Edit Terraform
      operationId: editTerraform
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TerraformRequest'
      responses:
        '200':
          description: Edit Terraform
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/TerraformResponse'
        '400':
          $ref: '#/components/responses/400'
        '401':
          $ref: '#/components/responses/401'
        '403':
          $ref: '#/components/responses/403'
        '404':
          $ref: '#/components/responses/404'
        '409':
          description: Terraform name within the environment is already taken
components:
  parameters:
    terraformId:
      name: terraformId
      in: path
      required: true
      schema:
        type: string
        format: uuid
      description: Terraform ID
  schemas:
    TerraformRequest:
      title: TerraformRequest
      x-stoplight:
        id: 7ujl5rx7sd38b
      type: object
      required:
        - name
        - description
        - auto_deploy_config
        - terraform_files_source
        - terraform_variables_source
        - backend
        - engine
        - provider_version
        - job_resources
      properties:
        name:
          type: string
          x-stoplight:
            id: 6mlmgpyzwe46t
        description:
          type: string
          x-stoplight:
            id: ltvpnbhjz1oho
        auto_deploy_config:
          $ref: '#/components/schemas/TerraformAutoDeployConfig'
        terraform_files_source:
          oneOf:
            - type: object
              properties:
                git_repository:
                  $ref: '#/components/schemas/TerraformGitRepositoryRequest'
        terraform_variables_source:
          $ref: '#/components/schemas/TerraformVariablesSourceRequest'
        backend:
          $ref: '#/components/schemas/TerraformBackend'
        engine:
          $ref: '#/components/schemas/TerraformEngineEnum'
        provider_version:
          $ref: '#/components/schemas/TerraformProviderVersion'
        timeout_sec:
          type: integer
          x-stoplight:
            id: 3e5ngsw45atsd
        icon_uri:
          type: string
          x-stoplight:
            id: nem7zoh97kyzc
          format: uri
        job_resources:
          $ref: '#/components/schemas/TerraformRequestJobResources'
        use_cluster_credentials:
          type: boolean
          x-stoplight:
            id: w9ncq63nukwe0
        action_extra_arguments:
          type: object
          x-stoplight:
            id: guh2uio7aztct
          description: >-
            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
          additionalProperties:
            x-stoplight:
              id: 99o28tw5chbb1
            type: array
            items:
              x-stoplight:
                id: c6p960bh9qcu4
              type: string
        dockerfile_fragment:
          nullable: true
          description: |
            Custom Dockerfile fragment to inject during build. Optional field.
            When null, no custom fragment is injected.
          oneOf:
            - $ref: '#/components/schemas/DockerfileFragmentFile'
            - $ref: '#/components/schemas/DockerfileFragmentInline'
          discriminator:
            propertyName: type
            mapping:
              file:
                $ref: '#/components/schemas/DockerfileFragmentFile'
              inline:
                $ref: '#/components/schemas/DockerfileFragmentInline'
    TerraformResponse:
      allOf:
        - $ref: '#/components/schemas/Base'
        - type: object
          required:
            - name
            - timeout_sec
            - auto_deploy
            - icon_uri
            - service_type
            - terraform_variables_source
            - engine
            - backend
            - provider_version
            - job_resources
            - environment
            - use_cluster_credentials
            - action_extra_arguments
          properties:
            name:
              type: string
              description: name is case insensitive
            description:
              type: string
            timeout_sec:
              type: integer
              minimum: 0
              default: 600
            auto_deploy:
              type: boolean
            auto_deploy_config:
              $ref: '#/components/schemas/TerraformAutoDeployConfig'
            terraform_files_source:
              nullable: false
              x-stoplight:
                id: abfhjb6q74upq
              oneOf:
                - $ref: '#/components/schemas/TerraformFilesSource'
            icon_uri:
              type: string
              format: uri
              description: Icon URI representing the terraform service.
              x-stoplight:
                id: i2pvbugqsldhe
            service_type:
              $ref: '#/components/schemas/ServiceTypeEnum'
            terraform_variables_source:
              $ref: '#/components/schemas/TerraformVariablesSourceResponse'
            engine:
              $ref: '#/components/schemas/TerraformEngineEnum'
            backend:
              $ref: '#/components/schemas/TerraformBackend'
            provider_version:
              $ref: '#/components/schemas/TerraformProviderVersion'
            job_resources:
              $ref: '#/components/schemas/TerraformJobResourcesResponse'
            environment:
              $ref: '#/components/schemas/ReferenceObject'
            use_cluster_credentials:
              type: boolean
              x-stoplight:
                id: ixjejij08tgfo
            action_extra_arguments:
              type: object
              x-stoplight:
                id: rnkzwlf29dgb5
              description: >-
                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
              additionalProperties:
                x-stoplight:
                  id: 57b09dqz1jwra
                type: array
                items:
                  x-stoplight:
                    id: 2mkmankga2thw
                  type: string
            dockerfile_fragment:
              nullable: true
              description: |
                Custom Dockerfile fragment to inject during build.
                When null, no custom fragment is injected.
              oneOf:
                - $ref: '#/components/schemas/DockerfileFragmentFile'
                - $ref: '#/components/schemas/DockerfileFragmentInline'
              discriminator:
                propertyName: type
                mapping:
                  file:
                    $ref: '#/components/schemas/DockerfileFragmentFile'
                  inline:
                    $ref: '#/components/schemas/DockerfileFragmentInline'
      description: A Terraform service
    TerraformAutoDeployConfig:
      title: TerraformAutoDeployConfig
      type: object
      required:
        - auto_deploy
        - terraform_action
      properties:
        auto_deploy:
          type: boolean
        terraform_action:
          type: string
          description: |
            Action to force a specific Terraform behavior on autodeploy.
            `DEFAULT`: The action is resolved based on the deployment type:
              - Start/Restart -> PLAN_AND_APPLY
              - Delete -> DESTROY
              - Pause -> PLAN_ONLY
          enum:
            - DEFAULT
            - PLAN
            - NOOP
    TerraformGitRepositoryRequest:
      title: TerraformGitRepositoryRequest
      x-stoplight:
        id: ot316adf8cqn0
      type: object
      required:
        - url
      properties:
        url:
          type: string
          x-stoplight:
            id: yjnlaiu6umfgc
        branch:
          type: string
          x-stoplight:
            id: 7txz9hngsrt2a
        root_path:
          type: string
          x-stoplight:
            id: 2sdr8f1ia9yr1
        git_token_id:
          type: string
          x-stoplight:
            id: ddhd4pztgc43y
    TerraformVariablesSourceRequest:
      title: TerraformVariablesSourceRequest
      x-stoplight:
        id: w9dp75z2a944z
      type: object
      required:
        - tf_var_file_paths
        - tf_vars
      properties:
        tf_var_file_paths:
          type: array
          x-stoplight:
            id: kk82s9qjluugt
          items:
            x-stoplight:
              id: 7ns22ue58d2zb
            type: string
        tf_vars:
          type: array
          items:
            $ref: '#/components/schemas/TerraformVarKeyValue'
    TerraformBackend:
      oneOf:
        - type: object
          required:
            - kubernetes
          properties:
            kubernetes:
              $ref: '#/components/schemas/TerraformBackendKubernetes'
        - type: object
          required:
            - user_provided
          properties:
            user_provided:
              $ref: '#/components/schemas/TerraformBackendUserProvided'
        - type: object
          required:
            - blueprint
          properties:
            blueprint:
              $ref: '#/components/schemas/TerraformBackendBlueprint'
      description: >-
        Configuration for Terraform backend - exactly one backend type must be
        specified
    TerraformEngineEnum:
      enum:
        - TERRAFORM
        - OPEN_TOFU
    TerraformProviderVersion:
      title: TerraformProviderVersion
      x-stoplight:
        id: 1a1hkhvei2wjq
      type: object
      required:
        - explicit_version
      properties:
        read_from_terraform_block:
          type: boolean
          x-stoplight:
            id: p2dnmuifo0fki
        explicit_version:
          type: string
          x-stoplight:
            id: 611hxcvuy68lv
    TerraformRequestJobResources:
      title: TerraformRequestJobResources
      x-stoplight:
        id: ucc7l63gajzu8
      type: object
      required:
        - cpu_milli
        - ram_mib
        - gpu
        - storage_gib
      properties:
        cpu_milli:
          type: integer
          x-stoplight:
            id: alsilze9jc23e
        ram_mib:
          type: integer
          x-stoplight:
            id: a5y9bv1avatm3
        gpu:
          type: integer
          x-stoplight:
            id: rql3vn2yhkwec
          minimum: 0
          default: 0
          example: 1
        storage_gib:
          type: integer
          x-stoplight:
            id: 627awhyjj26ny
    DockerfileFragmentFile:
      title: DockerfileFragmentFile
      type: object
      description: Reference a Dockerfile fragment file from your Git repository.
      required:
        - type
        - path
      properties:
        type:
          type: string
          enum:
            - file
          description: Fragment type discriminator
        path:
          type: string
          description: Absolute path to the fragment file.
          example: /infra/terraform/custom-build.dockerfile
    DockerfileFragmentInline:
      title: DockerfileFragmentInline
      type: object
      description: Define Dockerfile commands directly in the configuration.
      required:
        - type
        - content
      properties:
        type:
          type: string
          enum:
            - inline
          description: Fragment type discriminator
        content:
          type: string
          description: Dockerfile commands to inject (max 8KB).
          example: >-
            RUN apt-get update && apt-get install -y aws-cli jq curl && rm -rf
            /var/lib/apt/lists/*
    Base:
      type: object
      required:
        - id
        - created_at
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
        created_at:
          type: string
          readOnly: true
          format: date-time
        updated_at:
          type: string
          readOnly: true
          format: date-time
    TerraformFilesSource:
      title: TerraformFilesSource
      x-stoplight:
        id: ynhtfa5yo20ee
      type: object
      properties:
        git:
          x-stoplight:
            id: iavjewfs0d12k
          type: object
          properties:
            git_repository:
              $ref: '#/components/schemas/ApplicationGitRepository'
    ServiceTypeEnum:
      type: string
      x-stoplight:
        id: d66063cd29913
      description: type of the service (application, database, job, ...)
      enum:
        - APPLICATION
        - DATABASE
        - CONTAINER
        - JOB
        - HELM
        - TERRAFORM
        - ARGOCD_APP
    TerraformVariablesSourceResponse:
      title: TerraformVariablesSourceResponse
      x-stoplight:
        id: 2lr1mv2b3y7xy
      type: object
      required:
        - tf_var_file_paths
        - tf_vars
      properties:
        tf_var_file_paths:
          type: array
          x-stoplight:
            id: ua5d71it2yiu5
          items:
            x-stoplight:
              id: qsy17gz9fl3n3
            type: string
        tf_vars:
          type: array
          items:
            $ref: '#/components/schemas/TerraformVarKeyValue'
    TerraformJobResourcesResponse:
      title: TerraformJobResourcesResponse
      x-stoplight:
        id: xhswkmfwyerrv
      type: object
      required:
        - cpu_milli
        - ram_mib
        - gpu
        - storage_gib
      properties:
        cpu_milli:
          type: integer
          x-stoplight:
            id: bg054290feb9c
        ram_mib:
          type: integer
          x-stoplight:
            id: f6dur44ah2bwe
        gpu:
          type: integer
          x-stoplight:
            id: y8lomc204l40z
          default: 0
          minimum: 0
          example: 1
        storage_gib:
          type: integer
          x-stoplight:
            id: dsf78pwnvmqi8
    ReferenceObject:
      type: object
      required:
        - id
      properties:
        id:
          type: string
          format: uuid
          readOnly: true
    TerraformVarKeyValue:
      title: TerraformVarKeyValue
      type: object
      description: A Terraform input variable
      properties:
        key:
          type: string
          x-stoplight:
            id: enwctu8s88umi
        value:
          type: string
          x-stoplight:
            id: ix1y6viqpaxk6
        secret:
          type: boolean
          x-stoplight:
            id: df80p2az3whjg
    TerraformBackendKubernetes:
      type: object
      description: Kubernetes-specific backend configuration
    TerraformBackendUserProvided:
      type: object
      description: User-provided backend configuration
    TerraformBackendBlueprint:
      type: object
      description: >-
        Blueprint-managed backend configuration. The user provides the backend
        type and config at blueprint creation time. The platform generates and
        injects backend.tf for the created service.
      required:
        - type
      properties:
        type:
          type: string
          description: Terraform backend type (e.g. s3, gcs, azurerm)
        config:
          type: object
          additionalProperties:
            type: string
          description: >-
            Static backend configuration (bucket, region, etc.). Credentials
            should be provided via environment variables, not here.
    ApplicationGitRepository:
      type: object
      required:
        - provider
        - owner
        - name
        - url
      properties:
        has_access:
          type: boolean
        provider:
          $ref: '#/components/schemas/GitProviderEnum'
        owner:
          type: string
          example: John Doe
        url:
          type: string
          format: uri
        name:
          type: string
          description: repository name
          example: simple-node-app
        branch:
          type: string
        root_path:
          type: string
        deployed_commit_id:
          type: string
          description: Git commit ID corresponding to the deployed version of the app
        deployed_commit_date:
          type: string
          readOnly: true
          format: date-time
          description: Git commit date corresponding to the deployed version of the app
        deployed_commit_contributor:
          type: string
          description: Git commit user corresponding to the deployed version of the app
        deployed_commit_tag:
          type: string
          example: v1.0.1
        git_token_id:
          type: string
          nullable: true
        git_token_name:
          type: string
          nullable: true
      title: ''
    GitProviderEnum:
      type: string
      enum:
        - BITBUCKET
        - GITHUB
        - GITLAB
  responses:
    '400':
      description: Bad request
    '401':
      description: Access token is missing or invalid
    '403':
      description: Access forbidden
    '404':
      description: Resource not found
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT tokens should be used with OIDC account (human to machine). JWT
        tokens used by the Qovery console to communicate with the API have a
        TTL. Curl Example ' curl https://console.qovery.com/organization -H
        "Authorization: Bearer $qovery_token" '
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Token API are generated by Qovery to manage machine to machine
        interaction and do not have a TTL. Curl Example ' curl
        https://console.qovery.com/organization -H "Authorization: Token
        $qovery_token" '

````