Problem:
If the terraform configuration does not contain panel_map attribute, then in TF's state file the value of panel_map is set to NULL ("panel_map": null,) and SigNoz TF Provider also returns NULL value, so it doesn't create any mismatch in the subsequent terraform plan command.
But if the terraform configuration does contain an empty value for panel_map attribute (panel_map = jsonencode({})), then in TF's state file the value of panel_map is set to empty JSON string ("panel_map": "{}",) and SigNoz TF Provider returns NULL value in the subsequent terraform plan command. This creates a mismatch in the value of panel_map present in TF state file and what Terraform SigNoz Provider returns.
We need to handle this edge case as a lot of templates have empty value set for panel_map.
How to reproduce:
- Create a Terraform configuration file for dashboards and keep an empty value for panel_map (
panel_map = jsonencode({})). Then run terraform plan & terraform apply to create the dashboard. Run terraform plan command again without making any change and you will see some update action being suggested to perform and the next terraform apply command fails with the following error:
signoz_dashboard.http_api: Modifying... [name=http_api]
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to signoz_dashboard.http_api, provider "provider[\"registry.terraform.io/signoz/signoz\"]" produced an unexpected new value: .panel_map: was cty.StringVal("{}"), but now null.
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
Issue is considered resolved when:
- Even if the
panel_map value is set empty in the Terraform configuration (panel_map = jsonencode({})), the subsequent terraform plan commands should not result in any update action. That is - the value of panel_map set in TF state file should match what is being returned by the TF provider.
Problem:
If the terraform configuration does not contain
panel_mapattribute, then in TF's state file the value of panel_map is set to NULL ("panel_map": null,) and SigNoz TF Provider also returns NULL value, so it doesn't create any mismatch in the subsequentterraform plancommand.But if the terraform configuration does contain an empty value for panel_map attribute (
panel_map = jsonencode({})), then in TF's state file the value ofpanel_mapis set to empty JSON string ("panel_map": "{}",) and SigNoz TF Provider returnsNULLvalue in the subsequentterraform plancommand. This creates a mismatch in the value ofpanel_mappresent in TF state file and what Terraform SigNoz Provider returns.We need to handle this edge case as a lot of templates have empty value set for panel_map.
How to reproduce:
panel_map = jsonencode({})). Then runterraform plan&terraform applyto create the dashboard. Runterraform plancommand again without making any change and you will see some update action being suggested to perform and the nextterraform applycommand fails with the following error:Issue is considered resolved when:
panel_mapvalue is set empty in the Terraform configuration (panel_map = jsonencode({})), the subsequentterraform plancommands should not result in any update action. That is - the value of panel_map set in TF state file should match what is being returned by the TF provider.