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
  • Loading branch information
kamalaboulhosn authored Jul 2, 2024
1 parent a8fd825 commit 0c8818e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
1 change: 0 additions & 1 deletion mmv1/products/pubsub/Topic.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ properties:
name: 'schemaSettings'
description: |
Settings for validating messages published against a schema.
default_from_api: true
properties:
- !ruby/object:Api::Type::String
name: 'schema'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,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 @@ -228,7 +231,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 @@ -243,6 +247,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
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 0c8818e

Please sign in to comment.