Please vote on this issue by adding a :thumbsup: reaction to the original issue to help the community and maintainers prioritize this request
Please do not leave comments along the lines of "+1", "me too" or "any updates", they generate extra noise for issue followers and do not help prioritize the request
If you are interested in working on this issue or have submitted a pull request, please leave a comment and review the contribution guide to help.
╷
│ Error: parsing JSON: json: cannot unmarshal array into Go struct field DashboardProperties.lenses of type map[string]dashboard.DashboardLens
│
│ with azurerm_portal_dashboard.overview,
│ on dashboard.tf line 5, in resource "azurerm_portal_dashboard" "overview":
│ 5: dashboard_properties = jsonencode(jsondecode(file("./dashboard.json")).properties)
│
╵
Expected Behaviour
I expected that I could export a portal dashboard as json, and then load it as a string with the azurerm_portal_dashboard resource.
(PS: i also think it's a bit silly that I have to extract the properties block)
Actual Behaviour
The azurerm_portal_dashboard resource expects a map but gets an array.
This changed between the 2019 and 2020 api versions.
Is there an existing issue for this?
Community Note
Terraform Version
1.9.7
AzureRM Provider Version
4.9.0
Affected Resource(s)/Data Source(s)
azurerm_portal_dashboard
Terraform Configuration Files
Debug Output/Panic Output
Expected Behaviour
I expected that I could export a portal dashboard as json, and then load it as a string with the azurerm_portal_dashboard resource.
(PS: i also think it's a bit silly that I have to extract the properties block)
Actual Behaviour
The azurerm_portal_dashboard resource expects a map but gets an array.
This changed between the 2019 and 2020 api versions.
see: https://learn.microsoft.com/en-us/azure/templates/microsoft.portal/2020-09-01-preview/dashboards?pivots=deployment-language-bicep https://learn.microsoft.com/en-us/azure/templates/microsoft.portal/2019-01-01-preview/dashboards?pivots=deployment-language-bicep
Steps to Reproduce
Important Factoids
No response
References
example of how the json used to look: https://github.com/hashicorp/terraform-provider-azurerm/issues/9104