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
provider "ibm" {
region = "us-south"
}
data "ibm_is_images""images" {
visibility = "public"
status = "available"
filter {
key = "vendor"
values = ["Canonical"]
}
}
output "images" {
value = data.ibm_is_images.images
}
Attempt to validate
% tfv
Initializing the backend...
Initializing provider plugins...
- Finding ibm-cloud/ibm versions matching "1.68.1"...
- Using previously-installed ibm-cloud/ibm v1.68.1
Terraform has been successfully initialized!
You may now begin working with Terraform. Try running "terraform plan" to see
any changes that are required for your infrastructure. All Terraform commands
should now work.
If you ever set or change modules or backend configuration for Terraform,
rerun this command to reinitialize your working directory. If you forget, other
commands will detect it and remind you to do so if necessary.
╷
│ Error: Unsupported block type
│
│ on main.tf line 9, in data "ibm_is_images" "images":
│ 9: filter {
│
│ Blocks of type "filter" are not expected here.
╵
I was able to get around this with using locals:
locals {
filtered_images = [
for image in data.ibm_is_images.images.images :
image if contains([for os in image.operating_system : os.vendor], "Canonical")
]
}
data "ibm_is_images" "images" {
visibility = "public"
status = "available"
user_data_format = ["cloud_init"]
}
@greyhoundforty Terraform can only support what is supported by the API. Anything outside of what API supports should be handled in the client side terraform script like you have done.
@deepaksibm - sorry for the delay, somehow I missed the original notification
I don't see a filter option listed for https://registry.terraform.io/providers/IBM-Cloud/ibm/latest/docs/data-sources/is_images. Can you confirm this was implemented? I see a new
user_data
section but nothing related to the ability to filter by OS familyAttempt to validate
I was able to get around this with using locals:
Originally posted by @greyhoundforty in #4930 (comment)
The text was updated successfully, but these errors were encountered: