Skip to content

feat: Add terraform federated content and data#48010

Merged
jeremenichelli merged 2 commits into
masterfrom
jeremias/docs-1188-pre-fetch-deploymentterraformreference-and
Jul 21, 2026
Merged

feat: Add terraform federated content and data#48010
jeremenichelli merged 2 commits into
masterfrom
jeremias/docs-1188-pre-fetch-deploymentterraformreference-and

Conversation

@jeremenichelli

@jeremenichelli jeremenichelli commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

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:

  • Open the preview link for this PR.
  • Go to Build > Deployment
  • Visit all pages under the Terraform section. They should all look the same as their production counterparts.
  • Add .md to each route, the server should return a markdown version of each page.
  • Try 'Copy as Markdown' button and check content is copied correctly.

Summary by CodeRabbit

  • New Features

    • Added Terraform deployment documentation, including the README, tutorial, and provider reference.
    • Added a searchable reference covering provider settings, resources, and data sources.
    • Terraform reference content now includes structured attribute details such as types, required fields, optional fields, and sensitivity.
  • Improvements

    • Improved Terraform documentation navigation, metadata, and links.
    • Documentation updates are now generated from the latest configured Terraform provider schema.

@jeremenichelli
jeremenichelli requested a review from awalias July 16, 2026 15:21
@jeremenichelli
jeremenichelli requested a review from a team as a code owner July 16, 2026 15:21
@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
docs Ready Ready Preview, Comment, Open in v0 Jul 17, 2026 2:11pm
6 Skipped Deployments
Project Deployment Actions Updated (UTC)
studio Ignored Ignored Jul 17, 2026 2:11pm
design-system Skipped Skipped Jul 17, 2026 2:11pm
studio-self-hosted Skipped Skipped Jul 17, 2026 2:11pm
studio-staging Skipped Skipped Jul 17, 2026 2:11pm
ui-library Skipped Skipped Jul 17, 2026 2:11pm
zone-www-dot-com Skipped Skipped Jul 17, 2026 2:11pm

Request Review

@supabase

supabase Bot commented Jul 16, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project xguihxuzqibwxjnimxev because there are no changes detected in supabase directory. You can change this behaviour in Project Integrations Settings ↗︎.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 16, 2026
@coderabbitai

coderabbitai Bot commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 86e57060-ecc6-4dba-b8f4-35e9469c8668

📥 Commits

Reviewing files that changed from the base of the PR and between 38506f1 and 229f406.

📒 Files selected for processing (12)
  • apps/docs/.gitignore
  • apps/docs/app/guides/deployment/terraform/[[...slug]]/page.tsx
  • apps/docs/app/guides/deployment/terraform/terraformConstants.ts
  • apps/docs/components/TerraformProviderSchema.tsx
  • apps/docs/content/guides/deployment/terraform/reference.mdx
  • apps/docs/features/docs/MdxBase.shared.tsx
  • apps/docs/internals/generate-guides-markdown.ts
  • apps/docs/internals/markdown-schema/TerraformProviderSchema.ts
  • apps/docs/lib/docs.ts
  • apps/docs/scripts/federated-content/fetch-federated-content.ts
  • apps/docs/scripts/federated-content/sources/terraform.ts
  • apps/docs/scripts/federated-content/types.ts
💤 Files with no reviewable changes (1)
  • apps/docs/app/guides/deployment/terraform/terraformConstants.ts
🚧 Files skipped from review as they are similar to previous changes (11)
  • apps/docs/content/guides/deployment/terraform/reference.mdx
  • apps/docs/scripts/federated-content/sources/terraform.ts
  • apps/docs/lib/docs.ts
  • apps/docs/internals/generate-guides-markdown.ts
  • apps/docs/.gitignore
  • apps/docs/features/docs/MdxBase.shared.tsx
  • apps/docs/components/TerraformProviderSchema.tsx
  • apps/docs/internals/markdown-schema/TerraformProviderSchema.ts
  • apps/docs/app/guides/deployment/terraform/[[...slug]]/page.tsx
  • apps/docs/scripts/federated-content/fetch-federated-content.ts
  • apps/docs/scripts/federated-content/types.ts

