terraform providers schema 커맨드

terraform providers schema 커맨드

terraform providers schema 커맨드는 현재 설정에서 사용되는 프로바이더에 대한 상세한 스키마를 출력해요. -json 플래그를 사용하면 기계가 읽을 수 있는 JSON 형식으로 스키마를 표시해요.

출처: 문서

본문

사용법 (Usage)

$ terraform providers schema [options]

이 커맨드는 다음 옵션도 받아요:

  • -json - 스키마를 기계가 읽을 수 있는 JSON 형식으로 표시해요. -json 플래그는 필수예요.

  • -var 'NAME=VALUE' - 설정의 루트 모듈에 선언된 단일 입력 변수에 값을 설정해요. 여러 변수를 설정하려면 이 옵션을 여러 번 사용하세요. 자세한 내용은 명령줄의 입력 변수를 참고하세요.

  • -var-file=FILENAME - 설정의 루트 모듈에 선언된 많은 입력 변수.tfvars 파일의 정의를 사용해 값을 설정해요. 여러 파일의 값을 포함하려면 이 옵션을 여러 번 사용하세요. 루트 모듈의 입력 변수에 값을 설정하는 방법은 -var-var-file 옵션 외에도 여러 가지가 있어요. 자세한 내용은 입력 변수에 값 할당을 참고하세요.

출력에는 기본값이 "1.0"format_version 키가 포함돼요. 이 버전의 의미는 다음과 같아요:

  • 1.02.0 사이의 버전은 이전 버전과 호환돼요. 미래의 마이너 버전과도 앞으로 호환되도록 인식되지 않는 이름의 객체 속성은 무시해야 해요.
  • 메이저 버전은 이전 버전과 호환되지 않아요. 지원되지 않는 메이저 버전을 보고하는 입력은 거부해야 해요.
  • 버전 지원에 대한 자세한 내용은 Terraform 1.0 호환성 약속을 참고하세요.

형식 요약 (Format Summary)

다음 섹션에서는 예제와 함께 가상의 JSON 표기법을 사용해서 JSON 출력 형식을 설명해요. 중요한 요소는 // 접두사가 붙은 주석으로 설명돼요. 반복을 줄이기 위해 전체 형식을 별도의 헤더 아래에 설명된 여러 개별 하위 객체로 나눴어요. 꺾쇠 괄호(<>)로 감싼 참조는 실제 출력에서는 지정된 하위 객체의 인스턴스로 대체되는 플레이스홀더예요.

JSON 출력 형식은 다음 객체와 하위 객체로 구성돼요:

  • 프로바이더 스키마 표현 - terraform providers schema -json이 반환하는 최상위 객체
  • 스키마 표현 - 프로바이더·리소스·데이터 소스의 하위 객체로, 스키마와 함수 시그니처를 설명해요
  • 블록 표현 - 스키마의 하위 객체로, 속성과 중첩 블록을 설명해요
  • 함수 표현 - 함수의 하위 객체로, 매개변수·반환값·추가 문서를 설명해요
  • 매개변수 표현 - 함수 시그니처의 하위 객체로, 타입과 추가 문서를 설명해요

프로바이더 스키마 표현 (Providers Schema Representation)

{
  "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)

스키마 표현은 프로바이더 또는 리소스 스키마를("block"에) 그 스키마의 버전과 함께 짝지어요.

{
  // "version" is the schema version, not the provider version
  "version": int64,
  "block":
}

블록 표현 (Block Representation)

블록 표현은 "attributes"와 "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": ,

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

함수 표현은 함수의 정의를 설명해요.

{
  // "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)

매개변수 표현은 함수의 매개변수를 설명해요.

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

더 알아보기 (Learn more)