feat: terraform configuration for classic VPS

This commit is contained in:
2026-08-13 13:23:05 +02:00
parent 1301b05977
commit dd0351ad49
3 changed files with 84 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
# Fetch billing subsidiary details from your OVH account profile
data "ovh_me" "myaccount" {}
# Provision the Classic VPS
resource "ovh_vps" "vps_1" {
display_name = "coolify"
ovh_subsidiary = data.ovh_me.myaccount.ovh_subsidiary # Country of billing entity (e.g. "CH", "DE")
plan = [
{
duration = "P1M" # Monthly subscription ("P1M")
plan_code = "vps-le-2-2-40" # Starter plan model (Adjust depending on current catalog)
pricing_mode = "default"
# Datacenter configuration
configuration = [
{
label = "vps_datacenter"
value = "LIM" # Limburg (DE)
},
{
label = "vps_os"
value = "ubuntu-22.04"
}
]
}
]
public_ssh_key = var.ssh_public_key
}
# The public IP of a classic VPS must be retrieved via a data source after delivery
data "ovh_vps" "vps_1" {
service_name = ovh_vps.vps_1.service_name
}
output "vps_public_ip" {
value = tolist(data.ovh_vps.vps_1.ips)[0]
description = "The public IP address of VPS-1"
}
+14
View File
@@ -0,0 +1,14 @@
terraform {
required_providers {
ovh = {
source = "ovh/ovh"
}
}
}
provider "ovh" {
endpoint = var.ovh_endpoint
application_key = var.ovh_application_key
application_secret = var.ovh_application_secret
consumer_key = var.ovh_consumer_key
}
+30
View File
@@ -0,0 +1,30 @@
variable "ovh_endpoint" {
type = string
description = "The OVH API endpoint"
default = "ovh-eu"
}
variable "ovh_application_key" {
type = string
sensitive = true
}
variable "ovh_application_secret" {
type = string
sensitive = true
}
variable "ovh_consumer_key" {
type = string
sensitive = true
}
variable "ovh_project_id" {
type = string
description = "The OVH Public Cloud Project ID (Service Name)"
}
variable "ssh_public_key" {
type = string
description = "The public SSH key to install on the VM"
}