Skip to content

Commit

Permalink
fix: Allow Pub/Sub Topic update to remove schema settings (#11038) (#…
Browse files Browse the repository at this point in the history
…18631)

[upstream:0c8818e960cc3711b491bcb535ab0cf8ee7e0531]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Jul 2, 2024
1 parent 64dff2f commit 495d4b0
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/11038.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:breaking-change
pubsub: Allow `schema_settings` of `google_pubsub_topic` to be removed
```
1 change: 0 additions & 1 deletion google/services/pubsub/resource_pubsub_topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
13 changes: 12 additions & 1 deletion google/services/pubsub/resource_pubsub_topic_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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"
Expand All @@ -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 {
Expand Down
6 changes: 6 additions & 0 deletions website/docs/guides/version_6_upgrade.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -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.

0 comments on commit 495d4b0

Please sign in to comment.