seven_virtual_machine (Resource)#
Virtual machine (SCVM in SCL terminology)
Example Usage#
# SPDX-License-Identifier: EUPL-1.2
terraform {
required_providers {
seven = {
source = "terraform.scl.example/seven/infrastructure"
}
}
}
provider "seven" {
# example configuration here
}
# To continue successfully, the separation context must already exist and be valid.
# Otherwise, contact the operator to create and provide one.
variable "sc_name" {
type = string
description = "The name of a separation context allocated to a tenant of SCL resources (must exist and be known)."
default = "b"
}
resource "seven_virtual_machine" "my_vm" {
name = "b-vm-01"
# use data dependency to make sure the context is created before the VM
separation_context = var.sc_name
spec_vcpus = 3
spec_ram_mib = 3096
spec_boot_volume = "b-vol-01"
spec_target_state = "paused"
spec_network_device_name = "tap-123"
spec_cloud_init_config = null
}
resource "seven_virtual_machine" "my_local_volume_vm" {
name = "b-vm-02"
separation_context = var.sc_name
spec_local_boot_volume {
size_mib = 256
image = "http://127.0.0.1:9999/cirros-0.5.2-x86_64-disk.raw"
}
spec_vcpus = 2
spec_ram_mib = 256
spec_network_device_name = "tap-321"
spec_cloud_init_config = null
}
output "example_context" {
value = var.sc_name
}
output "example_vm" {
value = resource.seven_virtual_machine.my_vm
}
output "example_local_volume_vm" {
value = resource.seven_virtual_machine.my_local_volume_vm
}
Schema#
Required#
name(String) Unique, immutable name of the VM within the Separation Context.separation_context(String) The name of the Separation Context containing this VM.spec_network_device_name(String) The unique ID of the tap device that should be created for the SC internal networking. Length must be smaller than 16.spec_ram_mib(Number) Amount of RAM in MiB that must be allocated for the VM.spec_vcpus(Number) Amount of virtual CPU cores that must be allocated for the VM.
Optional#
spec_boot_volume(String) The boot Volume of the VM. Must be an existing Volume ID within the Separation Context.spec_cloud_init_config(String) The cloud-init configuration.spec_local_boot_volume(Block Set) The local boot Volume of the VM. (see below for nested schema)spec_target_state(String) The desired target state of the VM.
Read-Only#
id(String) The ID of this resource.resource_version(Number) Resource version used for optimistic concurrency control.
Nested Schema for spec_local_boot_volume#
Required:
image(String) URL of a remote image for initialising the volume.size_mib(Number) Size of the volume in MebiByte.