Slide 21
Slide 21 text
© GENDA Inc.
Terraformによるメタデータ管理
locals {
table_files = fileset("${path.module}/tables", "*.yaml")
tables = { for file in local.table_files : replace(file, ".yaml", "") => yamldecode(file("${path.module}/tables/${file}")) }
}
resource "snowflake_table" "tables" {
for_each = local.tables
database = "DEV_YAMAGUCHI"
schema = "TEST"
name = each.value.name
comment = each.value.comment
dynamic "column" {
for_each = each.value.columns
content {
name = column.value.name
type = column.value.type
comment = column.value.comment
nullable = column.value.nullable
}
}
}
【tables.tf】
tablesディレクトリ内のyamlファイルをループ処理で読み込む