Skip to content

feat: Add folderUid support - #475

Merged
VikaCep merged 2 commits into
mainfrom
feat/add-folder-uid-to-checks
Jun 2, 2026
Merged

feat: Add folderUid support #475
VikaCep merged 2 commits into
mainfrom
feat/add-folder-uid-to-checks

Conversation

@VikaCep

@VikaCep VikaCep commented Apr 1, 2026

Copy link
Copy Markdown
Contributor

Add folderUid support to checks

Part of https://github.com/grafana/synthetic-monitoring/issues/589

Adds support for the folderUid field on checks, allowing checks to be associated with a specific Grafana folder.

Why

The SM API now returns and accepts a folderUid field on checks. This field is API-only, it is intentionally not part of the protobuf definition to avoid propagating it to probes.

What changed

  • model.Check — New wrapper type that embeds synthetic_monitoring.Check and adds FolderUid. This is the same pattern CheckWithAlerts already used for extending the proto type with API-only fields.
  • Tests — Updated check tests to verify folderUid round-trips correctly through add, get, update, list, list-with-alerts, and query.

Check client methods now use model.Check instead of synthetic_monitoring.Check.

@VikaCep VikaCep self-assigned this Apr 1, 2026
@cla-assistant

cla-assistant Bot commented Apr 1, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@VikaCep VikaCep changed the title feat: Add folderUid support to CLI and tests feat: Add folderUid support Apr 6, 2026
VikaCep added 2 commits April 16, 2026 15:04
Introduce model.Check, which embeds synthetic_monitoring.Check and adds a FolderUid field for the API-only folderUid property that is not part
of the protobuf definition. All check client methods now accept and
return model.Check so callers can read and set folderUid.
@VikaCep
VikaCep force-pushed the feat/add-folder-uid-to-checks branch from 90539d7 to 9bf12c7 Compare April 16, 2026 18:04
@VikaCep
VikaCep marked this pull request as ready for review April 16, 2026 18:07
@VikaCep
VikaCep requested a review from a team as a code owner April 16, 2026 18:07
@VikaCep
VikaCep requested review from The-9880, mem and vmgrlab April 16, 2026 18:07
@vmgrlab

vmgrlab commented May 4, 2026

Copy link
Copy Markdown

@VikaCep is this still relevant ?

This is a breaking change in public API, are we ok with that ? On example this method is used here https://github.com/grafana/terraform-provider-grafana/blob/85533e88d30360a0617d0a44dc165f36c0aff4fc/internal/resources/syntheticmonitoring/resource_check.go#L848

@mem

mem commented May 6, 2026

Copy link
Copy Markdown
Contributor

@VikaCep is this still relevant ?

This is a breaking change in public API, are we ok with that ? On example this method is used here grafana/terraform-provider-grafana@85533e8/internal/resources/syntheticmonitoring/resource_check.go#L848

There's no way around it. I think our best bet right now is to simply accept the breakage, but we need to do it once, we cannot do piecemeal updates and break this multiple times. My take is that we take the OpenAPI spec we generate in the API (which is public) and we generate the client from that.

@VikaCep
VikaCep requested a review from Pokom May 8, 2026 13:02
@VikaCep

VikaCep commented May 18, 2026

Copy link
Copy Markdown
Contributor Author

@mem @vmgrlab

Yes, this is still relevant. The API-side PR (grafana/synthetic-monitoring-api#2023) is already merged, so it accepts and returns folderUid today. The terraform provider PR (terraform-provider-grafana#2650) is ready and waiting on this.

I understand the concern about breaking the public API more than once. So what would you say is the preferred path forward?

  • Ship this first. Accept the one-time breakage to model.Check, ship folderUid support in the terraform provider soon, and track the OpenAPI client generation as a separate follow-up.
  • Do the full OpenAPI spec migration first. generate the client from the API's OpenAPI spec so we only break things once, but pause terraform folderUid support until that migration is complete.

I'm happy to go either way, but I don't have a good sense of how much time/effort the OpenAPI migration would take. Any thoughts on scope and timeline for that?

@vmgrlab

vmgrlab commented May 25, 2026

Copy link
Copy Markdown

I understand the concern about breaking the public API more than once. So what would you say is the preferred path forward?

  • Ship this first. Accept the one-time breakage to model.Check, ship folderUid support in the terraform provider soon, and track the OpenAPI client generation as a separate follow-up.
  • Do the full OpenAPI spec migration first. generate the client from the API's OpenAPI spec so we only break things once, but pause terraform folderUid support until that migration is complete.

I'm happy to go either way, but I don't have a good sense of how much time/effort the OpenAPI migration would take. Any thoughts on scope and timeline for that?

I think we can merge this and update deps this time. Additionally we can create an issue to migrate some existing code here to auto-generated from OpenAPI spec.

@VikaCep
VikaCep merged commit 2a6294c into main Jun 2, 2026
10 of 11 checks passed
@VikaCep
VikaCep deleted the feat/add-folder-uid-to-checks branch June 2, 2026 15:52
@sm-release-app sm-release-app Bot mentioned this pull request Jun 2, 2026
VikaCep added a commit to grafana/terraform-provider-grafana that referenced this pull request Jun 2, 2026
## SM Checks: Add `folder_uid` attribute

Adds a `folder_uid` attribute to the
`grafana_synthetic_monitoring_check` resource, allowing checks to be
associated with a specific Grafana folder.

Part of grafana/synthetic-monitoring#589

### What changed

- **Schema**: Added `folder_uid` as an optional string attribute on
`grafana_synthetic_monitoring_check`
- **CRUD**: `makeCheck` now returns `model.Check` (wrapping `sm.Check`
with the API-only `FolderUid` field). `folder_uid` is read from API
responses and included in create/update payloads.
- **Tests**: HTTP check acceptance test asserts `folder_uid` round-trips
correctly
- **Examples/Docs**: `http_complex.tf` and generated docs updated to
include the new attribute

### Blockers

This PR will not compile until the following upstream dependencies are
released and bumped in `go.mod`:

| Repo | PR | Status |
|------|----|--------|
| `synthetic-monitoring-api` | [#2023 — feat: Add folderUid to
checks](grafana/synthetic-monitoring-api#2023) |
Merged |
| `synthetic-monitoring-api-go-client` | [#475 — feat: Add folderUid
support](grafana/synthetic-monitoring-api-go-client#475)
| Merged |

Once the Go client is tagged, this PR needs:

1. `go get
github.com/grafana/synthetic-monitoring-api-go-client@<new-tag>`
2. `go mod tidy`
3. `make docs`

Note: no agent dep bump is needed — `folderUid` is an API-only field and
is not part of the protobuf definition.

### Test plan

- [x] Bump Go client dep once released
- [x] Verify `go build .` succeeds
- [x] Run `make docs` and verify no diff
- [x] Run HTTP check acceptance test: `TF_ACC=1
TF_ACC_CLOUD_INSTANCE=true go test
./internal/resources/syntheticmonitoring/... -run
TestAccResourceCheck_http -v -timeout 30m`
- [x] Verify import works (already covered by the ImportState test step)
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.

3 participants