Skip to content

Commit

Permalink
fix: recreate a monitor when a query is updated
Browse files Browse the repository at this point in the history
  • Loading branch information
tosuke committed May 15, 2024
1 parent 9b1b187 commit 77657c5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions mackerel/resource_mackerel_monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ func resourceMackerelMonitor() *schema.Resource {
"query": {
Type: schema.TypeString,
Required: true,
ForceNew: true,
},
"legend": {
Type: schema.TypeString,
Expand Down
4 changes: 2 additions & 2 deletions mackerel/resource_mackerel_monitor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -514,7 +514,7 @@ func TestAccMackerelMonitor_Query(t *testing.T) {
resource.TestCheckResourceAttr(resourceName, "anomaly_detection.#", "0"),
resource.TestCheckResourceAttr(resourceName, "query.#", "1"),
resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr(resourceName, "query.0.query", "container.cpu.utilization{k8s.deployment.name=\"httpbin\"}"),
resource.TestCheckResourceAttr(resourceName, "query.0.query", "container.cpu.utilization{k8s.deployment.name=\"nginx\"}"),
resource.TestCheckResourceAttr(resourceName, "query.0.legend", "cpu.utilization {{k8s.node.name}}"),
resource.TestCheckResourceAttr(resourceName, "query.0.operator", ">"),
resource.TestCheckResourceAttr(resourceName, "query.0.warning", "70"),
Expand Down Expand Up @@ -860,7 +860,7 @@ resource "mackerel_monitor" "foo" {
is_mute = true
notification_interval = 30
query {
query = "container.cpu.utilization{k8s.deployment.name=\"httpbin\"}"
query = "container.cpu.utilization{k8s.deployment.name=\"nginx\"}"
legend = "cpu.utilization {{k8s.node.name}}"
operator = ">"
warning = "70"
Expand Down

0 comments on commit 77657c5

Please sign in to comment.