github.com/hugorut/terraform@v1.1.3/website/docs/cli/commands/providers/schema.mdx (about) 1 --- 2 page_title: 'Command: providers schema' 3 description: >- 4 The `terraform providers schema` command prints detailed schemas for the 5 providers used 6 7 in the current configuration. 8 --- 9 10 # Command: terraform providers schema 11 12 The `terraform providers schema` command is used to print detailed schemas for the providers used in the current configuration. 13 14 -> `terraform providers schema` requires **Terraform v0.12 or later**. 15 16 ## Usage 17 18 Usage: `terraform providers schema [options]` 19 20 The list of available flags are: 21 22 - `-json` - Displays the schemas in a machine-readable, JSON format. 23 24 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. 25 26 The output includes a `format_version` key, which as of Terraform 1.1.0 has 27 value `"1.0"`. The semantics of this version are: 28 29 - We will increment the minor version, e.g. `"1.1"`, for backward-compatible 30 changes or additions. Ignore any object properties with unrecognized names to 31 remain forward-compatible with future minor versions. 32 - We will increment the major version, e.g. `"2.0"`, for changes that are not 33 backward-compatible. Reject any input which reports an unsupported major 34 version. 35 36 We will introduce new major versions only within the bounds of 37 [the Terraform 1.0 Compatibility Promises](/language/v1-compatibility-promises). 38 39 ## Format Summary 40 41 The following sections describe the JSON output format by example, using a pseudo-JSON notation. 42 Important elements are described with comments, which are prefixed with //. 43 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. 44 45 The JSON output format consists of the following objects and sub-objects: 46 47 - [Providers Schema Representation](#providers-schema-representation) - the top-level object returned by `terraform providers schema -json` 48 - [Schema Representation](#schema-representation) - a sub-object of providers, resources, and data sources that describes their schema 49 - [Block Representation](#block-representation) - a sub-object of schemas that describes attributes and nested blocks 50 51 ## Providers Schema Representation 52 53 ```javascript 54 { 55 "format_version": "1.0", 56 57 // "provider_schemas" describes the provider schemas for all 58 // providers throughout the configuration tree. 59 "provider_schemas": { 60 // keys in this map are the provider type, such as "random" 61 "example_provider_name": { 62 // "provider" is the schema for the provider configuration 63 "provider": <schema-representation>, 64 65 // "resource_schemas" map the resource type name to the resource's schema 66 "resource_schemas": { 67 "example_resource_name": <schema-representation> 68 }, 69 70 // "data_source_schemas" map the data source type name to the 71 // data source's schema 72 "data_source_schemas": { 73 "example_datasource_name": <schema-representation>, 74 } 75 }, 76 "example_provider_two": { … } 77 } 78 } 79 ``` 80 81 ## Schema Representation 82 83 A schema representation pairs a provider or resource schema (in a "block") with that schema's version. 84 85 ```javascript 86 { 87 // "version" is the schema version, not the provider version 88 "version": int64, 89 "block": <block-representation> 90 } 91 ``` 92 93 ## Block Representation 94 95 A block representation contains "attributes" and "block_types" (which represent nested blocks). 96 97 ```javascript 98 { 99 // "attributes" describes any attributes that appear directly inside the 100 // block. Keys in this map are the attribute names. 101 "attributes": { 102 "example_attribute_name": { 103 // "type" is a representation of a type specification 104 // that the attribute's value must conform to. 105 "type": "string", 106 107 // "description" is an English-language description of 108 // the purpose and usage of the attribute. 109 "description": "string", 110 111 // "required", if set to true, specifies that an 112 // omitted or null value is not permitted. 113 "required": bool, 114 115 // "optional", if set to true, specifies that an 116 // omitted or null value is permitted. 117 "optional": bool, 118 119 // "computed", if set to true, indicates that the 120 // value comes from the provider rather than the 121 // configuration. 122 "computed": bool, 123 124 // "sensitive", if set to true, indicates that the 125 // attribute may contain sensitive information. 126 "sensitive": bool 127 }, 128 }, 129 // "block_types" describes any nested blocks that appear directly 130 // inside the block. 131 // Keys in this map are the names of the block_type. 132 "block_types": { 133 "example_block_name": { 134 // "nesting_mode" describes the nesting mode for the 135 // child block, and can be one of the following: 136 // single 137 // list 138 // set 139 // map 140 "nesting_mode": "list", 141 "block": <block-representation>, 142 143 // "min_items" and "max_items" set lower and upper 144 // limits on the number of child blocks allowed for 145 // the list and set modes. These are 146 // omitted for other modes. 147 "min_items": 1, 148 "max_items": 3 149 } 150 } 151 ```