Skip to content

Commit

Permalink
grafana_synthetic_monitoring_probe: Add disable_browser_checks (#…
Browse files Browse the repository at this point in the history
…1980)

Allows configs to specify browser check support for probes.
  • Loading branch information
The-9880 authored Jan 9, 2025
1 parent 84124a6 commit 02d0994
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/data-sources/synthetic_monitoring_probe.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ data "grafana_synthetic_monitoring_probe" "atlanta" {

### Read-Only

- `disable_browser_checks` (Boolean) Disables browser checks for this probe.
- `disable_scripted_checks` (Boolean) Disables scripted checks for this probe.
- `id` (String) The ID of the probe.
- `labels` (Map of String) Custom labels to be included with collected metrics and logs.
Expand Down
1 change: 1 addition & 0 deletions docs/resources/synthetic_monitoring_probe.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ resource "grafana_synthetic_monitoring_probe" "main" {

### Optional

- `disable_browser_checks` (Boolean) Disables browser checks for this probe. Defaults to `false`.
- `disable_scripted_checks` (Boolean) Disables scripted checks for this probe. Defaults to `false`.
- `labels` (Map of String) Custom labels to be included with collected metrics and logs.
- `public` (Boolean) Public probes are run by Grafana Labs and can be used by all users. Only Grafana Labs managed public probes will be set to `true`. Defaults to `false`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ resource "grafana_synthetic_monitoring_probe" "main" {
type = "volcano"
}
disable_scripted_checks = true
disable_browser_checks = true
}
9 changes: 9 additions & 0 deletions internal/resources/syntheticmonitoring/resource_probe.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,12 @@ Grafana Synthetic Monitoring Agent.
Optional: true,
Default: false,
},
"disable_browser_checks": {
Description: "Disables browser checks for this probe.",
Type: schema.TypeBool,
Optional: true,
Default: false,
},
},
}

Expand Down Expand Up @@ -184,8 +190,10 @@ func resourceProbeRead(ctx context.Context, d *schema.ResourceData, c *smapi.Cli

if prb.Capabilities != nil {
d.Set("disable_scripted_checks", prb.Capabilities.DisableScriptedChecks)
d.Set("disable_browser_checks", prb.Capabilities.DisableBrowserChecks)
} else {
d.Set("disable_scripted_checks", false)
d.Set("disable_browser_checks", false)
}

return nil
Expand Down Expand Up @@ -254,6 +262,7 @@ func makeProbe(d *schema.ResourceData) *sm.Probe {
Public: d.Get("public").(bool),
Capabilities: &sm.Probe_Capabilities{
DisableScriptedChecks: d.Get("disable_scripted_checks").(bool),
DisableBrowserChecks: d.Get("disable_browser_checks").(bool),
},
}
}
Expand Down
2 changes: 2 additions & 0 deletions internal/resources/syntheticmonitoring/resource_probe_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ func TestAccResourceProbe(t *testing.T) {
resource.TestCheckResourceAttr("grafana_synthetic_monitoring_probe.main", "public", "false"),
resource.TestCheckResourceAttr("grafana_synthetic_monitoring_probe.main", "labels.type", "mountain"),
resource.TestCheckResourceAttr("grafana_synthetic_monitoring_probe.main", "disable_scripted_checks", "false"),
resource.TestCheckResourceAttr("grafana_synthetic_monitoring_probe.main", "disable_browser_checks", "false"),
testutils.CheckLister("grafana_synthetic_monitoring_probe.main"),
),
},
Expand All @@ -53,6 +54,7 @@ func TestAccResourceProbe(t *testing.T) {
resource.TestCheckResourceAttr("grafana_synthetic_monitoring_probe.main", "public", "false"),
resource.TestCheckResourceAttr("grafana_synthetic_monitoring_probe.main", "labels.type", "volcano"),
resource.TestCheckResourceAttr("grafana_synthetic_monitoring_probe.main", "disable_scripted_checks", "true"),
resource.TestCheckResourceAttr("grafana_synthetic_monitoring_probe.main", "disable_browser_checks", "true"),
),
},
},
Expand Down

0 comments on commit 02d0994

Please sign in to comment.