generated from champ-oss/terraform-module-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
glue.tf
44 lines (38 loc) · 1.28 KB
/
glue.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
resource "aws_glue_catalog_database" "this" {
name = module.s3.bucket
}
resource "aws_glue_catalog_table" "this" {
name = module.s3.bucket
database_name = aws_glue_catalog_database.this.name
table_type = "EXTERNAL_TABLE"
parameters = {
"classification" = "json"
"projection.datehour.format" = "yyyy/MM/dd/HH"
"projection.datehour.interval" = "1"
"projection.datehour.interval.unit" = "HOURS"
"projection.datehour.range" = "2020/01/01/00,NOW"
"projection.datehour.type" = "date"
"projection.enabled" = "true"
"storage.location.template" = "s3://${module.s3.bucket}/${var.prefix}/$${datehour}/"
}
partition_keys {
name = "datehour"
type = "string"
}
storage_descriptor {
input_format = "org.apache.hadoop.mapred.TextInputFormat"
output_format = "org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat"
location = "s3://${module.s3.bucket}/${var.prefix}/"
ser_de_info {
name = "JsonSerDe"
serialization_library = "org.openx.data.jsonserde.JsonSerDe"
}
dynamic "columns" {
for_each = var.table_string_columns
content {
name = columns.value
type = "string"
}
}
}
}