When modifying the signoz_alert resource in Terraform, the state is not preserved. Any changes require deleting and re-creating the alert resource due to inconsistent provider behavior.
Steps to Reproduce
Create a signoz_alert resource using Terraform (see example main.tf below).
Apply the configuration to create the alert.
Modify any parameters in the signoz_alert resource.
Run terraform apply to apply the updated configuration.
Expected Behavior
Terraform should update the resource in place without requiring deletion and re-creation.
Actual Behavior
Terraform throws an error indicating an inconsistent result after applying changes to the signoz_alert resource. The condition field appears to be the root cause, as seen in the error output below.
Error Output
Plan: 0 to add, 1 to change, 0 to destroy.
Do you want to perform these actions?
Terraform will perform the actions described above.
Only 'yes' will be accepted to approve.
Enter a value: yes
signoz_alert.high_memory_usage: Modifying... [id=34]
╷
│ Error: Provider produced inconsistent result after apply
│
│ When applying changes to signoz_alert.high_memory_usage, provider "provider[\"registry.terraform.io/signoz/signoz\"]" produced an unexpected new value: .condition: was
│ cty.StringVal("{\"absentFor\":10,\"alertOnAbsent\":true,\"compositeQuery\":{\"builderQueries\":{\"A\":{\"aggregateAttribute\":{\"dataType\":\"float64\",\"isColumn\":true,\"isJSON\":false,\"key\":\"system_memory_usage\",\"type\":\"Gauge\"},\"aggregateOperator\":\"avg\",\"dataSource\":\"metrics\",\"disabled\":false,\"expression\":\"A\",\"filters\":{\"items\":[{\"key\":{\"dataType\":\"string\",\"isColumn\":false,\"isJSON\":false,\"key\":\"state\",\"type\":\"tag\"},\"op\":\"!=\",\"value\":\"free\"}],\"op\":\"AND\"},\"functions\":[],\"groupBy\":[{\"dataType\":\"string\",\"isColumn\":false,\"isJSON\":false,\"key\":\"host_name\",\"type\":\"tag\"}],\"having\":[],\"legend\":\"{{host_name}}\",\"limit\":null,\"orderBy\":[],\"queryName\":\"A\",\"reduceTo\":\"avg\",\"spaceAggregation\":\"sum\",\"stepInterval\":60,\"timeAggregation\":\"avg\"}},\"fillGaps\":false,\"panelType\":\"graph\",\"queryType\":\"builder\",\"unit\":\"bytes\"},\"matchType\":\"0\",\"op\":\"\\u003e\",\"selectedQueryName\":\"A\",\"target\":90,\"targetUnit\":\"gibibytes\"}"),
│ but now
│ cty.StringVal("{\"absentFor\":10,\"alertOnAbsent\":true,\"compositeQuery\":{\"builderQueries\":{\"A\":{\"IsAnomaly\":false,\"QueriesUsedInFormula\":null,\"ShiftBy\":0,\"aggregateAttribute\":{\"dataType\":\"float64\",\"isColumn\":true,\"isJSON\":false,\"key\":\"system_memory_usage\",\"type\":\"Gauge\"},\"aggregateOperator\":\"avg\",\"dataSource\":\"metrics\",\"disabled\":false,\"expression\":\"A\",\"filters\":{\"items\":[{\"key\":{\"dataType\":\"string\",\"isColumn\":false,\"isJSON\":false,\"key\":\"state\",\"type\":\"tag\"},\"op\":\"!=\",\"value\":\"free\"}],\"op\":\"AND\"},\"groupBy\":[{\"dataType\":\"string\",\"isColumn\":false,\"isJSON\":false,\"key\":\"host_name\",\"type\":\"tag\"}],\"legend\":\"{{host_name}}\",\"limit\":0,\"offset\":0,\"pageSize\":0,\"queryName\":\"A\",\"reduceTo\":\"avg\",\"spaceAggregation\":\"sum\",\"stepInterval\":60,\"timeAggregation\":\"avg\"}},\"panelType\":\"graph\",\"queryType\":\"builder\",\"unit\":\"bytes\"},\"matchType\":\"0\",\"op\":\"\\u003e\",\"selectedQueryName\":\"A\",\"target\":90,\"targetUnit\":\"gibibytes\"}").
│
│ This is a bug in the provider, which should be reported in the provider's own issue tracker.
╵
When modifying the
signoz_alert
resource in Terraform, the state is not preserved. Any changes require deleting and re-creating the alert resource due to inconsistent provider behavior.Steps to Reproduce
signoz_alert
resource using Terraform (see examplemain.tf
below).signoz_alert
resource.terraform apply
to apply the updated configuration.Expected Behavior
Terraform should update the resource in place without requiring deletion and re-creation.
Actual Behavior
Terraform throws an error indicating an inconsistent result after applying changes to the
signoz_alert
resource. The condition field appears to be the root cause, as seen in the error output below.Error Output
main.tf