Ionos/script_maurouserdata1_20260805_091624.tf

46 lines
976 B
HCL

terraform {
required_providers {
openstack = {
source = "terraform-provider-openstack/openstack"
version = ">= 1.54.1"
}
}
}
provider "openstack" {
# Authentication is expected from OS_* environment variables.
}
variable "image_name" {
type = string
description = "Name of the image used to create the instance"
default = "Ubuntu 22.04"
}
variable "flavor_name" {
type = string
description = "OpenStack flavor used for the instance"
default = "b2-7"
}
variable "network_name" {
type = string
description = "Network connected to the instance"
default = "Ext-Net"
}
resource "openstack_compute_instance_v2" "test_instance" {
name = "terraform-user-data-test"
image_name = var.image_name
flavor_name = var.flavor_name
network {
name = var.network_name
}
user_data = <<-EOF
#!/bin/bash
echo "Instance initialized successfully" > /tmp/user-data-status.txt
EOF
}