Skip to content

feat: sync Add schemas, data quality checks, example usage - #102

Open
starburstdata-automation wants to merge 1 commit into
mainfrom
auto-sync-2026-07-30-83149f1
Open

feat: sync Add schemas, data quality checks, example usage#102
starburstdata-automation wants to merge 1 commit into
mainfrom
auto-sync-2026-07-30-83149f1

Conversation

@starburstdata-automation

Copy link
Copy Markdown
Collaborator

Automated sync from terraform-provider-galaxy-generation repository.

Source commit: 83149f196d38833d3b1a94303b74bec4e015cbe3

This PR contains the latest generated provider code from the generation repository.

@bradyburke
bradyburke enabled auto-merge July 30, 2026 16:19
@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This change adds multiple Terraform data sources and resources for catalog metadata, schemas, tables, columns, role grants, usage examples, evaluations, and data quality schedules. It adds generated schemas and documentation, provider registrations, API client operations, Terraform examples, and acceptance tests. Existing resources now expose and populate computed Terraform import identifiers through their id fields.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: a sync of generated schemas, data quality checks, and usage example code/docs.
Description check ✅ Passed The description is directly related, stating this is an automated sync of the latest generated provider code.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 17

🧹 Nitpick comments (5)
internal/provider/catalog_metadatas_data_source.go (1)

133-183: 🩺 Stability & Availability | 🔵 Trivial | ⚡ Quick win

Discarded types.ListValue diagnostics leave Contacts/Tags as zero-value (null) lists on error.

model.Contacts, _ = ... swallows element-type mismatches; the model field then stays unset and state writes either drop data or fail later with an opaque error. Propagate diags out of updateModelFromResponse (return diag.Diagnostics and append in Read).

internal/provider/data_quality_schedule_resource.go (1)

46-71: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Silent no-op if the generated attribute isn't a schema.StringAttribute.

If the generator ever emits a different attribute type (or a pointer), these overrides are skipped without any signal and catalog_id/schema_id/table_id quietly stay optional/computed. Consider panicking or emitting an error diagnostic in the else branch so a generator drift fails loudly.

internal/provider/data_quality_schedule_resource_test.go (1)

59-261: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

~100 duplicated HCL lines between the two config helpers; only cron_expression differs.

Parameterize the cron expression in a single helper.

♻️ Single parameterized helper
-func testAccDataQualityScheduleResourceConfig(suffix string) string {
-	return fmt.Sprintf(`
+func testAccDataQualityScheduleResourceConfig(suffix string) string {
+	return testAccDataQualityScheduleResourceConfigWithCron(suffix, "0 0 * * *")
+}
+
+func testAccDataQualityScheduleResourceConfigUpdate(suffix string) string {
+	return testAccDataQualityScheduleResourceConfigWithCron(suffix, "0 6 * * *")
+}
+
+func testAccDataQualityScheduleResourceConfigWithCron(suffix, cron string) string {
+	return fmt.Sprintf(`
 ...
-  cron_expression = "0 0 * * *"
+  cron_expression = %[2]q
 ...
-`, suffix)
+`, suffix, cron)
 }
internal/provider/evaluation_resource.go (1)

120-154: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Update re-reads with GetEvaluation but never re-triggers the evaluation.

If any configurable attribute changes, the resource reports success while nothing changed server-side. If data_quality_check_id is the only configurable field, add RequiresReplace to it and make Update unreachable rather than a silent no-op.

internal/provider/resource_row_filter/row_filter_resource_gen.go (1)

30-34: 🎯 Functional Correctness | 🔵 Trivial

New generated id attributes lack UseStateForUnknown, causing needless plan diffs. All five newly-generated id (Terraform import identifier) attributes are Computed: true with no PlanModifiers. Per HashiCorp guidance, computed identifiers that don't change after creation should use stringplanmodifier.UseStateForUnknown(); without it, every update to any other attribute on these resources will show id = ... -> (known after apply) even though the id never actually changes.

  • internal/provider/resource_row_filter/row_filter_resource_gen.go#L30-L34: add PlanModifiers: []planmodifier.String{stringplanmodifier.UseStateForUnknown()} to the id attribute.
  • internal/provider/resource_mysql_catalog/mysql_catalog_resource_gen.go#L50-L54: same fix for id.
  • internal/provider/resource_service_account/service_account_resource_gen.go#L27-L31: same fix for id.
  • internal/provider/resource_snowflake_catalog/snowflake_catalog_resource_gen.go#L57-L61: same fix for id.
  • internal/provider/resource_role_privilege_grant/role_privilege_grant_resource_gen.go#L66-L70: same fix for id.

