Open japerrin opened 10 months ago
Hi
I tried to create a VMware NSX-V "logical switch" object with: resource "restapi_object" "create_logical_switch" { path = "/api/2.0/vdn/scopes/${local.transport_zone_id}/virtualwires" read_path = "/api/2.0/vdn/virtualwires" data = local.body_json object_id = "*" }
locals {
body = { name = var.logical_switch_name, description = var.logical_switch_description, tenantId = local.tenant_id, guestVlanAllowed = false }
body_json = jsonencode(local.body) }
The URI is different to create object and get its properties, so I set the path and read_path.
I have an issue when I create the object, the NSX-V API return the id BUT the ID is returned as raw like: "virtualwire-12"
and not formated like: {"id": "virtualwire-12"}
So I have the error message: Error: internal validation failed; object ID is not set, but may have been created; this should never happen
The object is created but terraform return an error
How can I do to reformat the response raw from "virtualwire-12" to {"id": "virtualwire-12"} ?
Thanks a lot Jacques
Hi @japerrin I created the above PR adding that functionality. Please feel free to review it and share any thoughts.
Hi
I tried to create a VMware NSX-V "logical switch" object with: resource "restapi_object" "create_logical_switch" { path = "/api/2.0/vdn/scopes/${local.transport_zone_id}/virtualwires" read_path = "/api/2.0/vdn/virtualwires" data = local.body_json object_id = "*" }
locals {
Build body
body = { name = var.logical_switch_name, description = var.logical_switch_description, tenantId = local.tenant_id, guestVlanAllowed = false }
body_json = jsonencode(local.body)
}
The URI is different to create object and get its properties, so I set the path and read_path.
I have an issue when I create the object, the NSX-V API return the id BUT the ID is returned as raw like: "virtualwire-12"
and not formated like:
{"id": "virtualwire-12"}
So I have the error message: Error: internal validation failed; object ID is not set, but may have been created; this should never happen
The object is created but terraform return an error
How can I do to reformat the response raw from "virtualwire-12" to {"id": "virtualwire-12"} ?
Thanks a lot Jacques