Skip to content

Bug: materialize_source_kafka allows incompatible format and key_format options #654

@bobbyiliev

Description

@bobbyiliev

What version of the Materialize Terraform provider are you using?

v0.8.8

What version of the Terraform CLI are you using?

v1.9.5

What version of Materialize are you using?

v0.117.0

What is the issue?

@sthm noticed that the Terraform provider allows you to specify format and ket_format options which are incompatible:

image

This results in the following error:

│ Error: ERROR: Expected end of statement, found KEY (SQLSTATE 42601)

To reproduce:

resource "materialize_source_kafka" "json_source" {
  name         = "avro_source"
  topic        = confluent_kafka_topic.topic.topic_name
  schema_name  = materialize_schema.public.name
  cluster_name = materialize_cluster.default.name
  kafka_connection {
    schema_name = materialize_schema.public.name
    name        = materialize_connection_kafka.confluent_cloud.name
  }
  format {
    json = true
  }
  key_format {
    json = true
  }
  envelope {
    upsert = true
  }
  include_key = true
}

We should extend the schema for the Kafka source and include a ConflictsWith for the format attribute so that it can not be used together with the key_format and value_format attributes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions