OVHcloud Terraform provider
The OVH provider is the entry point to interact with the resources provided by OVHcloud.
Latest releasev2.22.0GitHub
# OAuth2terraform { required_providers { ovh = { source = "ovh/ovh" } }} provider "ovh" { endpoint = "ovh-eu" client_id = "xxxxxxxxx" client_secret = "yyyyyyyyy"}
Quoted from the provider's documentation
Configure
The provider needs to be configured with the proper credentials before it can be used. Three forms of authentication are supported:
OAuth2
OAuth2, using scoped service accounts, and compatible with OVHcloud IAM. First, generate a pair of valid client_id and client_secret. Create a service account.
Access token
A short-lived access token received from the OVHcloud API. The provider looks for it in the OVH_ACCESS_TOKEN environment variable, or in the access_token argument; the endpoint is set the same way.
Application key
An application key, an application secret and a consumer key, generated on the OVHcloud token generation page. Create the keys.
The endpoint: ovh-eu for the OVHcloud Europe API, ovh-ca for Canada, ovh-us for the US.
Credentials
Rather than in the code, the same code may run in several environments: the provider first looks for direct parameters, then for environment variables, then for a configuration file.
- OAuth2:
OVH_ENDPOINT, OVH_CLIENT_ID and OVH_CLIENT_SECRET - Access token:
OVH_ENDPOINT and OVH_ACCESS_TOKEN - Application key:
OVH_ENDPOINT, OVH_APPLICATION_KEY, OVH_APPLICATION_SECRET and OVH_CONSUMER_KEY
The configuration file, for OAuth2:
[default] ; general configuration: default endpoint endpoint=ovh-eu [ovh-eu] ; configuration specific to 'ovh-eu' endpoint client_id=my_client_id client_secret=my_client_secret
Looked for in ./ovh.conf, ~/.ovh.conf, then /etc/ovh.conf.
Example
A Managed Kubernetes cluster and its node pool:
Every resource and data source: the provider's documentation; which provider and resource stand for what in the Control Panel: Terraform at OVHcloud.
Configuration reference
Every argument is optional; each has its environment variable.
| Argument | What it sets |
|---|---|
endpoint | Which API endpoint to use, e.g. ovh-eu or ovh-ca. OVH_ENDPOINT. |
client_id | The OAuth2 client ID. OVH_CLIENT_ID. |
client_secret | The OAuth2 client secret. OVH_CLIENT_SECRET. |
access_token | The OVH API access token. OVH_ACCESS_TOKEN. |
application_key | The API application key. OVH_APPLICATION_KEY. |
application_secret | The API application secret. OVH_APPLICATION_SECRET. |
consumer_key | The API consumer key. OVH_CONSUMER_KEY. |
user_agent_extra | Extra information to append at the end of the user-agent used when making API calls. |
http_headers | A map of extra HTTP headers to add to every request made to the OVH API. |
api_rate_limit | The API request rate limit, X operations by second. If omitted, unlimited. |
State storage
To keep your Terraform states on a High Performance (S3) OVHcloud Object Storage, follow the guide.
Guides
Step-by-step guides from the OVHcloud documentation, by product, then the provider's own.
Public Cloud
Storage and Backup
Private Cloud
- Using Terraform with SNC Cloud PlatformSNC Cloud Platform
- How to use TerraformOn-Prem Cloud Platform
- Deploy an SAP system infrastructure on VMware on OVHcloud solution with TerraformSAP on OVHcloud
- Deploy virtual machines of SAP Application Server on VMware on OVHcloud solution with TerraformSAP on OVHcloud
- Deploy virtual machines of SAP HANA database on VMware on OVHcloud solution with TerraformSAP on OVHcloud