You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/data-sources/image.md
+80-3Lines changed: 80 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,29 +4,95 @@ page_title: "stackit_image Data Source - stackit"
4
4
subcategory: ""
5
5
description: |-
6
6
Image datasource schema. Must have a region specified in the provider configuration.
7
+
~> Important: When using the name, name_regex, or filter attributes to select images dynamically, be aware that image IDs may change frequently. Each OS patch or update results in a new unique image ID. If this data source is used to populate fields like boot_volume.source_id in a server resource, it may cause Terraform to detect changes and recreate the associated resource.
8
+
To avoid unintended updates or resource replacements:
9
+
Prefer using a static image_id to pin a specific image version.If you accept automatic image updates but wish to suppress resource changes, use a lifecycle block to ignore relevant changes. For example:
10
+
11
+
resource "stackit_server" "example" {
12
+
boot_volume = {
13
+
size = 64
14
+
source_type = "image"
15
+
source_id = data.stackit_image.latest.id
16
+
}
17
+
18
+
lifecycle {
19
+
ignore_changes = [boot_volume[0].source_id]
20
+
}
21
+
}
7
22
---
8
23
9
24
# stackit_image (Data Source)
10
25
11
26
Image datasource schema. Must have a `region` specified in the provider configuration.
12
27
28
+
~> Important: When using the `name`, `name_regex`, or `filter` attributes to select images dynamically, be aware that image IDs may change frequently. Each OS patch or update results in a new unique image ID. If this data source is used to populate fields like `boot_volume.source_id` in a server resource, it may cause Terraform to detect changes and recreate the associated resource.
29
+
30
+
To avoid unintended updates or resource replacements:
31
+
- Prefer using a static `image_id` to pin a specific image version.
32
+
- If you accept automatic image updates but wish to suppress resource changes, use a `lifecycle` block to ignore relevant changes. For example:
-`project_id` (String) STACKIT project ID to which the image is associated.
29
87
88
+
### Optional
89
+
90
+
-`filter` (Attributes) Additional filtering options based on image properties. Can be used independently or in conjunction with `name` or `name_regex`. (see [below for nested schema](#nestedatt--filter))
91
+
-`image_id` (String) Image ID to fetch directly
92
+
-`name` (String) Exact image name to match. Optionally applies a `filter` block to further refine results in case multiple images share the same name. The first match is returned, optionally sorted by name in ascending order. Cannot be used together with `name_regex`.
93
+
-`name_regex` (String) Regular expression to match against image names. Optionally applies a `filter` block to narrow down results when multiple image names match the regex. The first match is returned, optionally sorted by name in ascending order. Cannot be used together with `name`.
94
+
-`sort_ascending` (Boolean) If set to `true`, images are sorted in ascending lexicographical order by image name (such as `Ubuntu 18.04`, `Ubuntu 20.04`, `Ubuntu 22.04`) before selecting the first match. Defaults to `false` (descending such as `Ubuntu 22.04`, `Ubuntu 20.04`, `Ubuntu 18.04`).
95
+
30
96
### Read-Only
31
97
32
98
-`checksum` (Attributes) Representation of an image checksum. (see [below for nested schema](#nestedatt--checksum))
@@ -36,10 +102,21 @@ data "stackit_image" "example" {
36
102
-`labels` (Map of String) Labels are key-value string pairs which can be attached to a resource container
37
103
-`min_disk_size` (Number) The minimum disk size of the image in GB.
38
104
-`min_ram` (Number) The minimum RAM of the image in MB.
39
-
-`name` (String) The name of the image.
40
105
-`protected` (Boolean) Whether the image is protected.
41
106
-`scope` (String) The scope of the image.
42
107
108
+
<aid="nestedatt--filter"></a>
109
+
### Nested Schema for `filter`
110
+
111
+
Optional:
112
+
113
+
-`distro` (String) Filter images by operating system distribution. For example: `ubuntu`, `ubuntu-arm64`, `debian`, `rhel`, etc.
114
+
-`os` (String) Filter images by operating system type, such as `linux` or `windows`.
115
+
-`secure_boot` (Boolean) Filter images with Secure Boot support. Set to `true` to match images that support Secure Boot.
116
+
-`uefi` (Boolean) Filter images based on UEFI support. Set to `true` to match images that support UEFI.
117
+
-`version` (String) Filter images by OS distribution version, such as `22.04`, `11`, or `9.1`.
0 commit comments