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
… we can identify we are not getting a formatted JSON response object
If we get a response as a string or int we are assigning that response
as the id of the obj. We need to set the `id_attribute` to `*`
S3B4SZ17
pushed a commit
to S3B4SZ17/terraform-provider-restapi
that referenced
this issue
Mar 10, 2024
* Adding a Makefile for simplicity to build the project and clean it, also
to run the tests more easily
* Updated the fakeserver so we can test the new func for non JSON
responses
S3B4SZ17
pushed a commit
to S3B4SZ17/terraform-provider-restapi
that referenced
this issue
Mar 10, 2024
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
The text was updated successfully, but these errors were encountered: