From abf19d6c613b09ecb1fd286676d2367e8403f136 Mon Sep 17 00:00:00 2001 From: The Magician Date: Mon, 17 Oct 2022 09:16:00 -0700 Subject: [PATCH] A topic's schema can't be changed after it's created. (#6697) (#12806) Signed-off-by: Modular Magician Signed-off-by: Modular Magician --- .changelog/6697.txt | 3 +++ google/resource_pubsub_topic.go | 2 ++ 2 files changed, 5 insertions(+) create mode 100644 .changelog/6697.txt diff --git a/.changelog/6697.txt b/.changelog/6697.txt new file mode 100644 index 00000000000..e37a44d1ee6 --- /dev/null +++ b/.changelog/6697.txt @@ -0,0 +1,3 @@ +```release-note:bug +pubsub: Ensured topics are recreated when their schemas change. +``` diff --git a/google/resource_pubsub_topic.go b/google/resource_pubsub_topic.go index 776ffc82102..95881f7bf99 100644 --- a/google/resource_pubsub_topic.go +++ b/google/resource_pubsub_topic.go @@ -112,6 +112,7 @@ and is not a valid configuration.`, "schema": { Type: schema.TypeString, Required: true, + ForceNew: true, Description: `The name of the schema that messages published should be validated against. Format is projects/{project}/schemas/{schema}. The value of this field will be _deleted-schema_ @@ -120,6 +121,7 @@ if the schema has been deleted.`, "encoding": { Type: schema.TypeString, Optional: true, + ForceNew: true, ValidateFunc: validateEnum([]string{"ENCODING_UNSPECIFIED", "JSON", "BINARY", ""}), Description: `The encoding of messages validated against schema. Default value: "ENCODING_UNSPECIFIED" Possible values: ["ENCODING_UNSPECIFIED", "JSON", "BINARY"]`, Default: "ENCODING_UNSPECIFIED",