terraform plan, and apply them with terraform apply.
This page covers the setup. The reference of every resource and data source is on the Terraform Registry.
Upgrading from an earlier version? Read the upgrade guide before you change the version constraint.
Requirements
- Terraform. The provider is tested against Terraform 1.15. Earlier versions are expected to work but are not tested.
- A Qovery API token.
Install the provider
Declare the provider and pin its major version, so that a future major release cannot introduce a breaking change without an explicit upgrade:main.tf
terraform init to download the provider.
Authentication
The provider authenticates with a Qovery API token. To create one, see API Token. The token carries a role: give it one that allows the changes your configuration makes. Pass the token in one of two ways:-
Set the
QOVERY_API_TOKENenvironment variable. The provider reads it when thetokenargument is not set. -
Set the
tokenargument from a sensitive input variable:
Find resource IDs
Resources reference each other by ID. To use a resource that your configuration does not manage, such as an existing cluster, pass its ID to the configuration, usually as an input variable.- Console: IDs appear in the page URL, for example
https://console.qovery.com/organization/<organization_id>/project/<project_id>/overview. - CLI:
qovery organization list,qovery project list,qovery cluster listandqovery environment listprint the ID of each resource. Runqovery context setfirst to select the organization and the project. See the CLI documentation.
id, not by its name (qovery_organization_member uses the member’s email). Organization-level data sources, such as qovery_cluster, also require organization_id:
import block. The Registry page of each resource gives its import ID. The Terraform exporter generates the configuration of a whole environment.
How the provider tracks changes
The configuration is the source of truth.terraform plan refreshes every resource from the Qovery API, so a change made from the Console or the API shows up as a difference, and the next terraform apply reverts it to the configured value. The API never returns secrets, such as secret values, passwords and secret keys: Terraform keeps them as configured, so a change made to them outside Terraform does not show up in the plan. Removing an attribute from the configuration plans its default value or its removal.
A few attributes keep their current value when you remove them, because the Qovery API gives Terraform no way to reset them, for example deployment_stage_id and advanced_settings_json. The Managing changes guide explains the rules and lists these exceptions.
Change the resources that Terraform manages in the configuration, not in the Console.
Deploy an environment
Creating or changing a service with Terraform updates its configuration in Qovery but does not deploy it. Theqovery_deployment resource deploys, stops or restarts an environment on terraform apply. You can also deploy from the Console. Qovery stores no deployment object, so a deployment started from the Console does not show up in terraform plan.
Next steps
Basic Application
Deploy an application from a git repository
Application with Database
Connect an application to a database
Linking Services Together
Connect services to each other
Multi-Environment Setup
Create development, staging and production environments
Airbyte Deployment
Deploy a Helm chart with a database and a proxy
Advanced Patterns
Modules, workspaces and remote state
Terraform Exporter
Generate the configuration of an existing environment
Terraform Registry
Reference of every resource and data source
GitHub Repository
Provider source code and issues