Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement new stackit_image resource and datasource #609

Open
wants to merge 7 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions docs/data-sources/image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_image Data Source - stackit"
subcategory: ""
description: |-
Image datasource schema. Must have a region specified in the provider configuration.
~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our guide https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources for how to opt-in to use beta resources.
---

# stackit_image (Data Source)

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

~> This resource is in beta and may be subject to breaking changes in the future. Use with caution. See our [guide](https://registry.terraform.io/providers/stackitcloud/stackit/latest/docs/guides/opting_into_beta_resources) for how to opt-in to use beta resources.

## Example Usage

```terraform
data "stackit_image" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
image_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `image_id` (String) The image ID.
- `project_id` (String) STACKIT project ID to which the image is associated.

### Read-Only

- `checksum` (Attributes) Representation of an image checksum. (see [below for nested schema](#nestedatt--checksum))
- `config` (Attributes) Properties to set hardware and scheduling settings for an image. (see [below for nested schema](#nestedatt--config))
- `disk_format` (String) The disk format of the image.
- `id` (String) Terraform's internal resource ID. It is structured as "`project_id`,`image_id`".
- `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.
- `name` (String) The name of the image.
- `protected` (Boolean) Whether the image is protected.
- `scope` (String) The scope of the image.

<a id="nestedatt--checksum"></a>
### 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.


<a id="nestedatt--config"></a>
### Nested Schema for `config`

Read-Only:

- `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.
77 changes: 77 additions & 0 deletions docs/resources/image.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "stackit_image Resource - stackit"
subcategory: ""
description: |-
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

```terraform
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
}
```

<!-- schema generated by tfplugindocs -->
## 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](#nestedatt--config))
- `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](#nestedatt--checksum))
- `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.

<a id="nestedatt--config"></a>
### 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.


<a id="nestedatt--checksum"></a>
### 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.
4 changes: 4 additions & 0 deletions examples/data-sources/stackit_image/data-source.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
data "stackit_image" "example" {
project_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
image_id = "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
8 changes: 8 additions & 0 deletions examples/resources/stackit_image/resource.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
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
}
1 change: 0 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ require (
github.com/stackitcloud/stackit-sdk-go/services/argus v0.11.0
github.com/stackitcloud/stackit-sdk-go/services/dns v0.12.1
github.com/stackitcloud/stackit-sdk-go/services/iaas v0.18.0
github.com/stackitcloud/stackit-sdk-go/services/iaasalpha v0.1.12-alpha
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.17.0
github.com/stackitcloud/stackit-sdk-go/services/logme v0.20.1
github.com/stackitcloud/stackit-sdk-go/services/mariadb v0.20.1
Expand Down
2 changes: 0 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ github.com/stackitcloud/stackit-sdk-go/services/dns v0.12.1 h1:nzOZQ2X6joM2iSteP
github.com/stackitcloud/stackit-sdk-go/services/dns v0.12.1/go.mod h1:mv8U7kuclXo+0VpDHtBCkve/3i9h1yT+RAId/MUi+C8=
github.com/stackitcloud/stackit-sdk-go/services/iaas v0.18.0 h1:7QPYi7OZXUSO1uOtp1UXeCbxK0BGJbmjp71kaQOrMa8=
github.com/stackitcloud/stackit-sdk-go/services/iaas v0.18.0/go.mod h1:YfuN+eXuqr846xeRyW2Vf1JM2jU0ikeQa76dDI66RsM=
github.com/stackitcloud/stackit-sdk-go/services/iaasalpha v0.1.12-alpha h1:jwpif4t2gthmKmCXsQ84rmtDdcZkw4QQTFiCd7nTW8M=
github.com/stackitcloud/stackit-sdk-go/services/iaasalpha v0.1.12-alpha/go.mod h1:nW/6vvumUHA7o1/JOOqsrEOBNrRHombEKB1U4jmg2wU=
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.17.0 h1:06CGP64CEk3Zg6i9kZCMRdmCzLLiyMWQqGK1teBr9Oc=
github.com/stackitcloud/stackit-sdk-go/services/loadbalancer v0.17.0/go.mod h1:JL94zc8K0ebWs+DBGXR28vNCF0EFV54ZLUtrlXOvWgA=
github.com/stackitcloud/stackit-sdk-go/services/logme v0.20.1 h1:ogo7Ce4wA9ln/Z0VwvckH0FT5/i7d9/34bG85aayHn8=
Expand Down
Loading
Loading