terraform-provider-stackitp.../docs/resources/image.md
Alexander Dahmen 721e10a02f
chore(examples): Add import examples for all resources (#939)
* chore(examples): Add import examples for all resources

Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>

* Add guide: How to import resources

Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>

---------

Signed-off-by: Alexander Dahmen <alexander.dahmen@inovex.de>
2025-08-08 14:03:27 +02:00

3.3 KiB

page_title subcategory description
stackit_image Resource - stackit Image resource schema. Must have a region specified in the provider configuration.

stackit_image (Resource)

Image resource schema. Must have a region specified in the provider configuration.

Example Usage

resource "stackit_image" "example_image" {
  project_id      = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
  name            = "example-image"
  disk_format     = "qcow2"
  local_file_path = "./path/to/image.qcow2"
  min_disk_size   = 10
  min_ram         = 5
}

# Only use the import statement, if you want to import an existing image
# Must set a configuration value for the local_file_path attribute as the provider has marked it as required.
# Since this attribute is not fetched in general from the API call, after adding it this would replace your image resource after an terraform apply.
# In order to prevent this you need to add:
#lifecycle {
#    ignore_changes = [ local_file_path ]
#  }
import {
  to = stackit_image.import-example
  id = "${var.project_id},${var.image_id}"
}

Schema

Required

  • disk_format (String) The disk format of the image.
  • local_file_path (String) The filepath of the raw image file to be uploaded.
  • name (String) The name of the image.
  • project_id (String) STACKIT project ID to which the image is associated.

Optional

  • config (Attributes) Properties to set hardware and scheduling settings for an image. (see below for nested schema)
  • labels (Map of String) Labels are key-value string pairs which can be attached to a resource container
  • min_disk_size (Number) The minimum disk size of the image in GB.
  • min_ram (Number) The minimum RAM of the image in MB.

Read-Only

  • checksum (Attributes) Representation of an image checksum. (see below for nested schema)
  • id (String) Terraform's internal resource ID. It is structured as "project_id,image_id".
  • image_id (String) The image ID.
  • protected (Boolean) Whether the image is protected.
  • scope (String) The scope of the image.

Nested Schema for config

Optional:

  • boot_menu (Boolean) Enables the BIOS bootmenu.
  • cdrom_bus (String) Sets CDROM bus controller type.
  • disk_bus (String) Sets Disk bus controller type.
  • nic_model (String) Sets virtual network interface model.
  • operating_system (String) Enables operating system specific optimizations.
  • operating_system_distro (String) Operating system distribution.
  • operating_system_version (String) Version of the operating system.
  • rescue_bus (String) Sets the device bus when the image is used as a rescue image.
  • rescue_device (String) Sets the device when the image is used as a rescue image.
  • secure_boot (Boolean) Enables Secure Boot.
  • uefi (Boolean) Enables UEFI boot.
  • video_model (String) Sets Graphic device model.
  • virtio_scsi (Boolean) Enables the use of VirtIO SCSI to provide block device access. By default instances use VirtIO Block.

Nested Schema for checksum

Read-Only:

  • algorithm (String) Algorithm for the checksum of the image data.
  • digest (String) Hexdigest of the checksum of the image data.