Add psoautomationvm8640471174374746384_20261110_212209.tf
This commit is contained in:
parent
45c9509306
commit
1b322161a4
75
psoautomationvm8640471174374746384_20261110_212209.tf
Normal file
75
psoautomationvm8640471174374746384_20261110_212209.tf
Normal file
@ -0,0 +1,75 @@
|
||||
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.
|
||||
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-ace68b4b-652e-43a1-99fb-9553db110fc1"
|
||||
|
||||
boot_from {
|
||||
image_id = local.selected_image.id
|
||||
}
|
||||
|
||||
flavor {
|
||||
flavor_id = local.selected_flavor.id
|
||||
}
|
||||
|
||||
ssh_key_create {
|
||||
name = "pso-automation-key-ace68b4b-652e-43a1-99fb-9553db110fc1"
|
||||
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)
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user