From b0a14bf85379ccf7a2ad555d5a053c053436c5a9 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Thu, 26 Oct 2023 12:52:10 -0400 Subject: [PATCH 1/7] add import functionality and examples --- README.md | 5 +- examples/s3_import/README.md | 64 ++++++++++++++++ examples/s3_import/files/sample.csv | 2 + examples/s3_import/files/sample.json | 5 ++ examples/s3_import/main.tf | 108 +++++++++++++++++++++++++++ examples/s3_import/outputs.tf | 39 ++++++++++ examples/s3_import/variables.tf | 0 examples/s3_import/versions.tf | 14 ++++ main.tf | 31 ++++++++ variables.tf | 6 ++ versions.tf | 2 +- wrappers/main.tf | 1 + 12 files changed, 274 insertions(+), 3 deletions(-) create mode 100644 examples/s3_import/README.md create mode 100644 examples/s3_import/files/sample.csv create mode 100644 examples/s3_import/files/sample.json create mode 100644 examples/s3_import/main.tf create mode 100644 examples/s3_import/outputs.tf create mode 100644 examples/s3_import/variables.tf create mode 100644 examples/s3_import/versions.tf diff --git a/README.md b/README.md index 64867d9..5676943 100644 --- a/README.md +++ b/README.md @@ -53,13 +53,13 @@ Users of Terragrunt can achieve similar results by using modules provided in the | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.59 | +| [aws](#requirement\_aws) | >= 5.21 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.59 | +| [aws](#provider\_aws) | >= 5.21 | ## Modules @@ -95,6 +95,7 @@ No modules. | [deletion\_protection\_enabled](#input\_deletion\_protection\_enabled) | Enables deletion protection for table | `bool` | `null` | no | | [global\_secondary\_indexes](#input\_global\_secondary\_indexes) | Describe a GSI for the table; subject to the normal limits on the number of GSIs, projected attributes, etc. | `any` | `[]` | no | | [hash\_key](#input\_hash\_key) | The attribute to use as the hash (partition) key. Must also be defined as an attribute | `string` | `null` | no | +| [import\_table](#input\_import\_table) | Configurations for importing s3 data into a new table. | `any` | `{}` | no | | [local\_secondary\_indexes](#input\_local\_secondary\_indexes) | Describe an LSI on the table; these can only be allocated at creation so you cannot change this definition after you have created the resource. | `any` | `[]` | no | | [name](#input\_name) | Name of the DynamoDB table | `string` | `null` | no | | [point\_in\_time\_recovery\_enabled](#input\_point\_in\_time\_recovery\_enabled) | Whether to enable point-in-time recovery | `bool` | `false` | no | diff --git a/examples/s3_import/README.md b/examples/s3_import/README.md new file mode 100644 index 0000000..f6d186d --- /dev/null +++ b/examples/s3_import/README.md @@ -0,0 +1,64 @@ +# DynamoDB Table s3 import example + +Configuration in this directory creates a Global AWS DynamoDB table with replicas in eu-west-1 and eu-west-2 regions. + +## Usage + +To run this example you need to execute: + +```bash +$ terraform init +$ terraform plan +$ terraform apply +``` + +Note that this example may create resources which can cost money (AWS Elastic IP, for example). Run `terraform destroy` when you don't need these resources. + + +## Requirements + +| Name | Version | +|------|---------| +| [terraform](#requirement\_terraform) | >= 1.0 | +| [aws](#requirement\_aws) | >= 5.21 | +| [random](#requirement\_random) | >= 2.0 | + +## Providers + +| Name | Version | +|------|---------| +| [random](#provider\_random) | >= 2.0 | + +## Modules + +| Name | Source | Version | +|------|--------|---------| +| [import\_csv\_table](#module\_import\_csv\_table) | ../../ | n/a | +| [import\_json\_table](#module\_import\_json\_table) | ../../ | n/a | +| [s3\_bucket](#module\_s3\_bucket) | terraform-aws-modules/s3-bucket/aws | ~> 3.15 | +| [s3\_import\_object\_csv](#module\_s3\_import\_object\_csv) | terraform-aws-modules/s3-bucket/aws//modules/object | ~> 3.15 | +| [s3\_import\_object\_json](#module\_s3\_import\_object\_json) | terraform-aws-modules/s3-bucket/aws//modules/object | ~> 3.15 | + +## Resources + +| Name | Type | +|------|------| +| [random_pet.this](https://registry.terraform.io/providers/hashicorp/random/latest/docs/resources/pet) | resource | + +## Inputs + +No inputs. + +## Outputs + +| Name | Description | +|------|-------------| +| [import\_csv\_table\_arn](#output\_import\_csv\_table\_arn) | ARN of the DynamoDB table | +| [import\_csv\_table\_id](#output\_import\_csv\_table\_id) | ID of the DynamoDB table | +| [import\_csv\_table\_stream\_arn](#output\_import\_csv\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true | +| [import\_csv\_table\_stream\_label](#output\_import\_csv\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true | +| [import\_json\_table\_arn](#output\_import\_json\_table\_arn) | ARN of the DynamoDB table | +| [import\_json\_table\_id](#output\_import\_json\_table\_id) | ID of the DynamoDB table | +| [import\_json\_table\_stream\_arn](#output\_import\_json\_table\_stream\_arn) | The ARN of the Table Stream. Only available when var.stream\_enabled is true | +| [import\_json\_table\_stream\_label](#output\_import\_json\_table\_stream\_label) | A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream\_enabled is true | + diff --git a/examples/s3_import/files/sample.csv b/examples/s3_import/files/sample.csv new file mode 100644 index 0000000..d874a89 --- /dev/null +++ b/examples/s3_import/files/sample.csv @@ -0,0 +1,2 @@ +id;title +02;csv diff --git a/examples/s3_import/files/sample.json b/examples/s3_import/files/sample.json new file mode 100644 index 0000000..bd08ecf --- /dev/null +++ b/examples/s3_import/files/sample.json @@ -0,0 +1,5 @@ +{"Item": +{ + "id":{"N":"01"}, + "title":{"S":"example1"} +}} diff --git a/examples/s3_import/main.tf b/examples/s3_import/main.tf new file mode 100644 index 0000000..e9590f8 --- /dev/null +++ b/examples/s3_import/main.tf @@ -0,0 +1,108 @@ +provider "aws" { + region = "eu-west-1" + shared_credentials_files = ["~/.aws/credentials"] +} + +resource "random_pet" "this" { + length = 2 +} + +module "import_json_table" { + source = "../../" + + name = "import-json-${random_pet.this.id}" + hash_key = "id" + range_key = "title" + table_class = "STANDARD" + deletion_protection_enabled = false + + attributes = [ + { + name = "id" + type = "N" + }, + { + name = "title" + type = "S" + }, + ] + + import_table = { + input_format = "DYNAMODB_JSON" + input_compression_type = "NONE" + bucket = module.s3_bucket.s3_bucket_id + key_prefix = "import-json-${random_pet.this.id}" + } + + tags = { + Terraform = "true" + Environment = "staging" + } +} + +module "import_csv_table" { + source = "../../" + + name = "import-csv-${random_pet.this.id}" + hash_key = "id" + range_key = "title" + table_class = "STANDARD" + deletion_protection_enabled = false + + attributes = [ + { + name = "id" + type = "N" + }, + { + name = "title" + type = "S" + }, + ] + + import_table = { + input_format = "CSV" + input_compression_type = "NONE" + bucket = module.s3_bucket.s3_bucket_id + key_prefix = "import-csv-${random_pet.this.id}" + input_format_options = { + csv = { + delimiter = ";" + } + } + } + + tags = { + Terraform = "true" + Environment = "staging" + } +} + +module "s3_bucket" { + source = "terraform-aws-modules/s3-bucket/aws" + version = "~> 3.15" + + bucket = "import-example-${random_pet.this.id}" + + force_destroy = true +} + +module "s3_import_object_json" { + source = "terraform-aws-modules/s3-bucket/aws//modules/object" + version = "~> 3.15" + + bucket = module.s3_bucket.s3_bucket_id + key = "import-json-${random_pet.this.id}/sample.json" + + content_base64 = filebase64("./files/sample.json") +} + +module "s3_import_object_csv" { + source = "terraform-aws-modules/s3-bucket/aws//modules/object" + version = "~> 3.15" + + bucket = module.s3_bucket.s3_bucket_id + key = "import-csv-${random_pet.this.id}/sample.csv" + + content_base64 = filebase64("./files/sample.csv") +} diff --git a/examples/s3_import/outputs.tf b/examples/s3_import/outputs.tf new file mode 100644 index 0000000..e826e9e --- /dev/null +++ b/examples/s3_import/outputs.tf @@ -0,0 +1,39 @@ +output "import_json_table_arn" { + description = "ARN of the DynamoDB table" + value = module.import_json_table.dynamodb_table_arn +} + +output "import_json_table_id" { + description = "ID of the DynamoDB table" + value = module.import_json_table.dynamodb_table_id +} + +output "import_json_table_stream_arn" { + description = "The ARN of the Table Stream. Only available when var.stream_enabled is true" + value = module.import_json_table.dynamodb_table_stream_arn +} + +output "import_json_table_stream_label" { + description = "A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream_enabled is true" + value = module.import_json_table.dynamodb_table_stream_label +} + +output "import_csv_table_arn" { + description = "ARN of the DynamoDB table" + value = module.import_csv_table.dynamodb_table_arn +} + +output "import_csv_table_id" { + description = "ID of the DynamoDB table" + value = module.import_csv_table.dynamodb_table_id +} + +output "import_csv_table_stream_arn" { + description = "The ARN of the Table Stream. Only available when var.stream_enabled is true" + value = module.import_csv_table.dynamodb_table_stream_arn +} + +output "import_csv_table_stream_label" { + description = "A timestamp, in ISO 8601 format of the Table Stream. Only available when var.stream_enabled is true" + value = module.import_csv_table.dynamodb_table_stream_label +} diff --git a/examples/s3_import/variables.tf b/examples/s3_import/variables.tf new file mode 100644 index 0000000..e69de29 diff --git a/examples/s3_import/versions.tf b/examples/s3_import/versions.tf new file mode 100644 index 0000000..d17ac73 --- /dev/null +++ b/examples/s3_import/versions.tf @@ -0,0 +1,14 @@ +terraform { + required_version = ">= 1.0" + + required_providers { + aws = { + source = "hashicorp/aws" + version = ">= 5.21" + } + random = { + source = "hashicorp/random" + version = ">= 2.0" + } + } +} diff --git a/main.tf b/main.tf index e622b25..9798f3f 100644 --- a/main.tf +++ b/main.tf @@ -71,6 +71,37 @@ resource "aws_dynamodb_table" "this" { kms_key_arn = var.server_side_encryption_kms_key_arn } + dynamic "import_table" { + for_each = length(var.import_table) > 0 ? [var.import_table] : [] + + content { + input_format = import_table.value.input_format + input_compression_type = try(import_table.value.input_compression_type, null) + + dynamic "input_format_options" { + for_each = import_table.value.input_format == "CSV" ? try([import_table.value.input_format_options], []) : [] + + content { + + dynamic "csv" { + for_each = try([input_format_options.value.csv], []) + + content { + delimiter = try(csv.value.delimiter, null) + header_list = try(csv.value.header_list, null) + } + } + } + } + + s3_bucket_source { + bucket = import_table.value.bucket + bucket_owner = try(import_table.value.bucket_owner, null) + key_prefix = try(import_table.value.key_prefix, null) + } + } + } + tags = merge( var.tags, { diff --git a/variables.tf b/variables.tf index a633d9e..149c7b1 100644 --- a/variables.tf +++ b/variables.tf @@ -167,3 +167,9 @@ variable "deletion_protection_enabled" { type = bool default = null } + +variable "import_table" { + description = "Configurations for importing s3 data into a new table." + type = any + default = {} +} diff --git a/versions.tf b/versions.tf index 33eb30c..5cdb3d4 100644 --- a/versions.tf +++ b/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.59" + version = ">= 5.21" } } } diff --git a/wrappers/main.tf b/wrappers/main.tf index 5c7996d..b6fe7ff 100644 --- a/wrappers/main.tf +++ b/wrappers/main.tf @@ -38,4 +38,5 @@ module "wrapper" { autoscaling_indexes = try(each.value.autoscaling_indexes, var.defaults.autoscaling_indexes, {}) table_class = try(each.value.table_class, var.defaults.table_class, null) deletion_protection_enabled = try(each.value.deletion_protection_enabled, var.defaults.deletion_protection_enabled, null) + import_table = try(each.value.import_table, var.defaults.import_table, {}) } From ddfa46b7ef3b54ed1a36127917a4a049a5a600ab Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Thu, 26 Oct 2023 15:38:19 -0400 Subject: [PATCH 2/7] update example files --- examples/s3_import/files/sample.csv | 1 + examples/s3_import/files/sample.json | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/examples/s3_import/files/sample.csv b/examples/s3_import/files/sample.csv index d874a89..822a6ec 100644 --- a/examples/s3_import/files/sample.csv +++ b/examples/s3_import/files/sample.csv @@ -1,2 +1,3 @@ id;title 02;csv +03;csvtest diff --git a/examples/s3_import/files/sample.json b/examples/s3_import/files/sample.json index bd08ecf..9082164 100644 --- a/examples/s3_import/files/sample.json +++ b/examples/s3_import/files/sample.json @@ -3,3 +3,9 @@ "id":{"N":"01"}, "title":{"S":"example1"} }} + +{"Item": +{ + "id":{"N":"02"}, + "title":{"S":"example2"} +}} From 2a773b81fa6528d11e856972c1ad4149a1e59e01 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Thu, 26 Oct 2023 15:44:48 -0400 Subject: [PATCH 3/7] remove configuration --- examples/s3_import/main.tf | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/s3_import/main.tf b/examples/s3_import/main.tf index e9590f8..7228abc 100644 --- a/examples/s3_import/main.tf +++ b/examples/s3_import/main.tf @@ -1,6 +1,5 @@ provider "aws" { - region = "eu-west-1" - shared_credentials_files = ["~/.aws/credentials"] + region = "eu-west-1" } resource "random_pet" "this" { From 1923fb450455731bdcb4a6682fdbf3909c0d4c9c Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Thu, 26 Oct 2023 16:42:42 -0400 Subject: [PATCH 4/7] v5 upgrade --- examples/autoscaling/README.md | 2 +- examples/autoscaling/versions.tf | 2 +- examples/basic/README.md | 2 +- examples/basic/versions.tf | 2 +- examples/global-tables/README.md | 6 +++--- examples/global-tables/versions.tf | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/examples/autoscaling/README.md b/examples/autoscaling/README.md index 38b33bf..f19f35e 100644 --- a/examples/autoscaling/README.md +++ b/examples/autoscaling/README.md @@ -20,7 +20,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 3.69 | +| [aws](#requirement\_aws) | >= 5.21 | | [random](#requirement\_random) | >= 2.0 | ## Providers diff --git a/examples/autoscaling/versions.tf b/examples/autoscaling/versions.tf index 8d7f35e..d17ac73 100644 --- a/examples/autoscaling/versions.tf +++ b/examples/autoscaling/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 3.69" + version = ">= 5.21" } random = { source = "hashicorp/random" diff --git a/examples/basic/README.md b/examples/basic/README.md index caf8131..0c7c94c 100644 --- a/examples/basic/README.md +++ b/examples/basic/README.md @@ -20,7 +20,7 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 3.69 | +| [aws](#requirement\_aws) | >= 5.21 | | [random](#requirement\_random) | >= 2.0 | ## Providers diff --git a/examples/basic/versions.tf b/examples/basic/versions.tf index 8d7f35e..d17ac73 100644 --- a/examples/basic/versions.tf +++ b/examples/basic/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 3.69" + version = ">= 5.21" } random = { source = "hashicorp/random" diff --git a/examples/global-tables/README.md b/examples/global-tables/README.md index 94d7af6..9a3e348 100644 --- a/examples/global-tables/README.md +++ b/examples/global-tables/README.md @@ -20,15 +20,15 @@ Note that this example may create resources which can cost money (AWS Elastic IP | Name | Version | |------|---------| | [terraform](#requirement\_terraform) | >= 1.0 | -| [aws](#requirement\_aws) | >= 4.23 | +| [aws](#requirement\_aws) | >= 5.21 | | [random](#requirement\_random) | >= 2.0 | ## Providers | Name | Version | |------|---------| -| [aws](#provider\_aws) | >= 4.23 | -| [aws.euwest2](#provider\_aws.euwest2) | >= 4.23 | +| [aws](#provider\_aws) | >= 5.21 | +| [aws.euwest2](#provider\_aws.euwest2) | >= 5.21 | | [random](#provider\_random) | >= 2.0 | ## Modules diff --git a/examples/global-tables/versions.tf b/examples/global-tables/versions.tf index d2bf143..d17ac73 100644 --- a/examples/global-tables/versions.tf +++ b/examples/global-tables/versions.tf @@ -4,7 +4,7 @@ terraform { required_providers { aws = { source = "hashicorp/aws" - version = ">= 4.23" + version = ">= 5.21" } random = { source = "hashicorp/random" From 30a1a1b60b12cbea2d3a9f0aad7ff678ff298fdf Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Thu, 26 Oct 2023 19:04:18 -0400 Subject: [PATCH 5/7] fix readme --- examples/s3_import/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/s3_import/README.md b/examples/s3_import/README.md index f6d186d..55f7562 100644 --- a/examples/s3_import/README.md +++ b/examples/s3_import/README.md @@ -1,6 +1,6 @@ # DynamoDB Table s3 import example -Configuration in this directory creates a Global AWS DynamoDB table with replicas in eu-west-1 and eu-west-2 regions. +Configuration in this directory creates an AWS DynamoDB table created from s3 imports (both json and csv examples). ## Usage From 20994eb2a02836bb59388ebbb7a089e73e4e24c2 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Thu, 26 Oct 2023 19:39:29 -0400 Subject: [PATCH 6/7] add import_table configs to autoscaled resource --- main.tf | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/main.tf b/main.tf index 9798f3f..3d04715 100644 --- a/main.tf +++ b/main.tf @@ -189,6 +189,37 @@ resource "aws_dynamodb_table" "autoscaled" { kms_key_arn = var.server_side_encryption_kms_key_arn } + dynamic "import_table" { + for_each = length(var.import_table) > 0 ? [var.import_table] : [] + + content { + input_format = import_table.value.input_format + input_compression_type = try(import_table.value.input_compression_type, null) + + dynamic "input_format_options" { + for_each = import_table.value.input_format == "CSV" ? try([import_table.value.input_format_options], []) : [] + + content { + + dynamic "csv" { + for_each = try([input_format_options.value.csv], []) + + content { + delimiter = try(csv.value.delimiter, null) + header_list = try(csv.value.header_list, null) + } + } + } + } + + s3_bucket_source { + bucket = import_table.value.bucket + bucket_owner = try(import_table.value.bucket_owner, null) + key_prefix = try(import_table.value.key_prefix, null) + } + } + } + tags = merge( var.tags, { From 4568a662a8fcdd683093e27602aaaa44d84ca522 Mon Sep 17 00:00:00 2001 From: magreenbaum Date: Fri, 27 Oct 2023 09:57:44 -0400 Subject: [PATCH 7/7] feedback changes --- README.md | 1 + examples/{s3_import => s3-import}/README.md | 0 examples/{s3_import => s3-import}/files/sample.csv | 0 examples/{s3_import => s3-import}/files/sample.json | 0 examples/{s3_import => s3-import}/main.tf | 0 examples/{s3_import => s3-import}/outputs.tf | 0 examples/{s3_import => s3-import}/variables.tf | 0 examples/{s3_import => s3-import}/versions.tf | 0 main.tf | 4 ++-- 9 files changed, 3 insertions(+), 2 deletions(-) rename examples/{s3_import => s3-import}/README.md (100%) rename examples/{s3_import => s3-import}/files/sample.csv (100%) rename examples/{s3_import => s3-import}/files/sample.json (100%) rename examples/{s3_import => s3-import}/main.tf (100%) rename examples/{s3_import => s3-import}/outputs.tf (100%) rename examples/{s3_import => s3-import}/variables.tf (100%) rename examples/{s3_import => s3-import}/versions.tf (100%) diff --git a/README.md b/README.md index 1210f74..9af3248 100644 --- a/README.md +++ b/README.md @@ -53,6 +53,7 @@ Users of Terragrunt can achieve similar results by using modules provided in the - [Basic example](https://github.com/terraform-aws-modules/terraform-aws-dynamodb-table/tree/master/examples/basic) - [Autoscaling example](https://github.com/terraform-aws-modules/terraform-aws-dynamodb-table/tree/master/examples/autoscaling) - [Global tables example](https://github.com/terraform-aws-modules/terraform-aws-dynamodb-table/tree/master/examples/global-tables) +- [S3 import examples](https://github.com/terraform-aws-modules/terraform-aws-dynamodb-table/tree/master/examples/s3-import) ## Requirements diff --git a/examples/s3_import/README.md b/examples/s3-import/README.md similarity index 100% rename from examples/s3_import/README.md rename to examples/s3-import/README.md diff --git a/examples/s3_import/files/sample.csv b/examples/s3-import/files/sample.csv similarity index 100% rename from examples/s3_import/files/sample.csv rename to examples/s3-import/files/sample.csv diff --git a/examples/s3_import/files/sample.json b/examples/s3-import/files/sample.json similarity index 100% rename from examples/s3_import/files/sample.json rename to examples/s3-import/files/sample.json diff --git a/examples/s3_import/main.tf b/examples/s3-import/main.tf similarity index 100% rename from examples/s3_import/main.tf rename to examples/s3-import/main.tf diff --git a/examples/s3_import/outputs.tf b/examples/s3-import/outputs.tf similarity index 100% rename from examples/s3_import/outputs.tf rename to examples/s3-import/outputs.tf diff --git a/examples/s3_import/variables.tf b/examples/s3-import/variables.tf similarity index 100% rename from examples/s3_import/variables.tf rename to examples/s3-import/variables.tf diff --git a/examples/s3_import/versions.tf b/examples/s3-import/versions.tf similarity index 100% rename from examples/s3_import/versions.tf rename to examples/s3-import/versions.tf diff --git a/main.tf b/main.tf index 7ed6ee9..8364a4f 100644 --- a/main.tf +++ b/main.tf @@ -79,7 +79,7 @@ resource "aws_dynamodb_table" "this" { input_compression_type = try(import_table.value.input_compression_type, null) dynamic "input_format_options" { - for_each = import_table.value.input_format == "CSV" ? try([import_table.value.input_format_options], []) : [] + for_each = try([import_table.value.input_format_options], []) content { @@ -197,7 +197,7 @@ resource "aws_dynamodb_table" "autoscaled" { input_compression_type = try(import_table.value.input_compression_type, null) dynamic "input_format_options" { - for_each = import_table.value.input_format == "CSV" ? try([import_table.value.input_format_options], []) : [] + for_each = try([import_table.value.input_format_options], []) content {