Skip to content

4665: Setup for Log v2 config #2298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 53 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
53 commits
Select commit Hold shift + click to select a range
816d7d8
4565: Updating test
github-actions[bot] Aug 4, 2025
6051a67
4565: clean up
github-actions[bot] Aug 7, 2025
a2e403d
4565: stack id is set at the provider level
github-actions[bot] Aug 7, 2025
121d516
4565: updating docs
github-actions[bot] Aug 7, 2025
78ab438
4565: updating naming
github-actions[bot] Aug 7, 2025
b0f7b8c
4565: updating docs
github-actions[bot] Aug 7, 2025
91b3607
4565: updating docs
github-actions[bot] Aug 7, 2025
c7e30c2
4565: updating docs
github-actions[bot] Aug 8, 2025
8756ee8
4565: updating docs
github-actions[bot] Aug 8, 2025
88e46af
4565: updating docs
github-actions[bot] Aug 8, 2025
421cf60
4565: adding retry
github-actions[bot] Aug 11, 2025
3bc8ab1
4565: fixing retry
github-actions[bot] Aug 11, 2025
42565d4
4565: adding test for retry
github-actions[bot] Aug 11, 2025
5223691
4565: adding test for retry
github-actions[bot] Aug 11, 2025
be8c321
4565: adding test for retry
github-actions[bot] Aug 11, 2025
8e0e757
4648: Setup of TF for Threshold & Custom Models
github-actions[bot] Aug 11, 2025
0c22e71
4648: fixing test
github-actions[bot] Aug 11, 2025
183101a
4648: fixing test
github-actions[bot] Aug 11, 2025
172d9ed
4648: fixing test
github-actions[bot] Aug 11, 2025
1d5339f
4648: fmt
github-actions[bot] Aug 11, 2025
b41d311
4648: fmt
github-actions[bot] Aug 11, 2025
ee7f70e
4648: fmt
github-actions[bot] Aug 11, 2025
6a116f3
4648: clean up
github-actions[bot] Aug 11, 2025
569e8fd
4648: Setup of TF for Threshold & Custom Models
github-actions[bot] Aug 11, 2025
8e51e10
4648: fixing test
github-actions[bot] Aug 11, 2025
a4bde4a
4648: fixing test
github-actions[bot] Aug 11, 2025
0e776bd
4648: fixing test
github-actions[bot] Aug 11, 2025
59dbf52
4648: fmt
github-actions[bot] Aug 11, 2025
39e46c4
4648: fmt
github-actions[bot] Aug 11, 2025
1657b0a
4648: fmt
github-actions[bot] Aug 11, 2025
31d26ac
4648: clean up
github-actions[bot] Aug 11, 2025
f700087
4565: adding a common file to be DRY and updating retry logic
github-actions[bot] Aug 11, 2025
ac46a34
4565: adding a common file to be DRY and updating retry logic
github-actions[bot] Aug 11, 2025
e709264
4565: fixing test and fixing return value
github-actions[bot] Aug 11, 2025
a1b1fa8
4565: better retry
github-actions[bot] Aug 11, 2025
0d39ed9
4565: better retry
github-actions[bot] Aug 11, 2025
b29c39f
4565: fixing flaky test
github-actions[bot] Aug 11, 2025
b796d1d
4565: fixing flaky test
github-actions[bot] Aug 11, 2025
39b4f51
4648: removing slo code
github-actions[bot] Aug 12, 2025
560a957
4648: cleanup
github-actions[bot] Aug 12, 2025
574763d
4648: cleanup
github-actions[bot] Aug 12, 2025
a12ba51
Revert "4648: cleanup"
github-actions[bot] Aug 12, 2025
77337e7
Revert "4648: cleanup"
github-actions[bot] Aug 12, 2025
0a265ca
Revert "4648: removing slo code"
github-actions[bot] Aug 12, 2025
2546612
4565: Updating test
github-actions[bot] Aug 4, 2025
93e9d67
4565: updating docs
github-actions[bot] Aug 7, 2025
585a0bd
4565: updating docs
github-actions[bot] Aug 8, 2025
e467ae1
4665: Setup for Log v2 config
github-actions[bot] Aug 11, 2025
064dafc
4648: fixing test
github-actions[bot] Aug 12, 2025
6f2486c
4648: better stress test
github-actions[bot] Aug 12, 2025
be7f152
4648: fixing test
github-actions[bot] Aug 13, 2025
9b5923e
4648: fixing test and adding jitter
github-actions[bot] Aug 13, 2025
34c831f
Merge branch '4648' into 4665
github-actions[bot] Aug 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/acc-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,8 @@ jobs:
timeout_minutes: 30
max_attempts: 3 # Try 3 times to make sure we don't report failures on flaky tests
command: make testacc-cloud-instance
env:
TF_ACC_ASSERTS: true

