@badarsebard I was testing mapper creation with the provider today and noticed no matter what I did it would fail with a 400 error on a terraform apply.
2023-02-23T02:51:40.179Z [DEBUG] provider.terraform-provider-xsoar_v0.3.61: 2023/02/23 02:51:40 code: 400 status: 400 Bad Request headers: map[Content-Type:[application/json] Date:[Thu, 23 Feb 2023 02:51:40 GMT] Server-Timing:[332] Strict-Transport-Security:[max-age=10886400000000000; includeSubDomains] Vary:[Accept-Encoding Accept-Encoding] X-Content-Type-Options:[nosniff] X-Frame-Options:[DENY] X-Xss-Protection:[1; mode=block]] body: {"id":"bad_request","status":400,"title":"Bad request","detail":"Request body is not well-formed. It must be JSON.","error":"json: cannot unmarshal object into Go struct field InstanceClassifier.keyTypeMap of type string","encrypted":false,"multires":null}
This wouldn't occur when not populating the variable mapping in the terraform resource. Setting the mapping to a single value in the XSOAR gui and copying this value into the mapping portion allowed the plan to successfully detect that no changes are observed.
I went ahead and inspected this via proxy to see how the request appeared going from terraform to the XSOAR server and right away I noticed the provider is appending the value of mapper into keyTypeMap when making the post request. The post request payload looks like this when the provider applies the change:
The plan always runs fine so I think this is only on the creation portion and not the data resource. When making a terraform output using your data resource in the provider it returned the mapping value correctly as well.
My test terraform code to validate this and gather the attached info:
@badarsebard I was testing mapper creation with the provider today and noticed no matter what I did it would fail with a 400 error on a terraform apply.
This wouldn't occur when not populating the variable
mapping
in the terraform resource. Setting the mapping to a single value in the XSOAR gui and copying this value into the mapping portion allowed the plan to successfully detect that no changes are observed.I went ahead and inspected this via proxy to see how the request appeared going from terraform to the XSOAR server and right away I noticed the provider is appending the value of
mapper
intokeyTypeMap
when making the post request. The post request payload looks like this when the provider applies the change:When I believe it should be like this:
The plan always runs fine so I think this is only on the creation portion and not the data resource. When making a terraform output using your data resource in the provider it returned the mapping value correctly as well.
My test terraform code to validate this and gather the attached info:
Proxy (Post / Response)
Terraform Apply