Add script_maurouserdata1_20260805_091624.tf
This commit is contained in:
parent
48a7d464c6
commit
bf843fa2b0
45
script_maurouserdata1_20260805_091624.tf
Normal file
45
script_maurouserdata1_20260805_091624.tf
Normal file
@ -0,0 +1,45 @@
|
||||
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
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user