--- page_title: terraform providers schema command description: >- The `terraform providers schema` command prints detailed schemas for the providers declared in the configuration. --- # `terraform providers schema` command The `terraform providers schema` command print detailed schemas for the providers used in the current configuration. ## Usage ``` $ terraform providers schema [options] ``` The following flags are available: - `-json` - Displays the schemas in a machine-readable JSON format. The `-json` flag is required. The output includes a `format_version` key, which has a default value of `"1.0"`. The semantics of this version are: - Versions between `1.0` and `2.0` are backward-compatible. You should ignore any object properties with unrecognized names to remain forward-compatible with future minor versions. - Major versions are not backward-compatible to older versions. You should reject any input that reports an unsupported major version. - Refer to [Terraform 1.0 Compatibility Promises](/terraform/language/v1-compatibility-promises) for additional information about version support. ## Format Summary The following sections describe the JSON output format by example, using a pseudo-JSON notation. Important elements are described with comments, which are prefixed with //. To avoid excessive repetition, we've split the complete format into several discrete sub-objects, described under separate headers. References wrapped in angle brackets (like ``) are placeholders which, in the real output, would be replaced by an instance of the specified sub-object. The JSON output format consists of the following objects and sub-objects: - [Providers Schema Representation](#providers-schema-representation) - the top-level object returned by `terraform providers schema -json` - [Schema Representation](#schema-representation) - a sub-object of providers, resources, and data sources that describes their schema, along with function signatures - [Block Representation](#block-representation) - a sub-object of schemas that describes attributes and nested blocks - [Function Representation](#function-representation) - a sub-object of functions that describes parameters, the return, and additional documentation - [Parameter Representation](#parameter-representation) - a sub-object of function signatures that describes their type and additional documentation ## Providers Schema Representation ```javascript { "format_version": "1.0", // "provider_schemas" describes the provider schemas for all // providers throughout the configuration tree. "provider_schemas": { // keys in this map are the provider type, such as "random" "example_provider_name": { // "provider" is the schema for the provider configuration "provider": , // "resource_schemas" map the resource type name to the resource's schema "resource_schemas": { "example_resource_name": }, // "data_source_schemas" map the data source type name to the // data source's schema "data_source_schemas": { "example_datasource_name": , }, // "ephemeral_resource_schemas" map the resource type name to the // resource's schema "ephemeral_resource_schemas": { "example_resource_name": , }, // "functions" map the provider function name to the function definition "functions": { "example_function": } }, "example_provider_two": { … } } } ``` ## Schema Representation A schema representation pairs a provider or resource schema (in a "block") with that schema's version. ```javascript { // "version" is the schema version, not the provider version "version": int64, "block": } ``` ## Block Representation A block representation contains "attributes" and "block_types" (which represent nested blocks). ```javascript { // "attributes" describes any attributes that appear directly inside the // block. Keys in this map are the attribute names. "attributes": { "example_attribute_name": { // "type" is a representation of a type specification // that the attribute's value must conform to. "type": "string", // "description" is an English-language description of // the purpose and usage of the attribute. "description": "string", // "required", if set to true, specifies that an // omitted or null value is not permitted. "required": bool, // "optional", if set to true, specifies that an // omitted or null value is permitted. "optional": bool, // "computed", if set to true, indicates that the // value comes from the provider rather than the // configuration. "computed": bool, // "sensitive", if set to true, indicates that the // attribute may contain sensitive information. "sensitive": bool }, }, // "block_types" describes any nested blocks that appear directly // inside the block. // Keys in this map are the names of the block_type. "block_types": { "example_block_name": { // "nesting_mode" describes the nesting mode for the // child block, and can be one of the following: // single // list // set // map "nesting_mode": "list", "block": , // "min_items" and "max_items" set lower and upper // limits on the number of child blocks allowed for // the list and set modes. These are // omitted for other modes. "min_items": 1, "max_items": 3 } } } ``` ## Function Representation A function representation describes the definition of a function. ```javascript { // "summary" is a shortened English-language description of // the purpose of the function in Markdown. "summary": "string", // "description" is a longer English-language description of // the purpose and usage of the function in Markdown. "description": "string", // "deprecation_message" when present signals that the function is deprecated // and the message contains practitioner-facing actions for the deprecation. "deprecation_message": "string", // "return_type" is a representation of a type specification // that the function returns. "return_type": "string", // "parameters" is an optional list of the positional parameters // that the function accepts. "parameters": [ , // ... ], // "variadic_parameter" is an optional representation of the // additional arguments that the function accepts after those // matching with the fixed parameters. "variadic_parameter": } ``` ## Parameter Representation A parameter representation describes a parameter to a function. ```javascript { // "name" is the internal name of the parameter "name": "string", // "description" is an optional English-language description of // the purpose and usage of the parameter in Markdown. "description": "string", // "is_nullable" is true if null is acceptable value for the argument "is_nullable": bool, // "type" is a representation of a type specification // that the parameter's value must conform to. "type": "string" } ```