メインコンテンツにスキップ

コマンド: providers schema

tofu providers schemaコマンドは、現在の構成で使用されているプロバイダーの詳細なスキーマを印刷するために使用されます。

使用法

使用法: tofu providers schema [オプション]

以下のフラグを使用できます。

  • -json - スキーマを機械可読なJSON形式で表示します。

  • -var 'NAME=VALUE' - 構成のルートモジュールで宣言された単一の入力変数の値を設定します。複数の変数を設定するには、このオプションを複数回使用します。詳細については、コマンドラインでの入力変数を参照してください。

  • -var-file=FILENAME - 「tfvars」ファイルからの定義を使用して、構成のルートモジュールで宣言された、潜在的に多くの入力変数の値を設定します。複数のファイルから値を含めるには、このオプションを複数回使用します。

-varおよび-var-fileオプションとは別に、ルートモジュールに入力変数の値を設定する他の方法がいくつかあります。詳細については、ルートモジュール変数への値の割り当てを参照してください。

現時点では、-jsonフラグは必須オプションであることに注意してください。今後のリリースでは、このコマンドは追加のオプションを許可するように拡張されます。

出力には、値が"1.0"format_versionキーが含まれています。このバージョンのセマンティクスは次のとおりです。

  • 下位互換性のある変更または追加については、マイナーバージョン(例:"1.1")をインクリメントします。将来のマイナーバージョンとの前方互換性を維持するために、認識されない名前のオブジェクトプロパティは無視してください。
  • 下位互換性のない変更については、メジャーバージョン(例:"2.0")をインクリメントします。サポートされていないメジャーバージョンを報告する入力は拒否します。

新しいメジャーバージョンは、OpenTofu 1.0互換性約束の範囲内でのみ導入します。

形式の概要

以下のセクションでは、疑似JSON表記を使用して、JSON出力形式を例で説明します。重要な要素は、//で始まるコメントで説明します。過度の繰り返しを避けるために、完全な形式をいくつかの個別のサブオブジェクトに分割し、別々のヘッダーで説明します。山かっこで囲まれた参照(<ブロック表現>など)はプレースホルダーであり、実際には指定されたサブオブジェクトのインスタンスに置き換えられます。

JSON出力形式は、以下のオブジェクトとサブオブジェクトで構成されています。

  • プロバイダー スキーマ表現 - tofu providers schema -jsonによって返される最上位のオブジェクト
  • スキーマ表現 - スキーマを記述するプロバイダー、リソース、およびデータソースのサブオブジェクト
  • ブロック表現 - 属性とネストされたブロックを記述するスキーマのサブオブジェクト

プロバイダー スキーマ表現

コードブロック
{
"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": <schema-representation>,

// "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": {}
}
}

スキーマ表現

スキーマ表現は、プロバイダーまたはリソースのスキーマ(「ブロック」内)と、そのスキーマのバージョンをペアにします。

コードブロック
{
// "version" is the schema version, not the provider version
"version": int64,
"block": <block-representation>
}

ブロック表現

ブロック表現には、「属性」と「block_types」(ネストされたブロックを表します)が含まれています。

コードブロック
{
// "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": <block-representation>,

// "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
}
}