From 0a9bd95a72cfba5c14cf564bd7fb74f91a86513b Mon Sep 17 00:00:00 2001 From: gitops_test Date: Mon, 9 Mar 2026 18:00:17 +0000 Subject: [PATCH] Add Copy_of_Template_1773079214965_20260309_180017 --- ..._of_Template_1773079214965_20260309_180017 | 68 +++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 Copy_of_Template_1773079214965_20260309_180017 diff --git a/Copy_of_Template_1773079214965_20260309_180017 b/Copy_of_Template_1773079214965_20260309_180017 new file mode 100644 index 0000000..7c8ea36 --- /dev/null +++ b/Copy_of_Template_1773079214965_20260309_180017 @@ -0,0 +1,68 @@ +terraform { + required_providers { + ovh = { + source = "ovh/ovh" + version = "2.3.0" + } + } +} + +provider "ovh" { + endpoint = "ovh-eu" +} + +variable local_project_id { + type = string + default = "xxx" +} + +variable local_region { + type = string + default = "xxx" +} + +// The flavor can be selected directly, name_filter in DS does strict equality +data "ovh_cloud_project_flavors" "flavors" { + service_name = var.local_project_id + name_filter = "xxx" + region = var.local_region +} + +// The image must be selected from it's region based list using name filtering, DS does not support direct selection +data ovh_cloud_project_images image{ + service_name = var.local_project_id + region = var.local_region +} + +locals { + selected_image = one([ + for m in data.ovh_cloud_project_images.image.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.local_project_id + region = var.local_region + billing_period = "hourly" + boot_from { + image_id = local.selected_image.id + } + flavor { + flavor_id = local.selected_flavor.id + } + name = "offering-enterprise-server-{UUID}-terraform" + ssh_key_create { + name = "default-user-key" + public_key = "var.simpl_ssh_public_key" + } + network { + public = true + } + user_data = "var.simpl_cloud_init" +} + +output "vmIps" { + depends_on = [ovh_cloud_project_instance.simpl_vm] + value = tolist(ovh_cloud_project_instance.simpl_vm.addresses[*].ip) +} \ No newline at end of file