Nested map in custom terraform provider

Hi,
Could you please provider example for custom terraform provider using nested map.
I’m interested not how to use it in terraform script, but how to write such provider , how to describe schema. I found only plugin sdk, and example would be very useful

Best regards,
Dmitriy

Simply saying “nested map” is not enough to explain what you are trying to implement. It leaves open questions like:

  • How many levels of nesting?

  • What data types are to be present as the final values in the nested structure?

Also, what is it you want to do with this value?

  • Use it in provider configuration?

  • Accept it as input to a resource/data source?

  • Return it as a result attribute from a resource/data source?

Please answer those questions, and preferably provide a concrete example of the kind of value you are imagining.

Hi,

our REST API send json file as a data.
JSON file contains map of map.
For example:
{
“nodes”: [
{
“uuid”: “fe6e939c-392f-4c1f-879d-13b3ae1f3d73”,
“provider_id”: “c30fb111-1e43-4a1f-8085-3894a184c3f8”,
“roles”: [
“adminNode”
],
“hostname”: “xxxxxx”,
“mgmt_ip”: “xxxxx”,
“userName”: “root”,
“password”: “xxxxx”
}
],
“solution”: {
“disk_groups”: {},
“networks_groups”: {},
“options”: {}
}
}

How to describe that resource in terraform provider.
Could you please share example

Best regards,
Dmitriy

Hi @dtrvno :wave:,

Are you trying to devise a schema which could be used with Terraform configuration to supply values to the API you are calling? If so, then you might be able to use a ListNestedAttribute for nodes and a SingleNestedAttribute for solution.

Is this the sort of thing you had in mind?