Closed hegerdes closed 11 months ago
currently you can get the exact match behavior you are looking for in the data source by using the name and version field combination:
data "ionoscloud_image" "boot" {
name = "ubuntu"
version = "20.04-amd64"
type = "HDD"
location = "de/txl"
}
the name field alone does not have this behavior, this will be fixed
Except for this part:
If both "name" and "version" are provided the plugin will concatenate the two strings in this format [name]-[version].
There is no reference of a version
attribute. So docs can be improved.
It also only allows image names in this format. So semantic version schema naming is not supported. For now we needed a solution and just switched the image name to use latest
as their postfix - making them unique.
Most important is to get the behavior of ionoscloud_server
fixed when the name is directly applied.
the exact match behavior for the image name in ionoscloud_image
and ionoscloud_server
will be fixed in the next release
Great!
Also, another bug is when you run terraform destroy but the image_name changed terraform fails with an immutable error. This should not happen in destroy, since the resource will be gone anyway.
Will this also be fixes?
Can you describe the scenario a little more? It shouldn't be possible to change the image_name since it's an immutable field.
Sure, it not a serious problem but can be annoying.
Consider this:
Yes, this is an annoying behavior. The way terraform usually deals with immutable is to force re-creation of the resource.
We throw an error, but this makes it difficult to see if a destroy is triggered. One wokraround is to run terraform destroy -refresh=false
Original problem should be fixed in the latest release https://github.com/ionos-cloud/terraform-provider-ionoscloud/releases/tag/v6.4.10
Description
There are two ways to set the OS image for a system. Either via the
image_name
attribute inionoscloud_server
or via an ID that is fetched from the image datasource attribute. They behave differently leading to bugs and no possibility to select certan images.Consider this: Two images
ubuntu-20.04-amd64
andubuntu-20.04-amd64-2023-10-01
. Both in all regions, both with cloudInit, both HDD, same attributes.When you use datasource the is no way to distinguish the two images, because
name
allows partial matches. Resulting in more than one match -> resulting in an errorError:
Using
image_alias
is also no solution than there is no way AFAIK to set this field via the DCD orionosctl
The alternative to use
ionoscloud_server
works but produces unexpected results:This just creates a VM with the image
ubuntu-20.04-amd64-2023-10-01
because it does partial matches and just uses the first one that is found.So there is no way to use the image you want.
Expected behavior
Use the image specified and not a other one that has almost the same name.
Environment
Terraform version:
Provider version:
OS:
Configuration Files
How to Reproduce
Error and Debug Output
Additional Notes
Please consider a major image upload and usage system - the current state it unusable
Also, another bug is when you run
terraform destroy
but theimage_name
changed terraform fails with an immutable error. This should not happen in destroy, since the resource will be gone anyway.References