Skip to content

Commit 42927d0

Browse files
fix: Allow Pub/Sub Topic update to remove schema settings (#11038) (#7674)
[upstream:0c8818e960cc3711b491bcb535ab0cf8ee7e0531] Signed-off-by: Modular Magician <[email protected]>
1 parent fa24f23 commit 42927d0

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

.changelog/11038.txt

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:breaking-change
2+
pubsub: Allow `schema_settings` of `google_pubsub_topic` to be removed
3+
```

google-beta/services/pubsub/resource_pubsub_topic.go

-1
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ and is not a valid configuration.`,
169169
},
170170
"schema_settings": {
171171
Type: schema.TypeList,
172-
Computed: true,
173172
Optional: true,
174173
Description: `Settings for validating messages published against a schema.`,
175174
MaxItems: 1,

google-beta/services/pubsub/resource_pubsub_topic_test.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ func TestAccPubsubTopic_schema(t *testing.T) {
9595
{
9696
Config: testAccPubsubTopic_updateWithNewSchema(topic, schema2),
9797
},
98+
{
99+
Config: testAccPubsubTopic_updateWithNewSchema(topic, ""),
100+
},
98101
{
99102
ResourceName: "google_pubsub_topic.bar",
100103
ImportStateId: topic,
@@ -230,7 +233,8 @@ resource "google_pubsub_topic" "bar" {
230233
}
231234

232235
func testAccPubsubTopic_updateWithNewSchema(topic, schema string) string {
233-
return fmt.Sprintf(`
236+
if schema != "" {
237+
return fmt.Sprintf(`
234238
resource "google_pubsub_schema" "foo" {
235239
name = "%s"
236240
type = "PROTOCOL_BUFFER"
@@ -245,6 +249,13 @@ resource "google_pubsub_topic" "bar" {
245249
}
246250
}
247251
`, schema, topic)
252+
} else {
253+
return fmt.Sprintf(`
254+
resource "google_pubsub_topic" "bar" {
255+
name = "%s"
256+
}
257+
`, topic)
258+
}
248259
}
249260

250261
func testAccPubsubTopic_updateWithKinesisIngestionSettings(topic string) string {

website/docs/guides/version_6_upgrade.html.markdown

+6
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,9 @@ Description of the change and how users should adjust their configuration (if ne
113113
### `settings.ip_configuration.require_ssl` is now removed
114114

115115
Removed in favor of field `settings.ip_configuration.ssl_mode`.
116+
117+
## Resource: `google_pubsub_topic`
118+
119+
### `schema_settings` no longer has a default value
120+
121+
An empty value means the setting should be cleared.

0 commit comments

Comments
 (0)