feat: Add terraform federated content and data#48010
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
6 Skipped Deployments
|
|
This pull request has been ignored for the connected project Preview Branches by Supabase. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (12)
💤 Files with no reviewable changes (1)
🚧 Files skipped from review as they are similar to previous changes (11)
📝 WalkthroughWalkthroughTerraform documentation is now fetched through the federated-content pipeline, with the provider schema stored locally and rendered in a new reference page. The Terraform route uses shared guide utilities, and MDX generation and rendering register the new schema component. ChangesTerraform documentation
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant TerraformSource
participant FederatedFetcher
participant GeneratedDirectory
participant GuideRoute
participant ProviderReference
TerraformSource->>FederatedFetcher: provide documentation and schema mappings
FederatedFetcher->>GeneratedDirectory: write generated guides and terraform.schema.json
GuideRoute->>GeneratedDirectory: load rendered Terraform guide data
ProviderReference->>GeneratedDirectory: read terraform.schema.json
ProviderReference-->>GuideRoute: render provider settings, resources, and data sources
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
apps/docs/components/TerraformProviderSchema.tsx (2)
52-52: 🩺 Stability & Availability | 🔴 Critical | ⚡ Quick winPrevent React crashes by stringifying complex Terraform types.
In Terraform provider schemas, the
typeattribute is often an array or object for collection/nested types (e.g.,["list", "string"]). Rendering these directly inside JSX will cause React to throw anObjects are not valid as a React childerror. Safely format or stringify the type (e.g.,typeof type === 'string' ? type : JSON.stringify(type)) before rendering it across all tables.
apps/docs/components/TerraformProviderSchema.tsx#L52-L52: update the rendering ofattributes[attribute].typein the ProviderSettings table.apps/docs/components/TerraformProviderSchema.tsx#L125-L165: update the rendering of bothschema[resource].block.attributes[attribute].typeand itsnested_typeequivalent in the Resources table.apps/docs/components/TerraformProviderSchema.tsx#L251-L295: update the rendering of bothschema[dataSource].block.attributes[attribute].typeand itsnested_typeequivalent in the Data Sources table.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/docs/components/TerraformProviderSchema.tsx` at line 52, Safely stringify non-string Terraform type values before rendering them in the ProviderSettings table at apps/docs/components/TerraformProviderSchema.tsx lines 52-52, and in both type and nested_type cells of the Resources table at lines 125-165 and Data Sources table at lines 251-295. Preserve direct rendering for strings and serialize array/object values so every table renders valid React children.
14-21: 🎯 Functional Correctness | 🟠 Major | ⚡ Quick winFix generated Terraform syntax by joining mapped arrays.
When interpolating the result of an
Array.prototype.mapcall into a template string, JavaScript defaults to joining the elements with commas (e.g.,key1 = "",key2 = <value>), which produces invalid Terraform syntax. Append.join('\n')(with appropriate indentation) to correctly format the generated configuration blocks across all code examples.
apps/docs/components/TerraformProviderSchema.tsx#L14-L21: append.join('\n ')to theObject.keys(attributes).map(...)expression.apps/docs/components/TerraformProviderSchema.tsx#L87-L100: append.join('\n ')to theObject.keys(schema[resource].block.attributes).filter(...).map(...)expression.apps/docs/components/TerraformProviderSchema.tsx#L211-L226: append.join('\n ')to theObject.keys(schema[dataSource].block.attributes).filter(...).map(...)expression.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/docs/components/TerraformProviderSchema.tsx` around lines 14 - 21, Join each mapped Terraform attribute expression with newline indentation instead of relying on template-string array coercion: update the provider example at apps/docs/components/TerraformProviderSchema.tsx lines 14-21 with .join('\n '), the resource attributes expression at lines 87-100 with .join('\n '), and the data-source attributes expression at lines 211-226 with .join('\n ').
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/docs/internals/markdown-schema/TerraformProviderSchema.ts`:
- Around line 6-15: Update attributesTable to sanitize every header and cell
value before building the Markdown table: replace newlines with <br/> or spaces
and escape pipe characters so descriptions and other attribute fields cannot
break table layout. Apply the same handling to values produced from
attribute[column.toLowerCase()] while preserving the existing empty-value
behavior.
---
Outside diff comments:
In `@apps/docs/components/TerraformProviderSchema.tsx`:
- Line 52: Safely stringify non-string Terraform type values before rendering
them in the ProviderSettings table at
apps/docs/components/TerraformProviderSchema.tsx lines 52-52, and in both type
and nested_type cells of the Resources table at lines 125-165 and Data Sources
table at lines 251-295. Preserve direct rendering for strings and serialize
array/object values so every table renders valid React children.
- Around line 14-21: Join each mapped Terraform attribute expression with
newline indentation instead of relying on template-string array coercion: update
the provider example at apps/docs/components/TerraformProviderSchema.tsx lines
14-21 with .join('\n '), the resource attributes expression at lines
87-100 with .join('\n '), and the data-source attributes
expression at lines 211-226 with .join('\n ').
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: b208fd77-808c-4f41-9c48-d64d5f5002be
📒 Files selected for processing (12)
apps/docs/.gitignoreapps/docs/app/guides/deployment/terraform/[[...slug]]/page.tsxapps/docs/app/guides/deployment/terraform/terraformConstants.tsapps/docs/components/TerraformProviderSchema.tsxapps/docs/content/guides/deployment/terraform/reference.mdxapps/docs/features/docs/MdxBase.shared.tsxapps/docs/internals/generate-guides-markdown.tsapps/docs/internals/markdown-schema/TerraformProviderSchema.tsapps/docs/lib/docs.tsapps/docs/scripts/federated-content/fetch-federated-content.tsapps/docs/scripts/federated-content/sources/terraform.tsapps/docs/scripts/federated-content/types.ts
💤 Files with no reviewable changes (1)
- apps/docs/app/guides/deployment/terraform/terraformConstants.ts
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@apps/docs/package.json`:
- Around line 45-48: Remove build:federated-content from the pretest:local,
pretest:local:unwatch, pretest:smoke, and pretypecheck scripts. Keep the
remaining local markdown, GraphQL codegen, and type-generation steps intact,
relying on explicitly generated or cached federated content instead of fetching
during validation hooks.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 698ed86a-c1a8-42cc-8c70-eda3fe43cd86
📒 Files selected for processing (1)
apps/docs/package.json
fa5f661 to
38506f1
Compare
|
Switching to draft, because build is falling in many places. I need to investigate this deeply. |
5eaa406 to
6350826
Compare
@czenko definitely not related to the PR changes, but remember that the preview server doesn't have the cache nor the server speeds as productions. So to confirm performance metrics, production is better. If you see this happening in production, let's create a task to look for it. |
Braintrust eval report
|
…nt (#48144) <!-- ccr-slack-attribution --> _Requested by **Ivan Vasilov** · [Slack thread](https://supabase.slack.com/archives/C0161K73J1J/p1784639352877839?thread_ts=1784625513.046239&cid=C0161K73J1J)_ ## I have read the [CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md) file. YES ## What kind of change does this PR introduce? Bug fix. ## What is the current behavior? Running `pnpm --filter=docs run build:guides-markdown` standalone — as `apps/www`'s prebuild does, without first running `build:federated-content` — crashes with `ENOENT ... ai-skills.json` (and the equivalent for `terraform.schema.json`). The `AiSkillsIndex` and `TerraformProviderSchema` markdown-schema handlers `readFileSync` a gitignored, build-time-generated JSON artifact unconditionally. In the full docs build these files exist because `build:federated-content` runs first (via the docs `prebuild`), but in the standalone / www path they do not, so the read throws. These unguarded reads were introduced in #48045 (ai-skills) and #48010 (terraform), which surfaced as the www Vercel build failure. ## What is the new behavior? Both handlers now render an empty section (return an empty string) when the generated artifact is absent, so `build:guides-markdown` succeeds in the standalone / www path. When the artifact IS present (the full docs build, which runs `build:federated-content` first), behavior is byte-for-byte unchanged — the file is parsed and rendered exactly as before. The full docs build is not affected. ## Additional context Implemented with a minimal `existsSync` guard (from the already-imported `node:fs`) in each handler: - `apps/docs/internals/markdown-schema/AiSkillsIndex.ts` - `apps/docs/internals/markdown-schema/TerraformProviderSchema.ts` No changes to any `package.json`, `.gitignore`, or the generators — the fix is confined to the two handlers. --- _Generated by [Claude Code](https://claude.ai/code/session_01RynCtzP874KrpN8CPf7n7n)_ Co-authored-by: Claude <noreply@anthropic.com>
I have read the CONTRIBUTING.md file.
YES/NO
What kind of change does this PR introduce?
Adds support for
docs/guides/deployment/terraform/[...]routes to be fetched pre-build and provide markdown counterparts. How to test:.mdto each route, the server should return a markdown version of each page.Summary by CodeRabbit
New Features
Improvements