Glue:Resource:aws_glue_classifier


类型

Resource

标签

aws_glue_classifier

AWS服务

Glue

说明

主要用于创建Glue分类器资源。分类器用于读取特定类型(csv、grok、JSON或XML)的文件,若需更改分类器类型将要重新创建分类器。

样例

CSV分类器

resource "aws_glue_classifier" "example" {
  name = "example"

  csv_classifier {
    allow_single_column    = false
    contains_header        = "PRESENT"
    delimiter              = ","
    disable_value_trimming = false
    header                 = ["example1", "example2"]
    quote_symbol           = "'"
  }
}

Grok分类器

resource "aws_glue_classifier" "example" {
  name = "example"

  grok_classifier {
    classification = "example"
    grok_pattern   = "example"
  }
}

JSON分类器

resource "aws_glue_classifier" "example" {
  name = "example"

  json_classifier {
    json_path = "example"
  }
}

XML分类器

resource "aws_glue_classifier" "example" {
  name = "example"

  xml_classifier {
    classification = "example"
    row_tag        = "example"
  }
}

参数(待翻译)

  • csv_classifier - (Optional) A classifier for Csv content. Defined below.
  • grok_classifier – (Optional) A classifier that uses grok patterns. Defined below.
  • json_classifier – (Optional) A classifier for JSON content. Defined below.
  • name – (Required) The name of the classifier.
  • xml_classifier – (Optional) A classifier for XML content. Defined below.

csv_classifier

  • allow_single_column - (Optional) Enables the processing of files that contain only one column.
  • contains_header - (Optional) Indicates whether the CSV file contains a header. This can be one of "ABSENT", "PRESENT", or "UNKNOWN".
  • delimiter - (Optional) The delimiter used in the Csv to separate columns.
  • disable_value_trimming - (Optional) Specifies whether to trim column values.
  • header - (Optional) A list of strings representing column names.quote_symbol - (Optional) A custom symbol to denote what combines content into a single column value. It must be different from the column delimiter.

grok_classifier

  • classification - (Required) An identifier of the data format that the classifier matches, such as Twitter, JSON, Omniture logs, Amazon CloudWatch Logs, and so on.
  • custom_patterns - (Optional) Custom grok patterns used by this classifier.
  • grok_pattern - (Required) The grok pattern used by this classifier

json_classifier

  • json_path - (Required) A JsonPath string defining the JSON data for the classifier to classify. AWS Glue supports a subset of JsonPath, as described in Writing JsonPath Custom Classifiers.

xml_classifier

  • classification - (Required) An identifier of the data format that the classifier matches.
  • row_tag - (Required) The XML tag designating the element that contains each record in an XML document being parsed. Note that this cannot identify a self-closing element (closed by />). An empty row element that contains only attributes can be parsed as long as it ends with a closing tag (for example, is okay, but is not).

属性引用

除上述所有参数外,还将访问该资源的以下属性:

id:分类器的名称

资源导入

替换如下命令行中的参数${name}并运行,可以导入Glue分类器

$ terraform import aws_glue_classifier.${name} ${name}