Skip to content

Error: json: cannot unmarshal string into Go struct field .Properties of type map[string]interface {} during VM instance creation #1703

@d-kazantsev

Description

@d-kazantsev

Hi there,

Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see https://www.terraform.io/community.html.

Terraform Version

Run terraform -v to show the version. If you are not running the latest version of Terraform, please upgrade because your issue may have already been fixed.

Terraform v1.7.5-dev
on linux_amd64

Affected Resource(s)

Please list the resources as a list, for example:
My resource is following:

"openstack_compute_instance_v2"

If this issue appears to affect multiple resources, it may be an issue with Terraform's core, so please mention this.

Terraform Configuration Files

# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.

resource "openstack_compute_instance_v2" "instance1" {
name = var.name
image_id = var.image_id
flavor_name = var.flavor
key_pair = var.keypair
security_groups = var.sec_group

network {
name = var.net_name
}
}

Debug Output

Please provide a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html.

In addition, running Terraform with the OS_DEBUG=1 environment variable set will print additional information specific to the OpenStack provider which will be helpful for troubleshooting.

https://pastebin.canonical.com/p/PPJRSn4qdD/

Panic Output

If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.

Expected Behavior

What should have happened?
Openstack instance should be created and terraform should report success.

Actual Behavior

What actually happened?

Openstack instance is created but Error is reported.

openstack_blockstorage_volume_v3.fio_test_volume: Creating...
openstack_compute_instance_v2.instance1: Creating...
openstack_blockstorage_volume_v3.fio_test_volume: Still creating... [10s elapsed]
openstack_compute_instance_v2.instance1: Still creating... [10s elapsed]
openstack_blockstorage_volume_v3.fio_test_volume: Creation complete after 11s [id=7c92da31-0ca1-45b8-9e9a-9250ab777121]

│ Error: json: cannot unmarshal string into Go struct field .Properties of type map[string]interface {}

│ with openstack_compute_instance_v2.instance1,
│ on main.tf line 2, in resource "openstack_compute_instance_v2" "instance1":
│ 2: resource "openstack_compute_instance_v2" "instance1" {

Both volume and VM instance are created successfully but this error prevents me to move further.

It looks like Glance returns "incorrectly" formatted "properties" for my image which is used by Openstack to boot VM:

"properties": "{'hypervisor_type': 'qemu', 'architecture': 'x86_64'}"

and this can not be unmarshal.

echo "{'hypervisor_type': 'qemu', 'architecture': 'x86_64'}" | jq .
parse error: Invalid numeric literal at line 1, column 19
$ echo '{"hypervisor_type": "qemu", "architecture": "x86_64"}' | jq .
{
"hypervisor_type": "qemu",
"architecture": "x86_64"
}

Steps to Reproduce

Please list the steps required to reproduce the issue, for example:

  1. terraform apply
    Image from the Glance must contain properties with single quote formatting.

Important Factoids

Is there anything atypical about your accounts that we should know? For example: Running in EC2 Classic? A custom version of OpenStack? Tight ACLs?

References

Are there any other GitHub issues (open or closed) or Pull Requests that should be linked here? For example:

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions