Skip to main content

Overview

Terraform The Qovery Terraform Provider allows you to manage your Qovery infrastructure using Infrastructure as Code (IaC). Define, provision, and manage your applications, databases, environments, and entire stacks declaratively with Terraform.
Complete Documentation: For detailed resource schemas, arguments, and attributes, visit the Qovery Terraform Provider on Terraform Registry.

Why Use Terraform with Qovery?

Infrastructure as Code

Version control your infrastructure alongside your application code

Reproducible Deployments

Deploy identical environments across dev, staging, and production

Team Collaboration

Review infrastructure changes through pull requests

Automation

Integrate with CI/CD pipelines for automated deployments

Getting Started

This guide provides a quick overview of the Qovery Terraform Provider. For comprehensive documentation including all resources, data sources, and configuration options, please refer to the official provider documentation on Terraform Registry.

Installation

Add the Qovery provider to your Terraform configuration:
terraform {
  required_providers {
    qovery = {
      source  = "qovery/qovery"
      version = "~> 0.48.2"
    }
  }
}

provider "qovery" {
  token = var.qovery_api_token
}

Authentication

To authenticate with the Qovery API, you need an API token. You can generate one from the Qovery Console. Set your token as an environment variable:
export QOVERY_API_TOKEN="your-api-token"
Or pass it directly in your Terraform configuration:
provider "qovery" {
  token = "your-api-token"
}
Never commit API tokens to version control. Use environment variables or a secure secrets management solution.

Quick Start

1

Install Terraform

Download Terraform from terraform.io
# Verify installation
terraform version
2

Generate API Token

  1. Go to Qovery Console
  2. Navigate to Organization Settings → API Tokens
  3. Click “Generate Token” and copy it
3

Create Terraform Configuration

Create a main.tf file:
terraform {
  required_providers {
    qovery = {
      source = "qovery/qovery"
      version = "~> 0.48.2"
    }
  }
}

provider "qovery" {
  token = var.qovery_api_token
}

# Get organization and project IDs
data "qovery_organization" "my_org" {
  name = "My Organization"
}

data "qovery_project" "my_project" {
  organization_id = data.qovery_organization.my_org.id
  name = "My Project"
}
4

Initialize and Apply

# Initialize Terraform
terraform init

# Set your API token
export TF_VAR_qovery_api_token="your-api-token"

# Plan changes
terraform plan

# Apply changes
terraform apply

Getting Your IDs

You’ll need various IDs from Qovery for your Terraform configuration:
  • Via Console
  • Via Terraform Data Sources
  • Via CLI
Organization ID:
  • Go to Organization Settings
  • Copy Organization ID from the URL or settings page
Project ID:
  • Navigate to your project
  • Copy Project ID from project settings
Cluster ID:
  • Go to Settings → Clusters
  • Copy Cluster ID from cluster details

Key Resources

The Qovery Terraform provider supports managing:
  • qovery_organization - Organization settings (read-only)
  • qovery_project - Projects to organize applications
  • qovery_environment - Development, staging, production environments
  • qovery_labels_group - Organize resources with labels
  • qovery_application - Containerized applications
  • qovery_container - Custom container deployments
  • qovery_job - Cron jobs and lifecycle jobs
  • qovery_helm - Helm chart deployments
  • qovery_database - Managed databases (PostgreSQL, MySQL, MongoDB, Redis)
  • Container mode or cloud-managed mode
  • Automatic connection string injection
  • qovery_environment_variable - Environment-level variables
  • qovery_environment_variable_alias - Variable aliases
  • qovery_environment_variable_override - Override variables
  • qovery_deployment_stage - Control deployment order
  • qovery_cluster - Kubernetes cluster configuration
  • qovery_aws_credentials - AWS cloud credentials
  • qovery_scaleway_credentials - Scaleway cloud credentials
  • qovery_gcp_credentials - GCP cloud credentials
  • qovery_container_registry - Connect container registries
  • qovery_git_token - Git provider authentication
  • qovery_helm_repository - Add Helm chart repositories

Best Practices

Use Variables

Keep tokens in environment variables, not in code:
variable "qovery_api_token" {
  type = string
  sensitive = true
}

variable "environment" {
  type = string
  default = "production"
}

Use Data Sources

Look up existing resources instead of hardcoding IDs:
data "qovery_project" "my_project" {
  organization_id = var.org_id
  name = "My Project"
}

Organize with Modules

Create reusable modules for common patterns:
modules/
  ├── application/
  ├── database/
  └── environment/

Use Remote State

Store state remotely for team collaboration:
terraform {
  backend "s3" {
    bucket = "my-terraform-state"
    key = "qovery/terraform.tfstate"
  }
}

Importing Existing Resources

Import existing Qovery resources into Terraform:
# Import an application
terraform import qovery_application.my_app <application-id>

# Import an environment
terraform import qovery_environment.prod <environment-id>

# Import a database
terraform import qovery_database.postgres <database-id>

Complete Documentation

Important: This page provides an introduction to the Qovery Terraform Provider. For complete and up-to-date documentation, including:
  • All available resources and data sources
  • Detailed resource schemas and arguments
  • Complete attribute references
  • Advanced configuration options
  • Latest provider updates
Please visit the Qovery Terraform Provider on Terraform Registry.

Next Steps

Additional Resources