Add TestOliveira_20251127_082744.TF
This commit is contained in:
parent
4b9430b5f0
commit
c12c5b20f4
68
TestOliveira_20251127_082744.TF
Normal file
68
TestOliveira_20251127_082744.TF
Normal file
@ -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 = "625a3295ce6649b1aa5e63303de213c4"
|
||||
}
|
||||
|
||||
variable local_region {
|
||||
type = string
|
||||
default = "SBG5"
|
||||
}
|
||||
|
||||
// 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 = "b2-15"
|
||||
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)
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user