Skip to content

feat: sync preserve plan order for required list attrs provider-wide - #99

Merged
bradyburke merged 1 commit into
mainfrom
auto-sync-2026-07-13-b7f9cfc
Jul 15, 2026
Merged

feat: sync preserve plan order for required list attrs provider-wide #99
bradyburke merged 1 commit into
mainfrom
auto-sync-2026-07-13-b7f9cfc

Conversation

@starburstdata-automation

Copy link
Copy Markdown
Collaborator

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

Source commit: b7f9cfce6f8e871d17ac94093eac9cd2f8a4d6ab

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

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR restricts POST retries for transport errors and HTTP 500 responses. Provider resources now preserve planned ordering for returned collections, persist cluster IDs before readiness polling, expose trino_uri for running clusters, and stabilize selected Terraform attributes. Data sources add unconfigured-provider guards, explicit response-type handling, and diagnostic propagation. Role privilege imports validate scope shapes, while owner documentation is corrected for schemas and tables.

Sequence Diagram(s)

sequenceDiagram
  participant Terraform
  participant dataQualityScheduleDataSource
  participant GalaxyClient
  participant GalaxyAPI
  Terraform->>dataQualityScheduleDataSource: Read configuration
  dataQualityScheduleDataSource->>GalaxyClient: Fetch data quality schedule
  GalaxyClient->>GalaxyAPI: Send API request
  GalaxyAPI-->>GalaxyClient: Return schedule response
  GalaxyClient-->>dataQualityScheduleDataSource: Return response
  dataQualityScheduleDataSource->>dataQualityScheduleDataSource: Map values and accumulate diagnostics
  dataQualityScheduleDataSource-->>Terraform: Set state or return diagnostics
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the provider-wide plan-order preservation change.
Description check ✅ Passed The description is related to the changeset and explains it is an automated sync from the generation repository.
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.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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: 1

🧹 Nitpick comments (3)
internal/client/client_test.go (1)

92-136: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add test coverage for POST transport-error exclusion.

The transport-error path in doRequestWithRetry (line 241 of client.go) also excludes POST from retries, but only the HTTP 500 case is tested here. A transport-error test would guard that path against regressions, and a positive test confirming non-POST 500 is retried would protect against accidentally over-restricting the condition.

♻️ Suggested additional tests
 type mockRoundTripper struct {
 	requestCount int
 	statusCode   int
 	method       string
 	attempts     []string
+	err          error
 }

 func (m *mockRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
 	m.requestCount++
 	m.method = req.Method
 	m.attempts = append(m.attempts, req.Method)
+	if m.err != nil {
+		return nil, m.err
+	}
 	return &http.Response{
 		StatusCode: m.statusCode,
 		Header:     http.Header{},
 		Body:       io.NopCloser(strings.NewReader("{}")),
 		Request:    req,
 	}, nil
 }

+func TestPostTransportErrorNotRetried(t *testing.T) {
+	mock := &mockRoundTripper{err: fmt.Errorf("connection reset by peer")}
+	client := &GalaxyClient{
+		BaseURL:         "http://localhost",
+		ClientID:        "test",
+		ClientSecret:    "test",
+		ProviderVersion: "1.0.0",
+		HTTPClient:      &http.Client{Transport: mock},
+		accessToken:     "test-token",
+		tokenExpiry:     time.Now().Add(1 * time.Hour),
+	}
+
+	ctx := context.Background()
+	var result map[string]interface{}
+	err := client.doRequestWithRetry(ctx, http.MethodPost, "/test", nil, &result, 3)
+
+	if err == nil {
+		t.Fatalf("expected error for POST transport failure, got nil")
+	}
+	if mock.requestCount != 1 {
+		t.Fatalf("POST transport error should not be retried; expected 1 request, got %d", mock.requestCount)
+	}
+}
+
+func TestGet500Retried(t *testing.T) {
+	mock := &mockRoundTripper{statusCode: http.StatusInternalServerError}
+	client := &GalaxyClient{
+		BaseURL:         "http://localhost",
+		ClientID:        "test",
+		ClientSecret:    "test",
+		ProviderVersion: "1.0.0",
+		HTTPClient:      &http.Client{Transport: mock},
+		accessToken:     "test-token",
+		tokenExpiry:     time.Now().Add(1 * time.Hour),
+	}
+
+	ctx := context.Background()
+	var result map[string]interface{}
+	_ = client.doRequestWithRetry(ctx, http.MethodGet, "/test", nil, &result, 3)
+
+	if mock.requestCount < 2 {
+		t.Fatalf("GET 500 should be retried; expected at least 2 requests, got %d", mock.requestCount)
+	}
+}
internal/provider/data_quality_schedule_data_source.go (1)

155-180: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add warn logging for unexpected nested entry types, consistent with groups_data_source.go.

