Hi
To be more clear. During a create I send a property called name to the api and the api response after creating does not include the same property. In this scenario there is no way to read from the state. So the possible workaround I can think of is use the user specified config(HCL) and assign it to the state after all CRUD operation. So, my question is there a better way?
Scenario 1: In the payload I send name attribute but in the response, I do not get the attribute back.
Payload
{
"orgID":"***",
"description":"postman",
"permissions":[
{
"action":"read",
"resource":{
"name": "measurements",
"orgID":"***",
"type":"buckets"
}
},
{
"action":"write",
"resource":{
"name": "measurements",
"orgID":"***",
"type":"buckets"
}
}
]
}
Response:
{
"orgID": "***",
"permissions": [
{
"action": "read",
"resource": {
"type": "buckets",
"orgID": "***",
"org": "***"
}
},
{
"action": "write",
"resource": {
"type": "buckets",
"orgID": "***",
"org": "***"
}
}
],
"createdAt": "2024-04-13T10:02:06.866838962Z",
"updatedAt": "2024-04-13T10:02:06.866838962Z"
}
Scenario 2: In the payload I do not set name attribute but in the response i get it back.
Payload:
{
"orgID":"***",
"description":"postman",
"permissions":[
{
"action":"read",
"resource":{
"id": "***",
"orgID":"***",
"type":"buckets"
}
},
{
"action":"write",
"resource":{
"id": "***",
"orgID":"***",
"type":"buckets"
}
}
]
}
Response:
{
"id": "***",
"description": "postman",
"orgID": "***",
"org": "cb",
"permissions": [
{
"action": "read",
"resource": {
"type": "buckets",
"id": "***",
"orgID": "***",
"name": "signals",
"org": "cb"
}
},
{
"action": "write",
"resource": {
"type": "buckets",
"id": "***",
"orgID": "***",
"name": "signals",
"org": "***"
}
}
],
"createdAt": "2024-04-13T10:05:13.862282089Z",
"updatedAt": "2024-04-13T10:05:13.862282089Z"
}
How can I handle this in the provider framework? If the HCL config does not have name attribute use from the api response but if it is set, then use it from HCL config coz it is not available from the api response.