Skip to content

Commit 3b2aa0f

Browse files
Mark google_pubsub_subscription.enable_message_ordering as ForceNew (#4128) (#2624)
Signed-off-by: Modular Magician <[email protected]>
1 parent 1af521a commit 3b2aa0f

File tree

2 files changed

+4
-10
lines changed

2 files changed

+4
-10
lines changed

.changelog/4128.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
```release-note:breaking-change
2+
pubsub: changing the value of `google_pubsub_subscription.enable_message_ordering` will now recreate the resource. Previously, an error was returned.
3+
```

google-beta/resource_pubsub_subscription.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ If this parameter is 0, a default value of 5 is used.`,
144144
"enable_message_ordering": {
145145
Type: schema.TypeBool,
146146
Optional: true,
147+
ForceNew: true,
147148
Description: `If 'true', messages published with the same orderingKey in PubsubMessage will be delivered to
148149
the subscribers in the order in which they are received by the Pub/Sub system. Otherwise, they
149150
may be delivered in any order.`,
@@ -653,12 +654,6 @@ func resourcePubsubSubscriptionUpdate(d *schema.ResourceData, meta interface{})
653654
} else if v, ok := d.GetOkExists("retry_policy"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, retryPolicyProp)) {
654655
obj["retryPolicy"] = retryPolicyProp
655656
}
656-
enableMessageOrderingProp, err := expandPubsubSubscriptionEnableMessageOrdering(d.Get("enable_message_ordering"), d, config)
657-
if err != nil {
658-
return err
659-
} else if v, ok := d.GetOkExists("enable_message_ordering"); !isEmptyValue(reflect.ValueOf(v)) && (ok || !reflect.DeepEqual(v, enableMessageOrderingProp)) {
660-
obj["enableMessageOrdering"] = enableMessageOrderingProp
661-
}
662657

663658
obj, err = resourcePubsubSubscriptionUpdateEncoder(d, meta, obj)
664659
if err != nil {
@@ -704,10 +699,6 @@ func resourcePubsubSubscriptionUpdate(d *schema.ResourceData, meta interface{})
704699
if d.HasChange("retry_policy") {
705700
updateMask = append(updateMask, "retryPolicy")
706701
}
707-
708-
if d.HasChange("enable_message_ordering") {
709-
updateMask = append(updateMask, "enableMessageOrdering")
710-
}
711702
// updateMask is a URL parameter but not present in the schema, so replaceVars
712703
// won't set it
713704
url, err = addQueryParams(url, map[string]string{"updateMask": strings.Join(updateMask, ",")})

0 commit comments

Comments
 (0)