Skip to content

Conversation

pstibrany
Copy link
Contributor

Add Computed: true to uid field schema to allow it to be populated from API response when not provided by user. This enables the data source to be used in resource references that depend on the uid value.

Fixes #2313

Add Computed: true to uid field schema to allow it to be populated from API
response when not provided by user. This enables the data source to be
used in resource references that depend on the uid value.
@pstibrany pstibrany requested a review from a team as a code owner August 20, 2025 11:02
Copy link
Contributor

In order to lower resource usage and have a faster runtime, PRs will not run Cloud tests automatically.
To do so, a Grafana Labs employee must trigger the cloud acceptance tests workflow manually.

Copy link

@JohnnyQQQQ JohnnyQQQQ left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

// resource.TestCheckResourceAttr("grafana_folder.nested_folder", "parent_folder_uid", folder.UID)
//
// This works:
resource.TestCheckResourceAttrWith("grafana_folder.nested_folder", "parent_folder_uid", func(value string) error {
Copy link
Contributor

@mustafasencer mustafasencer Aug 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see data_source_folder_test.go:267: Step 1/1 error: Check failed: Check 3/3 error: grafana_folder.nested_folder: Attribute 'parent_folder_uid' expected to be set failure in one of the ci runs. Is it intermittent?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that parent_folder_uid is not retrieved correctly when running on 9.5.18. I see other test using nested folders to have >=10.3.0 condition. I will try to check whether this is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nested folders were feature-toggled in Grafana 10 and marked as GA in Grafana 11 (grafana/grafana#56880). I will add grafana version check to this test.

@pstibrany pstibrany enabled auto-merge (squash) August 20, 2025 13:21
@pstibrany pstibrany merged commit 2f0f121 into main Aug 20, 2025
31 checks passed
@pstibrany pstibrany deleted the fix-folder-datasource-uid-field branch August 20, 2025 13: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.

grafana_folder Data Source no longer returns UID for Folder with Title Lookup
3 participants