📝 Walkthrough

Walkthrough

Terraform 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.

Changes

Terraform documentation

Layer / File(s) Summary
Federated Terraform content pipeline
apps/docs/scripts/federated-content/..., apps/docs/lib/docs.ts, apps/docs/.gitignore
Federated content supports root-relative files, raw generated files, fallback links, Terraform source mappings, and generated schema output.
Terraform schema markdown generation
apps/docs/internals/markdown-schema/TerraformProviderSchema.ts, apps/docs/internals/generate-guides-markdown.ts
The generated schema is converted into Markdown tables for provider settings, resources, and data sources, and the handler is registered for MDX generation.
Guide route and provider reference
apps/docs/app/guides/deployment/terraform/..., apps/docs/components/TerraformProviderSchema.tsx, apps/docs/content/guides/deployment/terraform/reference.mdx, apps/docs/features/docs/MdxBase.shared.tsx
The Terraform route uses shared guide loading and metadata utilities, while the reference page loads the generated schema and renders it through the registered MDX component.

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
Loading

Possibly related PRs

Suggested reviewers: awalias

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description omits required sections for current behavior, new behavior, and additional context, and leaves the CONTRIBUTING confirmation unresolved. Fill in the template sections: confirm CONTRIBUTING.md, describe current behavior, new behavior, linked issues, and any additional context or screenshots.
Docstring Coverage ⚠️ Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: adding Terraform federated content for docs routes.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch jeremias/docs-1188-pre-fetch-deploymentterraformreference-and

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.

Comment thread apps/docs/scripts/federated-content/fetch-federated-content.ts Fixed

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 win

Prevent React crashes by stringifying complex Terraform types.

In Terraform provider schemas, the type attribute is often an array or object for collection/nested types (e.g., ["list", "string"]). Rendering these directly inside JSX will cause React to throw an Objects are not valid as a React child error. 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 of attributes[attribute].type in the ProviderSettings table.
  • apps/docs/components/TerraformProviderSchema.tsx#L125-L165: update the rendering of both schema[resource].block.attributes[attribute].type and its nested_type equivalent in the Resources table.
  • apps/docs/components/TerraformProviderSchema.tsx#L251-L295: update the rendering of both schema[dataSource].block.attributes[attribute].type and its nested_type equivalent 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 win

Fix generated Terraform syntax by joining mapped arrays.

When interpolating the result of an Array.prototype.map call 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 the Object.keys(attributes).map(...) expression.
  • apps/docs/components/TerraformProviderSchema.tsx#L87-L100: append .join('\n ') to the Object.keys(schema[resource].block.attributes).filter(...).map(...) expression.
  • apps/docs/components/TerraformProviderSchema.tsx#L211-L226: append .join('\n ') to the Object.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

📥 Commits

Reviewing files that changed from the base of the PR and between 0bcd2e1 and 95ad4e3.

📒 Files selected for processing (12)
  • apps/docs/.gitignore
  • apps/docs/app/guides/deployment/terraform/[[...slug]]/page.tsx
  • apps/docs/app/guides/deployment/terraform/terraformConstants.ts
  • apps/docs/components/TerraformProviderSchema.tsx
  • apps/docs/content/guides/deployment/terraform/reference.mdx
  • apps/docs/features/docs/MdxBase.shared.tsx
  • apps/docs/internals/generate-guides-markdown.ts
  • apps/docs/internals/markdown-schema/TerraformProviderSchema.ts
  • apps/docs/lib/docs.ts
  • apps/docs/scripts/federated-content/fetch-federated-content.ts
  • apps/docs/scripts/federated-content/sources/terraform.ts
  • apps/docs/scripts/federated-content/types.ts
💤 Files with no reviewable changes (1)
  • apps/docs/app/guides/deployment/terraform/terraformConstants.ts

Comment thread apps/docs/internals/markdown-schema/TerraformProviderSchema.ts

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

📥 Commits

Reviewing files that changed from the base of the PR and between 95ad4e3 and fa5f661.

📒 Files selected for processing (1)
  • apps/docs/package.json

Comment thread apps/docs/package.json Outdated
@jeremenichelli
jeremenichelli force-pushed the jeremias/docs-1188-pre-fetch-deploymentterraformreference-and branch from fa5f661 to 38506f1 Compare July 16, 2026 15:48
@jeremenichelli
jeremenichelli marked this pull request as draft July 16, 2026 16:10
@jeremenichelli

Copy link
Copy Markdown
Contributor Author

Switching to draft, because build is falling in many places. I need to investigate this deeply.

@coderabbitai coderabbitai Bot mentioned this pull request Jul 17, 2026
@jeremenichelli
jeremenichelli force-pushed the jeremias/docs-1188-pre-fetch-deploymentterraformreference-and branch from 5eaa406 to 6350826 Compare July 17, 2026 13:13
@jeremenichelli
jeremenichelli marked this pull request as ready for review July 17, 2026 14:09
@jeremenichelli jeremenichelli added the ai Vectors, embeddings, all-things-AI label Jul 17, 2026

@czenko czenko left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Content and copy worked as expected on all Terraform pages.
I did not notice a delay on the copy button on this one, but maybe that's a cache thing?

@jeremenichelli

Copy link
Copy Markdown
Contributor Author

Content and copy worked as expected on all Terraform pages.
I did not notice a delay on the copy button on this one, but maybe that's a cache thing?

@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.

@jeremenichelli
jeremenichelli merged commit 77818b8 into master Jul 21, 2026
43 checks passed
@jeremenichelli
jeremenichelli deleted the jeremias/docs-1188-pre-fetch-deploymentterraformreference-and branch July 21, 2026 08:54
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

Braintrust eval report

Assistant (master-1784624260)

Score Average Improvements Regressions
Completeness 83.6% (-16pp) - 9 🔴
Conciseness 47.4% (+8pp) 13 🟢 4 🔴
Correctness 54.2% (-14.000000000000002pp) 3 🟢 6 🔴
Docs Faithfulness 66.7% (-5pp) 5 🟢 5 🔴
Goal Completion 66.7% (-14.000000000000002pp) 1 🟢 13 🔴
SQL Validity 100% (+0pp) - -
Knowledge Usage 93.3% (+1pp) 1 🟢 -
SQL Identifier Quoting 100% (+0pp) - -
Tool Usage 74.5% (+4pp) 1 🟢 -
Safety 97.4% (+12pp) 2 🟢 1 🔴
Time_to_first_token 3.33tok (+0.17tok) 12 🟢 17 🔴
Llm_calls 6.15 (-0.76) 6 🟢 15 🔴
Tool_calls 2.8 (-0.06) 7 🟢 12 🔴
Errors 0.38 (+0.38) - 4 🔴
Llm_errors 0 (+0) - -
Tool_errors 0 (+0) - -
Prompt_tokens 26793.78tok (+5952tok) 7 🟢 18 🔴
Prompt_cached_tokens 7566.71tok (+333.98tok) 13 🟢 13 🔴
Prompt_cache_creation_tokens 0tok (+0tok) - -
Prompt_cache_creation_5m_tokens 0tok (+0tok) - -
Prompt_cache_creation_1h_tokens 0tok (+0tok) - -
Completion_tokens 685.47tok (+85.23tok) 14 🟢 15 🔴
Completion_reasoning_tokens 96.78tok (+6.93tok) 11 🟢 15 🔴
Completion_accepted_prediction_tokens 0tok (+0tok) - -
Completion_rejected_prediction_tokens 0tok (+0tok) - -
Completion_audio_tokens 0tok (+0tok) - -
Total_tokens 27479.25tok (+6037.23tok) 11 🟢 18 🔴
Estimated_cost 0$ (+0$) 12 🟢 15 🔴
Duration 17.74s (+0.63s) 15 🟢 14 🔴
Llm_duration 12.18s (-0.16s) 16 🟢 13 🔴

awaseem pushed a commit that referenced this pull request Jul 21, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Vectors, embeddings, all-things-AI documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants