Skip to content

Commit

Permalink
fix: Allow Pub/Sub Topic update to remove schema settings (GoogleClou…
Browse files Browse the repository at this point in the history
  • Loading branch information
kamalaboulhosn authored and c2thorn committed Jul 9, 2024
1 parent 91abd11 commit 413102a
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 413102a

Please sign in to comment.