Description
Description
I'm encountering an error when querying images using the terraform-provider-openstack
v2.1.0 (older ones didnt work as well) with Gophercloud v1.13.0. The error message indicates that there is an issue with unmarshalling JSON response into the Go struct, specifically json: cannot unmarshal string into Go struct field .images of type bool
.
Error Log
Here is the relevant part of the error log:
X-Openstack-Request-Id: req-810f3056-f3b9-47e1-90d7-d56ed14fb69a: timestamp="2024-07-23T14:47:56.745+0200"
2024-07-23T14:47:56.746+0200 [INFO] provider.terraform-provider-openstack_v2.1.0: 2024/07/23 14:47:56 [DEBUG] OpenStack Response Body: {
"first": "/v2/images?sort=name%3Aasc\u0026status=active\u0026name=Ubuntu+24.04+LTS",
"images": [
{
"architecture": "x86_64",
Cache-Control: no-cache
User-Agent: HashiCorp Terraform/1.9.2 (+https://www.terraform.io) Terraform Plugin SDK/v2.30.0 Terraform Provider OpenStack/2.1.0 gophercloud/v1.13.0
X-Auth-Token: ***: timestamp="2024-07-23T14:47:56.545+0200"
2024-07-23T14:47:56.745+0200 [INFO] provider.terraform-provider-openstack_v2.1.0: 2024/07/23 14:47:56 [DEBUG] OpenStack Response Code: 200: timestamp="2024-07-23T14:47:56.745+0200"
2024-07-23T14:47:56.745+0200 [INFO] provider.terraform-provider-openstack_v2.1.0: 2024/07/23 14:47:56 [DEBUG] OpenStack Response Headers:
Connection: keep-alive
Content-Length: 1636
Content-Type: application/json; charset=UTF-8
Date: Tue, 23 Jul 2024 12:47:56 GMT
Front-End-Https: on
Server: nginx
X-Openstack-Request-Id: req-810f3056-f3b9-47e1-90d7-d56ed14fb69a: timestamp="2024-07-23T14:47:56.745+0200"
2024-07-23T14:47:56.746+0200 [INFO] provider.terraform-provider-openstack_v2.1.0: 2024/07/23 14:47:56 [DEBUG] OpenStack Response Body: {
"first": "/v2/images?sort=name%3Aasc\u0026status=active\u0026name=Ubuntu+24.04+LTS",
"images": [
{
"architecture": "x86_64",
"checksum": "6785871c573e1ac9ced4c6e3ba8026d4",
"container_format": "bare",
"created_at": "2024-06-25T11:39:05Z",
"direct_url": "rbd://3ed57603-5970-4c06-8fb2-d383540a88a1/glance-images/4e0b34b4-ee30-4384-a821-ef41828d3143/snap",
"disk_format": "raw",
"file": "/v2/images/4e0b34b4-ee30-4384-a821-ef41828d3143/file",
"filesystems": "ext4",
"hw_disk_bus": "scsi",
"hw_qemu_guest_agent": "true",
"hw_scsi_model": "virtio-scsi",
"id": "4e0b34b4-ee30-4384-a821-ef41828d3143",
"locations": [
{
"metadata": {},
"url": "rbd://3ed57603-5970-4c06-8fb2-d383540a88a1/glance-images/4e0b34b4-ee30-4384-a821-ef41828d3143/snap"
},
{
"metadata": {},
"url": "rbd://65f55c31-8c1a-4294-938f-51c260f84c21/glance-images/4e0b34b4-ee30-4384-a821-ef41828d3143/snap"
},
{
"metadata": {},
"url": "rbd://05b72e9b-fd8c-4d62-8cd3-8ec6b7ef6627/glance-images/4e0b34b4-ee30-4384-a821-ef41828d3143/snap"
}
],
"min_disk": 10,
"min_ram": 512,
"name": "Ubuntu 24.04 LTS",
"orig_id": "4e0b34b4-ee30-4384-a821-ef41828d3143",
"os_distro": "ubuntu",
"os_hidden": "False",
"os_type": "linux",
"os_visibility": "public",
"owner": "de8967bdfa1c4e06ac905a1331f1e71e",
"owner_specified.openstack.object": "images/Ubuntu 24.04 LTS (20240625113902)",
"project": "de8967bdfa1c4e06ac905a1331f1e71e",
"protected": false,
"schema": "/v2/schemas/image",
"self": "/v2/images/4e0b34b4-ee30-4384-a821-ef41828d3143",
"size": 10737418240,
"status": "active",
"tags": [],
"updated_at": "2024-07-23T11:50:10Z",
"virtual_size": null,
"visibility": "public"
}
],
"schema": "/v2/schemas/images"
}: timestamp="2024-07-23T14:47:56.745+0200"
(...)
2024-07-23T14:47:56.746+0200 [ERROR] provider.terraform-provider-openstack_v2.1.0: Response contains error diagnostic: diagnostic_detail="" diagnostic_severity=ERROR tf_data_source_type=openstack_images_image_v2 tf_provider
_addr=registry.terraform.io/terraform-provider-openstack/openstack @module=sdk.proto tf_proto_version=5.4 tf_req_id=282f70e3-6ebe-218b-2137-deec11aba05d tf_rpc=ReadDataSource @caller=github.com/hashicorp/terraform-plugin-go
@v0.19.0/tfprotov5/internal/diag/diagnostics.go:58 diagnostic_summary="Unable to query images: json: cannot unmarshal string into Go struct field .images of type bool" timestamp="2024-07-23T14:47:56.746+0200"
2024-07-23T14:47:56.747+0200 [ERROR] vertex "data.openstack_images_image_v2.ubuntu" error: Unable to query images: json: cannot unmarshal string into Go struct field .images of type bool
2024-07-23T14:47:56.747+0200 [ERROR] vertex "data.openstack_images_image_v2.ubuntu (expand)" error: Unable to query images: json: cannot unmarshal string into Go struct field .images of type bool
Failing Image Data
Here is the data for the failing image query:
{
"checksum": "6785871c573e1ac9ced4c6e3ba8026d4",
"container_format": "bare",
"created_at": "2024-06-25T11:39:05Z",
"disk_format": "raw",
"file": "/v2/images/4e0b34b4-ee30-4384-a821-ef41828d3143/file",
"id": "4e0b34b4-ee30-4384-a821-ef41828d3143",
"min_disk": 10,
"min_ram": 512,
"name": "Ubuntu 24.04 LTS",
"owner": "1870421f338248f684e2b1c0cc63b5d4",
"properties": {
"os_hidden": true,
"os_visibility": "public",
"owner_specified.openstack.sha256": "",
"orig_id": "4e0b34b4-ee30-4384-a821-ef41828d3143",
"owner_specified.openstack.object": "images/Ubuntu 24.04 LTS (20240625113902)",
"filesystems": "ext4",
"project": "de8967bdfa1c4e06ac905a1331f1e71e",
"owner_specified.openstack.md5": "",
"locations": [
{
"url": "rbd://3ed57603-5970-4c06-8fb2-d383540a88a1/glance-images/4e0b34b4-ee30-4384-a821-ef41828d3143/snap",
"metadata": {}
},
{
"url": "rbd://65f55c31-8c1a-4294-938f-51c260f84c21/glance-images/4e0b34b4-ee30-4384-a821-ef41828d3143/snap",
"metadata": {}
},
{
"url": "rbd://05b72e9b-fd8c-4d62-8cd3-8ec6b7ef6627/glance-images/4e0b34b4-ee30-4384-a821-ef41828d3143/snap",
"metadata": {}
}
],
"direct_url": "rbd://3ed57603-5970-4c06-8fb2-d383540a88a1/glance-images/4e0b34b4-ee30-4384-a821-ef41828d3143/snap",
"architecture": "x86_64",
"os_distro": "ubuntu",
"hw_disk_bus": "scsi",
"hw_scsi_model": "virtio-scsi",
"os_type": "linux",
"hw_qemu_guest_agent": "yes"
},
"protected": false,
"schema": "/v2/schemas/image",
"size": 10737418240,
"status": "active",
"tags": [],
"updated_at": "2024-07-22T15:07:50Z",
"visibility": "public"
}
Working Image Data
Here is the data for a working image query for comparison:
{
"container_format": "bare",
"created_at": "2023-01-04T10:49:23Z",
"disk_format": "raw",
"file": "/v2/images/6e4b4289-22d2-4c8b-8a61-18266e4f1a04/file",
"id": "6e4b4289-22d2-4c8b-8a61-18266e4f1a04",
"min_disk": 8,
"min_ram": 0,
"name": "Ubuntu 22.04 (LTS)",
"owner": "de8967bdfa1c4e06ac905a1331f1e71e",
"properties": {
"image_supports_password": "true",
"vendor_is_eol_after": "2027/04/02",
"description": "Ubuntu 22.04 (Jammy Jellyfish)",
"filesystems": "ext4",
"image_supports_keypair": "true",
"locations": [
{
"url": "rbd://05b72e9b-fd8c-4d62-8cd3-8ec6b7ef6627/glance-images/6e4b4289-22d2-4c8b-8a61-18266e4f1a04/snap",
"metadata": {}
},
{
"url": "rbd://65f55c31-8c1a-4294-938f-51c260f84c21/glance-images/6e4b4289-22d2-4c8b-8a61-18266e4f1a04/snap",
"metadata": {}
},
{
"url": "rbd://3ed57603-5970-4c06-8fb2-d383540a88a1/glance-images/6e4b4289-22d2-4c8b-8a61-18266e4f1a04/snap",
"metadata": {}
}
],
"direct_url": "rbd://05b72e9b-fd8c-4d62-8cd3-8ec6b7ef6627/glance-images/6e4b4289-22d2-4c8b-8a61-18266e4f1a04/snap",
"architecture": "x86_64",
"os_distro": "ubuntu",
"os_version": "22.04",
"hw_disk_bus": "scsi",
"hw_scsi_model": "virtio-scsi",
"os_type": "linux",
"hw_qemu_guest_agent": "yes",
"os_require_quiesce": true
},
"protected": false,
"schema": "/v2/schemas/image",
"size": 8589934592,
"status": "active",
"tags": [],
"updated_at": "2023-08-28T08:34:59Z",
"visibility": "public"
}
Steps to Reproduce
- Use the
terraform-provider-openstack
v2.1.0 to query an image with the specified failing data. - Observe the error message indicating a JSON unmarshalling issue.
Expected Behavior
The query should successfully retrieve the image information without any unmarshalling errors.
Actual Behavior
The query fails with an error message stating json: cannot unmarshal string into Go struct field .images of type bool
.