local:
strategy:
Expand Down
46 changes: 46 additions & 0 deletions docs/resources/asserts_custom_model_rules.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "grafana_asserts_custom_model_rules Resource - terraform-provider-grafana"
subcategory: "Asserts"
description: |-
Manages Asserts Custom Model Rules through the Grafana API.
---

# grafana_asserts_custom_model_rules (Resource)

Manages Asserts Custom Model Rules through the Grafana API.

## Example Usage

```terraform
resource "grafana_asserts_custom_model_rules" "test" {
name = "test-anything"
rules = <<-EOT
entities:
- type: Whatever
name: Nothing
definedBy:
- query: "up{job=\\"nothing\\"}"
EOT
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `name` (String) The name of the custom model rules.
- `rules` (String) The rules of the custom model rules, in YAML format.

### Read-Only

- `id` (String) The ID of this resource.

## Import

Import is supported using the following syntax:

```shell
terraform import grafana_asserts_custom_model_rules.name "{{ name }}"
```
53 changes: 53 additions & 0 deletions docs/resources/asserts_log_drilldown_config.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "grafana_asserts_log_drilldown_config Resource - terraform-provider-grafana"
subcategory: "Asserts"
description: |-
Manages Asserts Log Drilldown Environment Configuration through the Grafana API.
---

# grafana_asserts_log_drilldown_config (Resource)

Manages Asserts Log Drilldown Environment Configuration through the Grafana API.

## Example Usage

```terraform
resource "grafana_asserts_log_drilldown_config" "example" {
name = "default"
config = <<-EOT
# Example log drilldown configuration
# Structure depends on API schema; this is illustrative
providers:
- name: "loki"
url: "https://logs.example.com"
default: true
mappings:
- name: "kubernetes"
matchers:
- label: "job"
value: "kubelet"
query: "{job=\"kubelet\", namespace=\"default\"} |= \"error\""
EOT
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `config` (String) The environment configuration (EnvironmentDto), in YAML format.
- `name` (String) The environment name for the log drilldown configuration.

### Read-Only

- `id` (String) The ID of this resource.

## Import

Import is supported using the following syntax:

```shell
terraform import grafana_asserts_log_drilldown_config.name "{{ name }}"
```
24 changes: 12 additions & 12 deletions docs/resources/asserts_notification_alerts_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ resource "grafana_asserts_notification_alerts_config" "prometheus_remote_storage
name = "PrometheusRemoteStorageFailures"

match_labels = {
alertname = "PrometheusRemoteStorageFailures"
alertgroup = "prometheus.alerts"
asserts_env = "prod"
alertname = "PrometheusRemoteStorageFailures"
alertgroup = "prometheus.alerts"
asserts_env = "prod"
}

silenced = true
Expand All @@ -31,10 +31,10 @@ resource "grafana_asserts_notification_alerts_config" "error_buildup_notify" {
name = "ErrorBuildupNotify"

match_labels = {
alertname = "ErrorBuildup"
job = "acai"
asserts_request_type = "inbound"
asserts_request_context = "/auth"
alertname = "ErrorBuildup"
job = "acai"
asserts_request_type = "inbound"
asserts_request_context = "/auth"
}

silenced = false
Expand All @@ -45,9 +45,9 @@ resource "grafana_asserts_notification_alerts_config" "payment_test_alert" {
name = "PaymentTestAlert"

match_labels = {
alertname = "PaymentTestAlert"
additional_labels = "asserts_severity=~\"critical\""
alertgroup = "alex-k8s-integration-test.alerts"
alertname = "PaymentTestAlert"
additional_labels = "asserts_severity=~\"critical\""
alertgroup = "alex-k8s-integration-test.alerts"
}

alert_labels = {
Expand Down Expand Up @@ -76,8 +76,8 @@ resource "grafana_asserts_notification_alerts_config" "cpu_throttling_sustained"
name = "CPUThrottlingSustained"

match_labels = {
alertname = "CPUThrottlingSustained"
additional_labels = "asserts_severity=~\"warning\""
alertname = "CPUThrottlingSustained"
additional_labels = "asserts_severity=~\"warning\""
}

silenced = true
Expand Down
2 changes: 1 addition & 1 deletion docs/resources/asserts_suppressed_assertions_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ resource "grafana_asserts_suppressed_assertions_config" "test_environment_suppre
name = "TestEnvironmentSuppression"

match_labels = {
alertgroup = "test.alerts"
alertgroup = "test.alerts"
environment = "test"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import grafana_asserts_custom_model_rules.name "{{ name }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
resource "grafana_asserts_custom_model_rules" "test" {
name = "test-anything"
rules = <<-EOT
entities:
- type: Whatever
name: Nothing
definedBy:
- query: "up{job=\\"nothing\\"}"
EOT
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
terraform import grafana_asserts_log_drilldown_config.name "{{ name }}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
resource "grafana_asserts_log_drilldown_config" "example" {
name = "default"
config = <<-EOT
# Example log drilldown configuration
# Structure depends on API schema; this is illustrative
providers:
- name: "loki"
url: "https://logs.example.com"
default: true
mappings:
- name: "kubernetes"
matchers:
- label: "job"
value: "kubelet"
query: "{job=\"kubelet\", namespace=\"default\"} |= \"error\""
EOT
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ resource "grafana_asserts_notification_alerts_config" "prometheus_remote_storage
name = "PrometheusRemoteStorageFailures"

match_labels = {
alertname = "PrometheusRemoteStorageFailures"
alertgroup = "prometheus.alerts"
asserts_env = "prod"
alertname = "PrometheusRemoteStorageFailures"
alertgroup = "prometheus.alerts"
asserts_env = "prod"
}

silenced = true
Expand All @@ -16,10 +16,10 @@ resource "grafana_asserts_notification_alerts_config" "error_buildup_notify" {
name = "ErrorBuildupNotify"

match_labels = {
alertname = "ErrorBuildup"
job = "acai"
asserts_request_type = "inbound"
asserts_request_context = "/auth"
alertname = "ErrorBuildup"
job = "acai"
asserts_request_type = "inbound"
asserts_request_context = "/auth"
}

silenced = false
Expand All @@ -30,9 +30,9 @@ resource "grafana_asserts_notification_alerts_config" "payment_test_alert" {
name = "PaymentTestAlert"

match_labels = {
alertname = "PaymentTestAlert"
additional_labels = "asserts_severity=~\"critical\""
alertgroup = "alex-k8s-integration-test.alerts"
alertname = "PaymentTestAlert"
additional_labels = "asserts_severity=~\"critical\""
alertgroup = "alex-k8s-integration-test.alerts"
}

alert_labels = {
Expand Down Expand Up @@ -61,8 +61,8 @@ resource "grafana_asserts_notification_alerts_config" "cpu_throttling_sustained"
name = "CPUThrottlingSustained"

match_labels = {
alertname = "CPUThrottlingSustained"
additional_labels = "asserts_severity=~\"warning\""
alertname = "CPUThrottlingSustained"
additional_labels = "asserts_severity=~\"warning\""
}

silenced = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ resource "grafana_asserts_suppressed_assertions_config" "test_environment_suppre
name = "TestEnvironmentSuppression"

match_labels = {
alertgroup = "test.alerts"
alertgroup = "test.alerts"
environment = "test"
}
}
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ require (
k8s.io/client-go v0.32.3
)

require github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20250805165836-14e16b51b910
require github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20250811221725-7aa50fc5d960

require (
cuelang.org/go v0.11.1 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,10 @@ github.com/grafana/grafana-app-sdk/logging v0.35.1 h1:taVpl+RoixTYl0JBJGhH+fPVmw
github.com/grafana/grafana-app-sdk/logging v0.35.1/go.mod h1:Y/bvbDhBiV/tkIle9RW49pgfSPIPSON8Q4qjx3pyqDk=
github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20250805165836-14e16b51b910 h1:2OfDIhMtXWWVQcDp9cq/VMSBOJJfDek9450rcsV+qLg=
github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20250805165836-14e16b51b910/go.mod h1:EL/5hluCvj6EDjkUfoClLKSKDoCoDowZUety28jhxQI=
github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20250811125322-247815da58ca h1:GVzyCTi3rqvjK42b++lFjabG2zsrLvyAbbR43dWP6s0=
github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20250811125322-247815da58ca/go.mod h1:EL/5hluCvj6EDjkUfoClLKSKDoCoDowZUety28jhxQI=
github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20250811221725-7aa50fc5d960 h1:KZ1Hp0Crqja1D8iX3IekIH+z57ThRvOaMqi+kVhsM0g=
github.com/grafana/grafana-asserts-public-clients/go/gcom v0.0.0-20250811221725-7aa50fc5d960/go.mod h1:EL/5hluCvj6EDjkUfoClLKSKDoCoDowZUety28jhxQI=
github.com/grafana/grafana-com-public-clients/go/gcom v0.0.0-20250526074454-7ec66e02e4bb h1:rmYEnCXHNQbRsuzc5jCX5qkBqFF37c5RCHlyqAAPJZo=
github.com/grafana/grafana-com-public-clients/go/gcom v0.0.0-20250526074454-7ec66e02e4bb/go.mod h1:sYWkB3NhyirQJfy3wtNQ29UYjoHbRlJlYhqN1jNsC5g=
github.com/grafana/grafana-openapi-client-go v0.0.0-20250617151817-c0f8cbb88d5c h1:jox7J0BnJmcZJp8lp631u4gjDEoIfpi6O3yrpiXNTtg=
Expand Down
25 changes: 19 additions & 6 deletions internal/resources/asserts/catalog-resource.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: resource-grafana_asserts_notification_alerts_config
title: grafana_asserts_notification_alerts_config (resource)
name: resource-grafana_asserts_alert_config
title: grafana_asserts_alert_config (resource)
description: |
resource `grafana_asserts_notification_alerts_config` in Grafana Labs' Terraform Provider
resource `grafana_asserts_alert_config` in Grafana Labs' Terraform Provider
spec:
subcomponentOf: component:default/terraform-provider-grafana
type: terraform-resource
Expand All @@ -15,10 +15,23 @@ spec:
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: resource-grafana_asserts_suppressed_assertions_config
title: grafana_asserts_suppressed_assertions_config (resource)
name: resource-grafana_asserts_disabled_alert_config
title: grafana_asserts_disabled_alert_config (resource)
description: |
resource `grafana_asserts_suppressed_assertions_config` in Grafana Labs' Terraform Provider
resource `grafana_asserts_disabled_alert_config` in Grafana Labs' Terraform Provider
spec:
subcomponentOf: component:default/terraform-provider-grafana
type: terraform-resource
owner: group:default/asserts
lifecycle: production
---
apiVersion: backstage.io/v1alpha1
kind: Component
metadata:
name: resource-grafana_asserts_log_drilldown_config
title: grafana_asserts_log_drilldown_config (resource)
description: |
resource `grafana_asserts_log_drilldown_config` in Grafana Labs' Terraform Provider
spec:
subcomponentOf: component:default/terraform-provider-grafana
type: terraform-resource
Expand Down
Loading
Loading