Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the import_table block #120

Merged
merged 9 commits into from
Feb 14, 2024
Merged
26 changes: 26 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,32 @@ resource "aws_dynamodb_table" "default" {
}
}

dynamic "import_table" {
for_each = var.import_table != null ? [1] : []

content {
input_compression_type = var.import_table.input_compression_type
input_format = var.import_table.import_format

dynamic "input_format_options" {
for_each = lookup(var.import_table, "import_format_options", null) != null ? [1] : []

content {
csv {
delimiter = var.import_table.import_format_options.csv.delimiter
header_list = var.import_table.import_format_options.csv.header_list
}
}
}

s3_bucket_source {
bucket = var.import_table.s3_bucket_source.bucket
bucket_owner = var.import_table.s3_bucket_source.bucket_owner
key_prefix = var.import_table.s3_bucket_source.key_prefix
}
}
}

dynamic "local_secondary_index" {
for_each = var.local_secondary_index_map
content {
Expand Down
24 changes: 23 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,26 @@ variable "deletion_protection_enabled" {
type = bool
default = false
description = "Enable/disable DynamoDB table deletion protection"
}
}

variable "import_table" {
type = object({
# Valid values are GZIP, ZSTD and NONE
input_compression_type = optional(string, null)
# Valid values are CSV, DYNAMODB_JSON, and ION.
input_format = string
input_format_options = optional(object({
csv = object({
delimiter = string
header_list = list(string)
})
}), null)
s3_bucket_source = object({
bucket = string
bucket_owner = optional(string)
key_prefix = optional(string)
})
})
default = null
description = "Import Amazon S3 data into a new table."
}
Loading