- OpenTofu の内部構造
- 関数メタデータ
関数メタデータ
tofu metadata functions
コマンドは、現在の OpenTofu バージョンで利用可能な関数のシグネチャを出力するために使用されます。
使用法
使用法:tofu metadata functions [オプション]
次のフラグが利用可能です
-json
- 関数のシグネチャを機械可読な JSON 形式で表示します。
現時点では、-json
フラグは *必須* オプションであることに注意してください。将来のリリースでは、このコマンドは追加のオプションを許可するように拡張される予定です。
出力には、値が "1.0"
である format_version
キーが含まれています。このバージョンのセマンティクスは次のとおりです。
- 後方互換性のある変更または追加の場合、マイナーバージョン(例:
"1.1"
)をインクリメントします。将来のマイナーバージョンとの前方互換性を維持するために、認識されない名前のオブジェクトプロパティは無視してください。 - 後方互換性のない変更の場合、メジャーバージョン(例:
"2.0"
)をインクリメントします。サポートされていないメジャーバージョンを報告する入力は拒否してください。
新しいメジャーバージョンは、OpenTofu 1.0 互換性プロミスの範囲内でのみ導入します。
形式の概要
次のセクションでは、疑似 JSON 表記を使用して、JSON 出力形式を例で説明します。重要な要素は、//
で始まるコメントで説明します。過度の繰り返しを避けるため、完全な形式をいくつかの個別のサブオブジェクトに分割し、個別のヘッダーで説明します。山かっこ(<block-representation>
など)で囲まれた参照は、プレースホルダーであり、実際の出力では、指定されたサブオブジェクトのインスタンスに置き換えられます。
JSON 出力形式は、次のオブジェクトとサブオブジェクトで構成されています。
関数シグネチャ表現
{
"format_version": "1.0",
// "function_signatures" describes the signatures for all
// available functions.
"function_signatures": {
// keys in this map are the function names, such as "abs"
"example_function": {
// "description" is an English-language description of
// the purpose and usage of the function in Markdown.
"description": "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": [
<parameter-representation>,
…
],
// "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>
},
"example_function_two": { … }
}
}
パラメーター表現
パラメーター表現は、関数のパラメーターを記述します。
{
// "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",
// "type" is a representation of a type specification
// that the parameter's value must conform to.
"type": "string"
}