Since these are _gen.go files, the fix should be applied to the terraform-provider-galaxy-generation template/spec rather than hand-edited here.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 7df5ffef-bcd6-4b56-b4e3-9565fb0aae7f

📥 Commits

Reviewing files that changed from the base of the PR and between 5c0a072 and 072ab6f.

📒 Files selected for processing (125)
  • docs/data-sources/catalog_metadatas.md
  • docs/data-sources/columns.md
  • docs/data-sources/data_quality_schedules.md
  • docs/data-sources/evaluations.md
  • docs/data-sources/rolegrants.md
  • docs/data-sources/schema.md
  • docs/data-sources/schemas.md
  • docs/data-sources/table.md
  • docs/data-sources/tables.md
  • docs/data-sources/usage_examples.md
  • docs/resources/bigquery_catalog.md
  • docs/resources/cassandra_catalog.md
  • docs/resources/cluster.md
  • docs/resources/column_mask.md
  • docs/resources/cross_account_iam_role.md
  • docs/resources/data_product.md
  • docs/resources/data_quality_check.md
  • docs/resources/data_quality_schedule.md
  • docs/resources/evaluation.md
  • docs/resources/gcs_catalog.md
  • docs/resources/mongodb_catalog.md
  • docs/resources/mysql_catalog.md
  • docs/resources/opensearch_catalog.md
  • docs/resources/policy.md
  • docs/resources/postgresql_catalog.md
  • docs/resources/redshift_catalog.md
  • docs/resources/role.md
  • docs/resources/role_privilege_grant.md
  • docs/resources/row_filter.md
  • docs/resources/s3_catalog.md
  • docs/resources/service_account.md
  • docs/resources/snowflake_catalog.md
  • docs/resources/sqlserver_catalog.md
  • docs/resources/tag.md
  • docs/resources/usage_example.md
  • examples/catalog_metadatas/main.tf
  • examples/columns/main.tf
  • examples/data_quality_schedules/main.tf
  • examples/evaluations/main.tf
  • examples/rolegrants/main.tf
  • examples/schemas/main.tf
  • examples/tables/main.tf
  • examples/usage_examples/main.tf
  • internal/client/client.go
  • internal/provider/bigquery_catalog_resource.go
  • internal/provider/cassandra_catalog_resource.go
  • internal/provider/catalog_metadatas_data_source.go
  • internal/provider/catalog_metadatas_data_source_test.go
  • internal/provider/cluster_resource.go
  • internal/provider/column_mask_resource.go
  • internal/provider/columns_data_source.go
  • internal/provider/columns_data_source_test.go
  • internal/provider/cross_account_iam_role_resource.go
  • internal/provider/data_product_resource.go
  • internal/provider/data_quality_check_resource.go
  • internal/provider/data_quality_schedule_resource.go
  • internal/provider/data_quality_schedule_resource_test.go
  • internal/provider/data_quality_schedules_data_source.go
  • internal/provider/data_quality_schedules_data_source_test.go
  • internal/provider/datasource_catalog_metadatas/catalog_metadatas_data_source_gen.go
  • internal/provider/datasource_columns/columns_data_source_gen.go
  • internal/provider/datasource_data_quality_schedules/data_quality_schedules_data_source_gen.go
  • internal/provider/datasource_evaluations/evaluations_data_source_gen.go
  • internal/provider/datasource_role_privilege_grants/role_privilege_grants_data_source_gen.go
  • internal/provider/datasource_rolegrants/rolegrants_data_source_gen.go
  • internal/provider/datasource_schema/schema_data_source_gen.go
  • internal/provider/datasource_schemas/schemas_data_source_gen.go
  • internal/provider/datasource_table/table_data_source_gen.go
  • internal/provider/datasource_tables/tables_data_source_gen.go
  • internal/provider/datasource_usage_examples/usage_examples_data_source_gen.go
  • internal/provider/evaluation_resource.go
  • internal/provider/evaluation_resource_test.go
  • internal/provider/evaluations_data_source.go
  • internal/provider/evaluations_data_source_test.go
  • internal/provider/gcs_catalog_resource.go
  • internal/provider/mongodb_catalog_resource.go
  • internal/provider/mysql_catalog_resource.go
  • internal/provider/opensearch_catalog_resource.go
  • internal/provider/policy_resource.go
  • internal/provider/postgresql_catalog_resource.go
  • internal/provider/provider.go
  • internal/provider/redshift_catalog_resource.go
  • internal/provider/resource_bigquery_catalog/bigquery_catalog_resource_gen.go
  • internal/provider/resource_cassandra_catalog/cassandra_catalog_resource_gen.go
  • internal/provider/resource_cluster/cluster_resource_gen.go
  • internal/provider/resource_column_mask/column_mask_resource_gen.go
  • internal/provider/resource_cross_account_iam_role/cross_account_iam_role_resource_gen.go
  • internal/provider/resource_data_product/data_product_resource_gen.go
  • internal/provider/resource_data_quality_check/data_quality_check_resource_gen.go
  • internal/provider/resource_data_quality_schedule/data_quality_schedule_resource_gen.go
  • internal/provider/resource_evaluation/evaluation_resource_gen.go
  • internal/provider/resource_gcs_catalog/gcs_catalog_resource_gen.go
  • internal/provider/resource_mongodb_catalog/mongodb_catalog_resource_gen.go
  • internal/provider/resource_mysql_catalog/mysql_catalog_resource_gen.go
  • internal/provider/resource_opensearch_catalog/opensearch_catalog_resource_gen.go
  • internal/provider/resource_policy/policy_resource_gen.go
  • internal/provider/resource_postgresql_catalog/postgresql_catalog_resource_gen.go
  • internal/provider/resource_redshift_catalog/redshift_catalog_resource_gen.go
  • internal/provider/resource_role/role_resource_gen.go
  • internal/provider/resource_role_privilege_grant/role_privilege_grant_resource_gen.go
  • internal/provider/resource_row_filter/row_filter_resource_gen.go
  • internal/provider/resource_s3_catalog/s3_catalog_resource_gen.go
  • internal/provider/resource_service_account/service_account_resource_gen.go
  • internal/provider/resource_snowflake_catalog/snowflake_catalog_resource_gen.go
  • internal/provider/resource_sqlserver_catalog/sqlserver_catalog_resource_gen.go
  • internal/provider/resource_tag/tag_resource_gen.go
  • internal/provider/resource_usage_example/usage_example_resource_gen.go
  • internal/provider/role_privilege_grant_resource.go
  • internal/provider/role_resource.go
  • internal/provider/rolegrants_data_source.go
  • internal/provider/rolegrants_data_source_test.go
  • internal/provider/row_filter_resource.go
  • internal/provider/s3_catalog_resource.go
  • internal/provider/schemas_data_source.go
  • internal/provider/schemas_data_source_test.go
  • internal/provider/service_account_resource.go
  • internal/provider/snowflake_catalog_resource.go
  • internal/provider/sqlserver_catalog_resource.go
  • internal/provider/tables_data_source.go
  • internal/provider/tables_data_source_test.go
  • internal/provider/tag_resource.go
  • internal/provider/usage_example_resource.go
  • internal/provider/usage_example_resource_test.go
  • internal/provider/usage_examples_data_source.go
  • internal/provider/usage_examples_data_source_test.go

