import { readFile } from 'node:fs/promises' import { join } from 'node:path' import { TabPanel, Tabs } from '~/features/ui/Tabs' import { GENERATED_DIRECTORY } from '~/lib/docs' import { codeBlock } from 'common-tags' import { Check, PlusCircle } from 'lucide-react' import ReactMarkdown from 'react-markdown' import { Heading, Popover, PopoverContent, PopoverTrigger } from 'ui' import { CodeBlock } from 'ui-patterns/CodeBlock' function ProviderSettings({ schema }: { schema: any }) { const attributes = schema.block.attributes const example = codeBlock` provider "supabase" { ${Object.keys(attributes).map( (attribute) => `${attribute} = ${attributes[attribute].type === 'string' ? `""` : ''}` )} } ` return (
Provider settings

Use these settings to configure your Supabase provider and authenticate to your Supabase project.

Example usage {example} Details {/* extra div because width restriction doesn't work on table itself */}
{Object.keys(schema.block.attributes).map((attribute) => ( ))}
Attribute Description Type Optional Sensitive
{attribute} {attributes[attribute].description} {attributes[attribute].type} {attributes[attribute].optional && ( <> true )} {attributes[attribute].sensitive && ( <> true )}
) } function Resources({ schema }: { schema: any }) { return (
Resources

You can configure these resources using the Supabase Terraform provider:

{Object.keys(schema).map((resource) => ( Example usage {codeBlock` resource "${resource}" " Details {Object.keys(schema[resource].block.attributes).map((attribute) => ( ))}
Attribute Description Type Required Optional Read-only
{attribute} {schema[resource].block.attributes[attribute].description} {schema[resource].block.attributes[attribute].type ?? (
    {Object.keys( schema[resource].block.attributes[attribute].nested_type.attributes ).map((nestedAttribute) => (
  • {nestedAttribute}
    • { schema[resource].block.attributes[attribute].nested_type .attributes[nestedAttribute].description }
    • {schema[resource].block.attributes[attribute].nested_type .attributes[nestedAttribute].type ?? 'nested type'}
    • {schema[resource].block.attributes[attribute].nested_type .attributes[nestedAttribute].required &&
    • Required
    • } {schema[resource].block.attributes[attribute].nested_type .attributes[nestedAttribute].optional &&
    • Optional
    • } {schema[resource].block.attributes[attribute].nested_type .attributes[nestedAttribute].computed &&
    • Read-only
    • }
  • ))}
)}
{schema[resource].block.attributes[attribute].required && ( <> true )} {schema[resource].block.attributes[attribute].optional && ( <> true )} {schema[resource].block.attributes[attribute].computed && ( <> true )}
))}
) } function DataSources({ schema }: { schema: any }) { return (
Data sources

You can read these resources using the Supabase Terraform provider:

{Object.keys(schema).map((dataSource) => ( Example usage {codeBlock` resource "${dataSource}" "all" { ${Object.keys(schema[dataSource].block.attributes) .filter( (attribute) => !schema[dataSource].block.attributes[attribute].computed ) .map( (attribute) => `${attribute} = ${ schema[dataSource].block.attributes[attribute].type === 'string' ? `""` : '' }` )} } `} Details {Object.keys(schema[dataSource].block.attributes).map((attribute) => ( ))}
Attribute Description Type Required Optional Read-only
{attribute} {schema[dataSource].block.attributes[attribute].description} {schema[dataSource].block.attributes[attribute].type ?? ( {schema[dataSource].block.attributes[attribute].nested_type .nesting_mode === 'set' && 'Array of:'}
    {Object.keys( schema[dataSource].block.attributes[attribute].nested_type .attributes ).map((nestedAttribute) => (
  • {nestedAttribute}
    • { schema[dataSource].block.attributes[attribute].nested_type .attributes[nestedAttribute].description }
    • {schema[dataSource].block.attributes[attribute].nested_type .attributes[nestedAttribute].type ?? 'nested type'}
    • {schema[dataSource].block.attributes[attribute].nested_type .attributes[nestedAttribute].required &&
    • Required
    • } {schema[dataSource].block.attributes[attribute].nested_type .attributes[nestedAttribute].optional &&
    • Optional
    • } {schema[dataSource].block.attributes[attribute].nested_type .attributes[nestedAttribute].computed &&
    • Read-only
    • }
  • ))}
)}
{schema[dataSource].block.attributes[attribute].required && ( <> true )} {schema[dataSource].block.attributes[attribute].optional && ( <> true )} {schema[dataSource].block.attributes[attribute].computed && ( <> true )}
))}
) } export async function TerraformProviderSchema() { const raw = await readFile(join(GENERATED_DIRECTORY, 'terraform.schema.json'), 'utf-8') const schema = JSON.parse(raw) const providerSchema = schema.provider_schemas['registry.terraform.io/supabase/supabase'] return ( <> ) }