Hi,
I am trying to use terraform to create a AWS Glue Schema Registry and add some Schemas to it.
Part of the schemas I want to push to my registry is a sequence of 4 schemas: event-v1.avsc, event-v2.avsc, event-v3.avsc, event-v4.avsc
(same schema but with some version bumps; differences between these 4 versions is a new optional property added every version bump…)
Below is how I load my schemas in my .tf terraform file:
resource "aws_glue_schema" "schemas" {
for_each = fileset("${path.module}/${var.avro_path}", "**/*.avsc")
schema_name = jsondecode(file("${path.module}/${var.avro_path}/${each.value}")).name
registry_arn = aws_glue_registry.myRegistry.arn
data_format = "AVRO"
compatibility = "FULL_ALL"
schema_definition = file("${path.module}/${var.avro_path}/${each.value}")
}
With this 4 schemas usecase, when I “terraform apply”, I get 3 times:
"error creating Glue Schema: AlreadyExistsException: Schema already exists."
(it makes sense that only one get created…)
But now, what is the proper way to first create the initial schema event-v1.avsc
and then update this schema to event-v2.avsc
, event-v3.avsc
, event-v4.avsc
?..
Thanks