Skip to content

fix(grafana): name grafana_slo's required destination_datasource in the pattern (#165) - #200

Merged
radra23 merged 1 commit into
mainfrom
fix/grafana-slo-destination
Oct 3, 2026
Merged

radra23 merged 1 commit into
mainfrom
fix/grafana-slo-destination

Conversation

@radra23

@radra23 radra23 commented Oct 3, 2026

Copy link
Copy Markdown
Owner

Summary

The Grafana guidance never named grafana_slo's required destination_datasource block, so whether a generated module passed terraform validate depended on the model going beyond its instructions. Closes #165.

What changed

  • terraform-patterns: new "SLO resource" pattern with the three required blocks (query, objectives, at least one destination_datasource), the shared prometheus_datasource_uid variable, and the real error text
  • terraform-gen: names the blocks in its Grafana instructions
  • tests/hooks/grafana-slo-pattern.test.sh derives the block names from the validated golden and asserts the skill's SLO pattern contains each. Bumps to 0.8.19

Test plan

  • All hook, snapshot, drift and e2e unit tests pass locally; claude plugin validate . --strict passes

  • Teeth: 6 of the 7 grafana-slo-pattern checks fail against the previous text

  • The golden snapshot already carries destination_datasource and is terraform validated in CI; terraform is not installed where this was written, so I did not run validate myself, and the missing-block error text is taken from the issue's reproduction

  • Self-hosted Grafana (no grafana_slo) is out of scope; that is [coverage] grafana backend assumes Grafana Cloud; no self-hosted Grafana mode (grafana_slo is emitted unconditionally) #167

  • Vendor, SDK and semantic-convention facts were verified against the source, not recalled — linked where it isn't obvious.

  • Nothing hardcoded that has a single source of truth (SEMCONV_VERSION, backends.txt, hooks/otel-paths.sh).

…he pattern (#165)

grafana/grafana requires at least one destination_datasource block on grafana_slo; without it
terraform validate fails with "Insufficient destination_datasource blocks". The golden snapshot
has always carried it, so CI's validate was green, but neither terraform-patterns nor
terraform-gen mentioned it, so whether a generated module validated depended on the model going
beyond its instructions (the reporter saw it add the block in one run and omit it in another).

- terraform-patterns: a "SLO resource" pattern with the three required blocks (query,
  objectives, at least one destination_datasource) and the shared prometheus_datasource_uid
  variable the dashboard and alert rules already use, plus the real error text.
- terraform-gen: names the blocks in its Grafana instructions.
- tests/hooks/grafana-slo-pattern.test.sh derives the block names from the validated golden
  and asserts the skill's SLO pattern contains each, so the guidance cannot fall behind the
  snapshot again. Wired into lint-hooks; 6 of its 7 checks fail against the previous text.

Bumps to 0.8.19. Not changed: self-hosted Grafana, where grafana_slo is not available, is #167.
@radra23
radra23 merged commit 196dab5 into main Oct 3, 2026
11 checks passed
@radra23
radra23 deleted the fix/grafana-slo-destination branch October 3, 2026 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[output] grafana: terraform-patterns never mentions grafana_slo's required destination_datasource block, so a module that follows it fails validate

1 participant