From 2f01cd64a372fc70159c5c6e177f0ab90e4b8c1d Mon Sep 17 00:00:00 2001 From: gitops_test Date: Mon, 30 Nov 2026 17:08:29 +0000 Subject: [PATCH] Add psoautomationvm7565072951429009576_20261130_170828.tf --- ...onvm7565072951429009576_20261130_170828.tf | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 psoautomationvm7565072951429009576_20261130_170828.tf diff --git a/psoautomationvm7565072951429009576_20261130_170828.tf b/psoautomationvm7565072951429009576_20261130_170828.tf new file mode 100644 index 0000000..018a6d6 --- /dev/null +++ b/psoautomationvm7565072951429009576_20261130_170828.tf @@ -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_ 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-c03bab08-49c8-4aed-ad44-841688a0a02c" + + boot_from { + image_id = local.selected_image.id + } + + flavor { + flavor_id = local.selected_flavor.id + } + + ssh_key_create { + name = "pso-automation-key-c03bab08-49c8-4aed-ad44-841688a0a02c" + # 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) +}