groups_data_source.go now logs tflog.Warn when nested array elements (roles, users) aren't map[string]interface{} (lines 208-210, 244-246). The dataQualityChecks loop here silently skips non-map entries at line 158 without logging, creating an observability gap. Since this code is already being modified for diagnostic propagation, adding the same warn logging would be a low-effort consistency improvement.

♻️ Suggested refactor for consistency
 			if checkMap, ok := checkInterface.(map[string]interface{}); ok {
 				attributeTypes := datasource_data_quality_schedule.DataQualityChecksValue{}.AttributeTypes(ctx)
 				attributes := map[string]attr.Value{}
 
 				if dataQualityCheckId, ok := checkMap["dataQualityCheckId"].(string); ok {
 					attributes["data_quality_check_id"] = types.StringValue(dataQualityCheckId)
 				} else {
 					attributes["data_quality_check_id"] = types.StringNull()
 				}
 				if name, ok := checkMap["name"].(string); ok {
 					attributes["name"] = types.StringValue(name)
 				} else {
 					attributes["name"] = types.StringNull()
 				}
 
 				checkValue, d := datasource_data_quality_schedule.NewDataQualityChecksValue(attributeTypes, attributes)
 				if d.HasError() {
 					diags.Append(d...)
 					continue
 				}
 				checksList = append(checksList, checkValue)
+			} else {
+				tflog.Warn(ctx, fmt.Sprintf("unexpected entry type in dataQualityChecks, skipping: %T", checkInterface))
 			}
internal/provider/evaluation_data_source.go (1)

139-174: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add warn logging for unexpected nested entry types, consistent with groups_data_source.go.

Same as the data_quality_schedule_data_source.go observation: the evaluations loop at line 142 silently skips non-map entries, while groups_data_source.go now logs warnings for equivalent nested arrays (roles, users). Adding the same tflog.Warn here would maintain observability consistency across the provider.

♻️ Suggested refactor for consistency
 			if evalMap, ok := evalInterface.(map[string]interface{}); ok {
 				attributeTypes := datasource_evaluation.EvaluationsValue{}.AttributeTypes(ctx)
 				attributes := map[string]attr.Value{}
 
 				if basedOnStatsAt, ok := evalMap["basedOnStatsAt"].(string); ok {
 					attributes["based_on_stats_at"] = types.StringValue(basedOnStatsAt)
 				} else {
 					attributes["based_on_stats_at"] = types.StringNull()
 				}
 				if evaluatedAt, ok := evalMap["evaluatedAt"].(string); ok {
 					attributes["evaluated_at"] = types.StringValue(evaluatedAt)
 				} else {
 					attributes["evaluated_at"] = types.StringNull()
 				}
 				if predicate, ok := evalMap["predicate"].(string); ok {
 					attributes["predicate"] = types.StringValue(predicate)
 				} else {
 					attributes["predicate"] = types.StringNull()
 				}
 				if status, ok := evalMap["status"].(string); ok {
 					attributes["status"] = types.StringValue(status)
 				} else {
 					attributes["status"] = types.StringNull()
 				}
 
 				evalValue, d := datasource_evaluation.NewEvaluationsValue(attributeTypes, attributes)
 				if d.HasError() {
 					diags.Append(d...)
 					continue
 				}
 				evalsList = append(evalsList, evalValue)
+			} else {
+				tflog.Warn(ctx, fmt.Sprintf("unexpected entry type in evaluations, skipping: %T", evalInterface))
 			}

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 00705b75-efd8-40ab-8cff-a7b965dc5877

📥 Commits

Reviewing files that changed from the base of the PR and between f8c67d4 and 19bf182.

📒 Files selected for processing (21)
  • docs/data-sources/schema.md
  • docs/data-sources/table.md
  • internal/client/client.go
  • internal/client/client_test.go
  • internal/provider/cluster_resource.go
  • internal/provider/data_product_resource.go
  • internal/provider/data_quality_check_data_source.go
  • internal/provider/data_quality_check_resource.go
  • internal/provider/data_quality_checks_data_source.go
  • internal/provider/data_quality_schedule_data_source.go
  • internal/provider/datasource_schema/schema_data_source_gen.go
  • internal/provider/datasource_table/table_data_source_gen.go
  • internal/provider/evaluation_data_source.go
  • internal/provider/groups_data_source.go
  • internal/provider/list_ordering.go
  • internal/provider/mongodb_catalog_resource.go
  • internal/provider/policy_resource.go
  • internal/provider/role_privilege_grant_resource.go
  • internal/provider/service_account_password_resource.go
  • internal/provider/service_account_resource.go
  • internal/provider/usage_example_data_source.go

Comment thread internal/provider/policy_resource.go
@bradyburke
bradyburke merged commit c9c9922 into main Jul 15, 2026
2 checks passed
@bradyburke
bradyburke deleted the auto-sync-2026-07-13-b7f9cfc branch July 15, 2026 15:23
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