diff --git a/docs/resources/source_table_kafka.md b/docs/resources/source_table_kafka.md index 63cc3081..806dc7ba 100644 --- a/docs/resources/source_table_kafka.md +++ b/docs/resources/source_table_kafka.md @@ -10,7 +10,56 @@ description: |- A Kafka source describes a Kafka cluster you want Materialize to read data from. - +## Example Usage + +```terraform +resource "materialize_source_table_kafka" "kafka_source_table" { + name = "kafka_source_table" + schema_name = "public" + database_name = "materialize" + + source { + name = materialize_source_kafka.test_source_kafka.name + schema_name = materialize_source_kafka.test_source_kafka.schema_name + database_name = materialize_source_kafka.test_source_kafka.database_name + } + + upstream_name = "terraform" # The kafka source topic name + include_key = true + include_key_alias = "message_key" + include_headers = true + include_headers_alias = "message_headers" + include_partition = true + include_partition_alias = "message_partition" + include_offset = true + include_offset_alias = "message_offset" + include_timestamp = true + include_timestamp_alias = "message_timestamp" + + + key_format { + text = true + } + value_format { + json = true + } + + envelope { + upsert = true + upsert_options { + value_decoding_errors { + inline { + enabled = true + alias = "decoding_error" + } + } + } + } + + ownership_role = "mz_system" + comment = "This is a test Kafka source table" +} +``` ## Schema @@ -320,3 +369,15 @@ Optional: - `database_name` (String) The schema_registry_connection database name. Defaults to `MZ_DATABASE` environment variable if set or `materialize` if environment variable is not set. - `schema_name` (String) The schema_registry_connection schema name. Defaults to `public`. + +## Import + +Import is supported using the following syntax: + +```shell +# Source tables can be imported using the source table id: +terraform import materialize_source_table_kafka.example_source_table_kafka : + +# Source id and information be found in the `mz_catalog.mz_tables` table +# The region is the region where the database is located (e.g. aws/us-east-1) +``` diff --git a/docs/resources/source_table_load_generator.md b/docs/resources/source_table_load_generator.md index a8f1770e..aba578f2 100644 --- a/docs/resources/source_table_load_generator.md +++ b/docs/resources/source_table_load_generator.md @@ -70,8 +70,8 @@ Optional: Import is supported using the following syntax: ```shell -# Source tables can be imported using the source id: -terraform import materialize_source_table_load_generator.example_source_table_loadgen : +# Source tables can be imported using the source table id: +terraform import materialize_source_table_load_generator.example_source_table_loadgen : # Source id and information be found in the `mz_catalog.mz_tables` table # The region is the region where the database is located (e.g. aws/us-east-1) diff --git a/docs/resources/source_table_mysql.md b/docs/resources/source_table_mysql.md index 3ac79870..193204f8 100644 --- a/docs/resources/source_table_mysql.md +++ b/docs/resources/source_table_mysql.md @@ -77,8 +77,8 @@ Optional: Import is supported using the following syntax: ```shell -# Source tables can be imported using the source id: -terraform import materialize_source_table_mysql.example_source_table_mysql : +# Source tables can be imported using the source table id: +terraform import materialize_source_table_mysql.example_source_table_mysql : # Source id and information be found in the `mz_catalog.mz_tables` table # The region is the region where the database is located (e.g. aws/us-east-1) diff --git a/docs/resources/source_table_postgres.md b/docs/resources/source_table_postgres.md index 8eebc851..53ba1334 100644 --- a/docs/resources/source_table_postgres.md +++ b/docs/resources/source_table_postgres.md @@ -75,8 +75,8 @@ Optional: Import is supported using the following syntax: ```shell -# Source tables can be imported using the source id: -terraform import materialize_source_table_postgres.example_source_table_postgres : +# Source tables can be imported using the source table id: +terraform import materialize_source_table_postgres.example_source_table_postgres : # Source id and information be found in the `mz_catalog.mz_tables` table # The region is the region where the database is located (e.g. aws/us-east-1) diff --git a/examples/resources/materialize_source_table_kafka/import.sh b/examples/resources/materialize_source_table_kafka/import.sh new file mode 100644 index 00000000..b4d52540 --- /dev/null +++ b/examples/resources/materialize_source_table_kafka/import.sh @@ -0,0 +1,5 @@ +# Source tables can be imported using the source table id: +terraform import materialize_source_table_kafka.example_source_table_kafka : + +# Source id and information be found in the `mz_catalog.mz_tables` table +# The region is the region where the database is located (e.g. aws/us-east-1) diff --git a/examples/resources/materialize_source_table_kafka/resource.tf b/examples/resources/materialize_source_table_kafka/resource.tf new file mode 100644 index 00000000..2aede69c --- /dev/null +++ b/examples/resources/materialize_source_table_kafka/resource.tf @@ -0,0 +1,46 @@ +resource "materialize_source_table_kafka" "kafka_source_table" { + name = "kafka_source_table" + schema_name = "public" + database_name = "materialize" + + source { + name = materialize_source_kafka.test_source_kafka.name + schema_name = materialize_source_kafka.test_source_kafka.schema_name + database_name = materialize_source_kafka.test_source_kafka.database_name + } + + upstream_name = "terraform" # The kafka source topic name + include_key = true + include_key_alias = "message_key" + include_headers = true + include_headers_alias = "message_headers" + include_partition = true + include_partition_alias = "message_partition" + include_offset = true + include_offset_alias = "message_offset" + include_timestamp = true + include_timestamp_alias = "message_timestamp" + + + key_format { + text = true + } + value_format { + json = true + } + + envelope { + upsert = true + upsert_options { + value_decoding_errors { + inline { + enabled = true + alias = "decoding_error" + } + } + } + } + + ownership_role = "mz_system" + comment = "This is a test Kafka source table" +} diff --git a/examples/resources/materialize_source_table_load_generator/import.sh b/examples/resources/materialize_source_table_load_generator/import.sh index 50e09749..c673df14 100644 --- a/examples/resources/materialize_source_table_load_generator/import.sh +++ b/examples/resources/materialize_source_table_load_generator/import.sh @@ -1,5 +1,5 @@ -# Source tables can be imported using the source id: -terraform import materialize_source_table_load_generator.example_source_table_loadgen : +# Source tables can be imported using the source table id: +terraform import materialize_source_table_load_generator.example_source_table_loadgen : # Source id and information be found in the `mz_catalog.mz_tables` table # The region is the region where the database is located (e.g. aws/us-east-1) diff --git a/examples/resources/materialize_source_table_mysql/import.sh b/examples/resources/materialize_source_table_mysql/import.sh index 4ed92a32..1d910379 100644 --- a/examples/resources/materialize_source_table_mysql/import.sh +++ b/examples/resources/materialize_source_table_mysql/import.sh @@ -1,5 +1,5 @@ -# Source tables can be imported using the source id: -terraform import materialize_source_table_mysql.example_source_table_mysql : +# Source tables can be imported using the source table id: +terraform import materialize_source_table_mysql.example_source_table_mysql : # Source id and information be found in the `mz_catalog.mz_tables` table # The region is the region where the database is located (e.g. aws/us-east-1) diff --git a/examples/resources/materialize_source_table_postgres/import.sh b/examples/resources/materialize_source_table_postgres/import.sh index 1580dd37..91e794a4 100644 --- a/examples/resources/materialize_source_table_postgres/import.sh +++ b/examples/resources/materialize_source_table_postgres/import.sh @@ -1,5 +1,5 @@ -# Source tables can be imported using the source id: -terraform import materialize_source_table_postgres.example_source_table_postgres : +# Source tables can be imported using the source table id: +terraform import materialize_source_table_postgres.example_source_table_postgres : # Source id and information be found in the `mz_catalog.mz_tables` table # The region is the region where the database is located (e.g. aws/us-east-1)