### Read-Only

- `data_quality_check_id` (String) Data Quality check ID (read only)
- `id` (String) Terraform import identifier.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

id is documented as the import identifier, but this doc has no Import section.

Sibling resource docs (bigquery_catalog.md, cluster.md, data_product.md, etc.) all render an ## Import section after Read-Only. Here the file ends right after id, which suggests the import example template (examples/resources/galaxy_data_quality_check/import.sh) is missing upstream in the generation repo. Worth confirming whether import is actually supported for this resource.

#!/bin/bash
fd -H -t f . examples --exec echo {} | rg -n 'data_quality_check|import'
rg -n 'ImportState' internal/provider/data_quality_check_resource.go

Comment on lines +20 to +21
- `catalog_id` (String) - A catalog
- This parameter can be looked up using `name` instead of its Id. Use `name=value` instead of an Id to lookup/search using the `value`. `value` must be encoded ([see RFC](https://www.rfc-editor.org/rfc/rfc3986#section-2.2) including `=`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Lookup-capable ID descriptions start with a - bullet, producing phantom attribute bullets in generated docs. The shared root cause is the upstream description text for lookup-by-name parameters (- A catalog\n- This parameter can be looked up ...), which tfplugindocs renders as sibling list items alongside real attributes.

  • docs/resources/data_quality_schedule.md#L20-L21: regenerate after reshaping the catalog_id description so the continuation text is not a top-level bullet (plain lead-in sentence, or indented sub-bullet).
  • internal/provider/datasource_role_privilege_grants/role_privilege_grants_data_source_gen.go#L83-L84: apply the same description reshaping to role_id in the generation repo, since this generated string is what the docs render.
🧰 Tools
🪛 LanguageTool

[grammar] ~21-~21: Ensure spelling is correct
Context: ...d. Use name=value instead of an Id to lookup/search using the value. value must ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

📍 Affects 2 files
  • docs/resources/data_quality_schedule.md#L20-L21 (this comment)
  • internal/provider/datasource_role_privilege_grants/role_privilege_grants_data_source_gen.go#L83-L84

Comment thread examples/columns/main.tf
Comment on lines +53 to +58
# List columns for a specific table in the catalog
data "galaxy_columns" "example" {
catalog_id = galaxy_postgresql_catalog.example.catalog_id
schema_id = "anu_test"
table_id = "employees"
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Remove the undeclared anu_test.employees fixture dependency.

Both examples create a catalog but assume that a particular schema and table already exist in the connected external database. They fail for normal users unless that hidden fixture has been pre-created.

  • examples/columns/main.tf#L53-L58: replace the fixed schema/table values with documented required inputs for an existing table.
  • examples/data_quality_schedules/main.tf#L96-L125: use the same configurable existing-table inputs consistently in the check, schedule, list data source, and SQL query.
📍 Affects 2 files
  • examples/columns/main.tf#L53-L58 (this comment)
  • examples/data_quality_schedules/main.tf#L96-L125

Comment on lines +128 to +134
output "schedule_id" {
value = try(data.galaxy_data_quality_schedules.example.data_quality_schedule_id, "none")
}

output "schedule_enabled" {
value = try(data.galaxy_data_quality_schedules.example.enabled, false)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Read attributes from the multi-item result list.

galaxy_data_quality_schedules is registered as a multi-item data source, so these top-level attributes are not available. This example fails validation instead of reading the created schedule.

Proposed fix
 output "schedule_id" {
-  value = try(data.galaxy_data_quality_schedules.example.data_quality_schedule_id, "none")
+  value = try(data.galaxy_data_quality_schedules.example.result[0].data_quality_schedule_id, "none")
 }

 output "schedule_enabled" {
-  value = try(data.galaxy_data_quality_schedules.example.enabled, false)
+  value = try(data.galaxy_data_quality_schedules.example.result[0].enabled, false)
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
output "schedule_id" {
value = try(data.galaxy_data_quality_schedules.example.data_quality_schedule_id, "none")
}
output "schedule_enabled" {
value = try(data.galaxy_data_quality_schedules.example.enabled, false)
}
output "schedule_id" {
value = try(data.galaxy_data_quality_schedules.example.result[0].data_quality_schedule_id, "none")
}
output "schedule_enabled" {
value = try(data.galaxy_data_quality_schedules.example.result[0].enabled, false)
}

Comment on lines +13 to +15
locals {
test_suffix = var.test_suffix != "" ? var.test_suffix : substr(replace(uuid(), "[^0-9]", ""), 0, 6)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Map the Terraform file and inspect relevant lines
git ls-files examples/evaluations/main.tf
wc -l examples/evaluations/main.tf
cat -n examples/evaluations/main.tf | sed -n '1,220p'

# Find all references to test_suffix and uuid/replace in the repo
rg -n --hidden --glob '!**/.git/**' 'test_suffix|uuid\(|replace\(' .

Repository: starburstdata/terraform-provider-galaxy

Length of output: 1967


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== examples/evaluations/main.tf =="
cat -n examples/evaluations/main.tf | sed -n '1,220p'

echo
echo "== references to test_suffix/uuid/replace =="
rg -n --hidden --glob '!**/.git/**' 'test_suffix|uuid\(|replace\(' examples .

Repository: starburstdata/terraform-provider-galaxy

Length of output: 1967


🌐 Web query:

Terraform replace function regex slash-delimited uuid function non-deterministic random_id resource docs

💡 Result:

In Terraform, the replace function and random_id resource serve distinct purposes. The replace function performs string replacement using either literal strings or regular expressions [1][2]. To use a regular expression, you must wrap the substring argument in forward slashes (e.g., replace(string, "/pattern/", "replacement")) [1][3]. Terraform uses the same regular expression syntax as the regex function [3][4]. Because slash-delimited strings are interpreted as regex, you cannot use a literal slash sequence as a search pattern without it being evaluated as a regex pattern [5]. The random_id resource is used to generate random identifiers and is not strictly non-deterministic in its operation [6][7]. While it uses a cryptographic random number generator to create values, these values are managed by Terraform’s state [6][7]. Once generated, the random value is stored in the Terraform state and remains unchanged across subsequent plan and apply operations unless the resource inputs (such as the keepers map or byte_length) are modified [7]. When inputs change, the resource is recreated, and a new random value is generated [7]. It is frequently used for generating unique identifiers, such as 16-byte values that offer the same uniqueness profile as a type-4 UUID [6][8]. For projects specifically requiring UUID formats, the random provider also offers a dedicated random_uuid resource [9].

Citations:


Use a stable fallback suffix. uuid() changes on every run, so this fallback makes generated names unstable. replace(uuid(), "[^0-9]", "") also does not strip non-digits here because the pattern is treated as a literal string, not a regex. Use a stateful random_id value or require test_suffix instead.

Comment on lines +30 to +41
ConfigStateChecks: []statecheck.StateCheck{
statecheck.ExpectKnownValue(
"data.galaxy_data_quality_schedules.test",
tfjsonpath.New("catalog_id"),
knownvalue.NotNull(),
),
statecheck.ExpectKnownValue(
"data.galaxy_data_quality_schedules.test",
tfjsonpath.New("data_quality_checks"),
knownvalue.NotNull(),
),
},

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Assert returned collection contents, not merely non-null values.

knownvalue.NotNull() also passes for empty collections, so these acceptance tests can succeed while the data sources return no records.

  • internal/provider/data_quality_schedules_data_source_test.go#L30-L41: assert that data_quality_checks contains at least one returned item from the configured catalog/schema/table.
  • internal/provider/tables_data_source_test.go#L25-L31: assert that result contains at least one table from anu_test.
  • internal/provider/schemas_data_source_test.go#L25-L31: assert that result contains at least one schema.
📍 Affects 3 files
  • internal/provider/data_quality_schedules_data_source_test.go#L30-L41 (this comment)
  • internal/provider/tables_data_source_test.go#L25-L31
  • internal/provider/schemas_data_source_test.go#L25-L31

Comment on lines +23 to +24
Description: "- A catalog\n- This parameter can be looked up using `name` instead of its Id. Use `name=value` instead of an Id to lookup/search using the `value`. `value` must be encoded ([see RFC](https://www.rfc-editor.org/rfc/rfc3986#section-2.2) including `=`)\n",
MarkdownDescription: "- A catalog\n- This parameter can be looked up using `name` instead of its Id. Use `name=value` instead of an Id to lookup/search using the `value`. `value` must be encoded ([see RFC](https://www.rfc-editor.org/rfc/rfc3986#section-2.2) including `=`)\n",

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Lookup-parameter descriptions start with - , producing a detached bullet on every generated doc page. The shared root cause is the spec description text for the catalog_id/role_id lookup parameters, which begins with a Markdown list marker; tfplugindocs then emits the "This parameter can be looked up using name…" sentence as a separate top-level list item with no attribute association.

  • internal/provider/datasource_schemas/schemas_data_source_gen.go#L23-L24: fix the catalog_id Description/MarkdownDescription in the generator source spec (drop the leading - , or indent the second line as a continuation) and regenerate.
  • docs/data-sources/catalog_metadatas.md#L20-L21: regenerate after the spec fix so catalog_id renders as a single entry.
  • docs/data-sources/columns.md#L20-L21: regenerate after the spec fix.
  • docs/data-sources/data_quality_schedules.md#L20-L21: regenerate after the spec fix.
  • docs/data-sources/rolegrants.md#L20-L21: apply the same spec fix to the role_id description and regenerate.
  • docs/data-sources/schemas.md#L20-L21: regenerate after the spec fix.
  • docs/data-sources/tables.md#L20-L21: regenerate after the spec fix.
📍 Affects 7 files
  • internal/provider/datasource_schemas/schemas_data_source_gen.go#L23-L24 (this comment)
  • docs/data-sources/catalog_metadatas.md#L20-L21
  • docs/data-sources/columns.md#L20-L21
  • docs/data-sources/data_quality_schedules.md#L20-L21
  • docs/data-sources/rolegrants.md#L20-L21
  • docs/data-sources/schemas.md#L20-L21
  • docs/data-sources/tables.md#L20-L21

Source: Linters/SAST tools

Comment on lines +92 to +122
resource "galaxy_role" "dq_check_grant" {
role_name = "evrsrcgrant%[1]s"
role_description = "Role granting query access to the evaluation resource test catalog"
grant_to_creating_role = true
}

resource "galaxy_role_privilege_grant" "dq_check_grant" {
role_id = galaxy_role.dq_check_grant.role_id
entity_id = galaxy_postgresql_catalog.test.catalog_id
entity_kind = "Column"
privilege = "Select"
grant_kind = "Allow"
grant_option = false
schema_name = "*"
table_name = "*"
column_name = "*"
}

resource "galaxy_data_quality_check" "test" {
name = "evrcheck_%[1]s"
description = "Data quality check for evaluation resource test"
catalog_id = galaxy_postgresql_catalog.test.catalog_id
schema_id = "anu_test"
table_id = "employees"
severity = "Low"
category = "Completeness"
kind = "SqlQuery"
cluster_id = galaxy_cluster.test.cluster_id
query = "select exists(select * from ${galaxy_postgresql_catalog.test.name}.anu_test.employees)"
depends_on = [galaxy_role_privilege_grant.dq_check_grant]
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Missing UseCluster grant will likely make this config fail with 403 PERMISSION_DENIED.

The schedule test in this same PR documents that galaxy_data_quality_check validates USE_CLUSTER on cluster_id for role_id independently, and adds a dedicated galaxy_role_privilege_grant (entity_kind = "Cluster", privilege = "UseCluster"). This config omits it.

🛠️ Add the cluster grant
+resource "galaxy_role_privilege_grant" "dq_check_use_cluster" {
+  role_id      = galaxy_role.dq_check_grant.role_id
+  entity_id    = galaxy_cluster.test.cluster_id
+  entity_kind  = "Cluster"
+  privilege    = "UseCluster"
+  grant_kind   = "Allow"
+  grant_option = false
+}
+
 resource "galaxy_data_quality_check" "test" {
...
-  depends_on  = [galaxy_role_privilege_grant.dq_check_grant]
+  depends_on  = [galaxy_role_privilege_grant.dq_check_grant, galaxy_role_privilege_grant.dq_check_use_cluster]
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
resource "galaxy_role" "dq_check_grant" {
role_name = "evrsrcgrant%[1]s"
role_description = "Role granting query access to the evaluation resource test catalog"
grant_to_creating_role = true
}
resource "galaxy_role_privilege_grant" "dq_check_grant" {
role_id = galaxy_role.dq_check_grant.role_id
entity_id = galaxy_postgresql_catalog.test.catalog_id
entity_kind = "Column"
privilege = "Select"
grant_kind = "Allow"
grant_option = false
schema_name = "*"
table_name = "*"
column_name = "*"
}
resource "galaxy_data_quality_check" "test" {
name = "evrcheck_%[1]s"
description = "Data quality check for evaluation resource test"
catalog_id = galaxy_postgresql_catalog.test.catalog_id
schema_id = "anu_test"
table_id = "employees"
severity = "Low"
category = "Completeness"
kind = "SqlQuery"
cluster_id = galaxy_cluster.test.cluster_id
query = "select exists(select * from ${galaxy_postgresql_catalog.test.name}.anu_test.employees)"
depends_on = [galaxy_role_privilege_grant.dq_check_grant]
}
resource "galaxy_role" "dq_check_grant" {
role_name = "evrsrcgrant%[1]s"
role_description = "Role granting query access to the evaluation resource test catalog"
grant_to_creating_role = true
}
resource "galaxy_role_privilege_grant" "dq_check_grant" {
role_id = galaxy_role.dq_check_grant.role_id
entity_id = galaxy_postgresql_catalog.test.catalog_id
entity_kind = "Column"
privilege = "Select"
grant_kind = "Allow"
grant_option = false
schema_name = "*"
table_name = "*"
column_name = "*"
}
resource "galaxy_role_privilege_grant" "dq_check_use_cluster" {
role_id = galaxy_role.dq_check_grant.role_id
entity_id = galaxy_cluster.test.cluster_id
entity_kind = "Cluster"
privilege = "UseCluster"
grant_kind = "Allow"
grant_option = false
}
resource "galaxy_data_quality_check" "test" {
name = "evrcheck_%[1]s"
description = "Data quality check for evaluation resource test"
catalog_id = galaxy_postgresql_catalog.test.catalog_id
schema_id = "anu_test"
table_id = "employees"
severity = "Low"
category = "Completeness"
kind = "SqlQuery"
cluster_id = galaxy_cluster.test.cluster_id
query = "select exists(select * from ${galaxy_postgresql_catalog.test.name}.anu_test.employees)"
depends_on = [galaxy_role_privilege_grant.dq_check_grant, galaxy_role_privilege_grant.dq_check_use_cluster]
}

Comment on lines +63 to +87
func (r *evaluationResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse) {
var plan resource_evaluation.EvaluationModel

resp.Diagnostics.Append(req.Plan.Get(ctx, &plan)...)
if resp.Diagnostics.HasError() {
return
}

checkID := plan.DataQualityCheckId.ValueString()

tflog.Debug(ctx, "Creating evaluation", map[string]interface{}{"data_quality_check_id": checkID})
response, err := r.client.CreateEvaluation(ctx, checkID)
if err != nil {
resp.Diagnostics.AddError(
"Error creating evaluation",
"Could not create evaluation: "+err.Error(),
)
return
}

r.updateModelFromResponse(ctx, &plan, response)

tflog.Debug(ctx, "Created evaluation", map[string]interface{}{"id": plan.Id.ValueString()})
resp.Diagnostics.Append(resp.State.Set(ctx, &plan)...)
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🔴 Critical | ⚡ Quick win

id stays unknown if the create response omits dataQualityCheckId, failing the apply.

model.Id is only set inside the if at Line 161. When the POST response doesn't echo dataQualityCheckId, Terraform errors with "provider produced inconsistent result after apply" because a computed attribute remained unknown. Seed from the planned check ID.

🛠️ Fallback to the known check ID
 	r.updateModelFromResponse(ctx, &plan, response)
+	if plan.Id.IsNull() || plan.Id.IsUnknown() {
+		plan.DataQualityCheckId = types.StringValue(checkID)
+		plan.Id = types.StringValue(checkID)
+	}

Also applies to: 160-164

Comment on lines +259 to +260
func (r *usageExampleResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse) {
resource.ImportStatePassthroughID(ctx, path.Root("id"), req, resp)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟠 Major | 🏗️ Heavy lift

Populate the identifiers required by Read during import.

ImportStatePassthroughID sets only id, but Read ignores state.Id and calls GetUsageExample with data_product_id and usage_example_id. Imports therefore cannot be read successfully. Parse a documented composite import ID and set both attributes, then add an import acceptance test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants