Pubusub commit schema revisions

Hello folks,
Thanks for looking into this. I am not sure if I followed anywhere in provided docs (4.69.1) on how actually to implement this in terraform - committing new schema revisions without destroying and creating a new pubsub topic.

https://registry.terraform.io/providers/hashicorp/google/latest/docs/resources/pubsub_schema

  • Have you tried just making changes?
  • Did it work?
  • If not, how did it fail?

So I believe it worked, just updating the test-topic.proto (proto file) and running terraform apply on the target did commit a new schema revision but it deleted the previous revisions and the corresponding topic so I had to recreate the topic after creating the new schema. I was wondering if you could actually commit a revision without deleting the older revisions/topics.

Summary

module “test-topic” {
source = “…/modules/pubsub_topic”
project = var.project
schema_file = “./schema/test-topic.proto”
schema_name = “test-topic-v6”
topic_name = “test-topic-v6”
}

resource “google_pubsub_schema” “schema” {
project = var.project
name = var.topic_name
type = “PROTOCOL_BUFFER”
definition = file(var.schema_file)
}

resource “google_pubsub_topic” “topic” {
project = var.project
name = var.topic_name
depends_on = [google_pubsub_schema.schema]
schema_settings {
schema = “projects/{var.project}/schemas/{var.schema_name}”
encoding = var.schema_encoding
}
}