Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Allow Pub/Sub Topic update to remove schema settings #7674

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-beta/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-beta/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.