2019-02-27 20:08:31 +01:00
---
2021-12-15 03:41:17 +01:00
page_title: 'Command: providers schema'
description: >-
The `terraform providers schema` command prints detailed schemas for the
providers used
2019-02-27 20:08:31 +01:00
in the current configuration.
---
# Command: terraform providers schema
The `terraform providers schema` command is used to print detailed schemas for the providers used in the current configuration.
2019-03-18 19:49:30 +01:00
-> `terraform providers schema` requires **Terraform v0.12 or later**.
2019-02-27 20:08:31 +01:00
## Usage
Usage: `terraform providers schema [options]`
The list of available flags are:
2021-12-15 03:41:17 +01:00
- `-json` - Displays the schemas in a machine-readable, JSON format.
2019-02-27 20:08:31 +01:00
2019-09-05 19:08:34 +02:00
Please note that, at this time, the `-json` flag is a _required_ option. In future releases, this command will be extended to allow for additional options.
2019-08-15 15:57:51 +02:00
2021-09-01 17:17:13 +02:00
The output includes a `format_version` key, which as of Terraform 1.1.0 has
value `"1.0"`. The semantics of this version are:
- We will increment the minor version, e.g. `"1.1"`, for backward-compatible
changes or additions. Ignore any object properties with unrecognized names to
remain forward-compatible with future minor versions.
- We will increment the major version, e.g. `"2.0"`, for changes that are not
backward-compatible. Reject any input which reports an unsupported major
version.
We will introduce new major versions only within the bounds of
2021-12-15 03:41:17 +01:00
[the Terraform 1.0 Compatibility Promises](/language/v1-compatibility-promises).
2019-08-15 15:57:51 +02:00
## 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 `<block-representation>`) 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
- [Block Representation](#block-representation) - a sub-object of schemas that describes attributes and nested blocks
2019-09-05 19:08:34 +02:00
## Providers Schema Representation
2019-08-15 15:57:51 +02:00
```javascript
{
2021-09-01 17:17:13 +02:00
"format_version": "1.0",
2019-09-05 19:08:34 +02:00
// "provider_schemas" describes the provider schemas for all
// providers throughout the configuration tree.
2019-08-15 15:57:51 +02:00
"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": <schema-representation>,
2019-09-05 19:08:34 +02:00
2019-08-15 15:57:51 +02:00
// "resource_schemas" map the resource type name to the resource's schema
"resource_schemas": {
"example_resource_name": <schema-representation>
},
// "data_source_schemas" map the data source type name to the
// data source's schema
"data_source_schemas": {
"example_datasource_name": <schema-representation>,
}
},
"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>
}
```
## Block Representation
A block representation contains "attributes" and "block_types" (which represent nested blocks).
```javascript
{
2019-09-05 19:08:34 +02:00
// "attributes" describes any attributes that appear directly inside the
2019-08-15 15:57:51 +02:00
// 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",
2019-09-05 19:08:34 +02:00
// "description" is an English-language description of
2019-08-15 15:57:51 +02:00
// the purpose and usage of the attribute.
"description": "string",
2019-09-05 19:08:34 +02:00
// "required", if set to true, specifies that an
2019-08-15 15:57:51 +02:00
// omitted or null value is not permitted.
"required": bool,
2019-09-05 19:08:34 +02:00
// "optional", if set to true, specifies that an
// omitted or null value is permitted.
2019-08-15 15:57:51 +02:00
"optional": bool,
2019-09-05 19:08:34 +02:00
// "computed", if set to true, indicates that the
// value comes from the provider rather than the
2019-08-15 15:57:51 +02:00
// 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.
2019-09-05 19:08:34 +02:00
"block_types": {
"example_block_name": {
// "nesting_mode" describes the nesting mode for the
2019-08-15 15:57:51 +02:00
// child block, and can be one of the following:
// single
// list
// set
// map
"nesting_mode": "list",
"block": <block-representation>,
2019-09-05 19:08:34 +02:00
// "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.
2019-08-15 15:57:51 +02:00
"min_items": 1,
"max_items": 3
}
}
```