Add psoautomationvm17404119749459031538_20261127_171128.tf

This commit is contained in:
gitops_test 2026-11-27 17:11:31 +00:00
parent f4fcb7063f
commit a0dc0263b6

View File

@ -0,0 +1,78 @@
terraform {
required_providers {
ovh = {
source = "ovh/ovh"
version = "2.3.0"
}
}
}
provider "ovh" {
endpoint = "ovh-eu"
}
# Same value as OVH_PROJECT_ID in the cloud environment.
# The flavor and image data sources need it explicitly.
# bc35e9294795473794cf839400e5ad35 is replaced before upload from infrastructure.ovh.project-id_<env> in application.properties.
variable project_id {
type = string
default = "bc35e9294795473794cf839400e5ad35"
}
# infra-be reads the region for the email from this default.
variable region {
type = string
default = "SBG5"
}
data "ovh_cloud_project_flavors" "flavors" {
service_name = var.project_id
name_filter = "d2-4"
region = var.region
}
data "ovh_cloud_project_images" "images" {
service_name = var.project_id
region = var.region
}
locals {
selected_image = one([
for m in data.ovh_cloud_project_images.images.images : m if m.name == "Ubuntu 22.04"
])
selected_flavor = one(data.ovh_cloud_project_flavors.flavors.flavors)
}
resource "ovh_cloud_project_instance" "simpl_vm" {
service_name = var.project_id
region = var.region
billing_period = "hourly"
name = "pso-automation-vm-b0a27cd4-6d5f-4940-a1aa-4acdd16e3cd9"
boot_from {
image_id = local.selected_image.id
}
flavor {
flavor_id = local.selected_flavor.id
}
ssh_key_create {
name = "pso-automation-key-b0a27cd4-6d5f-4940-a1aa-4acdd16e3cd9"
# Quoted on purpose: infrastructure-be replaces the quoted placeholder below with the public key
# of the SSH key pair it generates for each trigger (ScriptTriggerServiceImpl, v2.5.0).
public_key = "var.simpl_ssh_key"
}
network {
public = true
}
# cloud-config with the infra-be placeholders for the generated user, password hash and SSH key
user_data = "I2Nsb3VkLWNvbmZpZwpob3N0bmFtZTogc2ltcGwtdm0Kc3NoX3B3YXV0aDogdHJ1ZQpjaHBhc3N3ZDoKICBleHBpcmU6IGZhbHNlCnVzZXJzOgogIC0gZGVmYXVsdAogIC0gbmFtZToge25hbWV9CiAgICBwYXNzd2Q6IHtwd2R9CiAgICBsb2NrX3Bhc3N3ZDogZmFsc2UKICAgIHNoZWxsOiAvYmluL2Jhc2gKICAgIHN1ZG86IEFMTD0oQUxMKSBOT1BBU1NXRDpBTEwKICAgIGdyb3VwczogdXNlcnMsIGFkbWluLCBzdWRvCiAgICBzc2hfYXV0aG9yaXplZF9rZXlzOgogICAgICAtIHtrZXl9Cg=="
}
# Must be named vmIps: infra-be takes the public IP for the email from it.
output "vmIps" {
value = tolist(ovh_cloud_project_instance.simpl_vm.addresses[*].ip)
}