diff --git a/.changelog/11038.txt b/.changelog/11038.txt new file mode 100644 index 00000000000..94e66dcafef --- /dev/null +++ b/.changelog/11038.txt @@ -0,0 +1,3 @@ +```release-note:breaking-change +pubsub: Allow `schema_settings` of `google_pubsub_topic` to be removed +``` \ No newline at end of file diff --git a/google/services/pubsub/resource_pubsub_topic.go b/google/services/pubsub/resource_pubsub_topic.go index b85fde5cff6..823ac047cd9 100644 --- a/google/services/pubsub/resource_pubsub_topic.go +++ b/google/services/pubsub/resource_pubsub_topic.go @@ -169,7 +169,6 @@ and is not a valid configuration.`, }, "schema_settings": { Type: schema.TypeList, - Computed: true, Optional: true, Description: `Settings for validating messages published against a schema.`, MaxItems: 1, diff --git a/google/services/pubsub/resource_pubsub_topic_test.go b/google/services/pubsub/resource_pubsub_topic_test.go index 9ec619ff1af..3eb2d601c98 100644 --- a/google/services/pubsub/resource_pubsub_topic_test.go +++ b/google/services/pubsub/resource_pubsub_topic_test.go @@ -95,6 +95,9 @@ func TestAccPubsubTopic_schema(t *testing.T) { { Config: testAccPubsubTopic_updateWithNewSchema(topic, schema2), }, + { + Config: testAccPubsubTopic_updateWithNewSchema(topic, ""), + }, { ResourceName: "google_pubsub_topic.bar", ImportStateId: topic, @@ -230,7 +233,8 @@ resource "google_pubsub_topic" "bar" { } func testAccPubsubTopic_updateWithNewSchema(topic, schema string) string { - return fmt.Sprintf(` + if schema != "" { + return fmt.Sprintf(` resource "google_pubsub_schema" "foo" { name = "%s" type = "PROTOCOL_BUFFER" @@ -245,6 +249,13 @@ resource "google_pubsub_topic" "bar" { } } `, schema, topic) + } else { + return fmt.Sprintf(` + resource "google_pubsub_topic" "bar" { + name = "%s" + } + `, topic) + } } func testAccPubsubTopic_updateWithKinesisIngestionSettings(topic string) string { diff --git a/website/docs/guides/version_6_upgrade.html.markdown b/website/docs/guides/version_6_upgrade.html.markdown index a32f7fa8fb5..641c2e5338e 100644 --- a/website/docs/guides/version_6_upgrade.html.markdown +++ b/website/docs/guides/version_6_upgrade.html.markdown @@ -113,3 +113,9 @@ Description of the change and how users should adjust their configuration (if ne ### `settings.ip_configuration.require_ssl` is now removed Removed in favor of field `settings.ip_configuration.ssl_mode`. + +## Resource: `google_pubsub_topic` + +### `schema_settings` no longer has a default value + +An empty value means the setting should be cleared. \ No newline at end of file