From 5fe31d4861b40597fd72f6fb87f8c7427c06450b Mon Sep 17 00:00:00 2001 From: dstrates <99311378+dstrates@users.noreply.github.com> Date: Tue, 27 Aug 2024 10:11:58 +1000 Subject: [PATCH] fix: resolve schema normalization (#43) --- README.md | 6 +- .../schemaregistry_schema/resource.tf | 42 ++++++++++++-- internal/provider/data_source_schema.go | 16 +----- internal/provider/data_source_schema_test.go | 22 +++++-- internal/provider/provider_test.go | 3 +- internal/provider/resource_schema.go | 54 +++--------------- internal/provider/resource_schema_test.go | 57 +++++++++++++------ internal/provider/utils.go | 51 +++++++---------- 8 files changed, 129 insertions(+), 122 deletions(-) diff --git a/README.md b/README.md index 7c40104..205ccd6 100644 --- a/README.md +++ b/README.md @@ -24,9 +24,7 @@ If you want to build the provider from source, follow these steps: ## Testing the Provider The acceptance tests rely on [Testcontainers for Go (Redpanda)](https://golang.testcontainers.org/modules/redpanda/) to -provide a Schema Registry API. - -This has some limitations: +provide a Schema Registry API. This has some limitations: - Redpanda only supports `AVRO` and `PROTOBUF` encoding, cannot test `JSON` schemas [[1]](https://github.com/redpanda-data/redpanda/issues/6220) @@ -42,7 +40,7 @@ terraform { required_providers { schemaregistry = { source = "cultureamp/schemaregistry" - version = "1.1.0" + version = "1.2.1" } } } diff --git a/examples/resources/schemaregistry_schema/resource.tf b/examples/resources/schemaregistry_schema/resource.tf index 1f47aad..0bcfdb6 100644 --- a/examples/resources/schemaregistry_schema/resource.tf +++ b/examples/resources/schemaregistry_schema/resource.tf @@ -1,7 +1,41 @@ -resource "schemaregistry_schema" "example" { - subject = "example-subject" - schema = "{\"type\":\"record\",\"name\":\"Test\",\"fields\":[{\"name\":\"f1\",\"type\":\"string\"}]}" +resource "schemaregistry_schema" "ref_01" { + subject = "%s" schema_type = "AVRO" - compatibility_level = "FORWARD_TRANSITIVE" + compatibility_level = "NONE" + schema = <