Skip to content

Commit

Permalink
validate filter length doesn't exceed 256 bytes in subscription (#114…
Browse files Browse the repository at this point in the history
…21) (#7968)

[upstream:ff502095f0d2b0e2290b9036099ad7218854c4ea]

Signed-off-by: Modular Magician <[email protected]>
  • Loading branch information
modular-magician authored Aug 14, 2024
1 parent 161f64e commit 5fb0188
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions .changelog/11421.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:enhancement
pusbub: added validation to `filter` field for `google_pubsub_subscription`
```
8 changes: 5 additions & 3 deletions google-beta/services/pubsub/resource_pubsub_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (

"github.com/hashicorp/terraform-provider-google-beta/google-beta/tpgresource"
transport_tpg "github.com/hashicorp/terraform-provider-google-beta/google-beta/transport"
"github.com/hashicorp/terraform-provider-google-beta/google-beta/verify"
)

func comparePubsubSubscriptionExpirationPolicy(_, old, new string, _ *schema.ResourceData) bool {
Expand Down Expand Up @@ -352,9 +353,10 @@ Example - "3.5s".`,
},
},
"filter": {
Type: schema.TypeString,
Optional: true,
ForceNew: true,
Type: schema.TypeString,
Optional: true,
ForceNew: true,
ValidateFunc: verify.ValidateRegexp(`^.{1,256}$`),
Description: `The subscription only delivers the messages that match the filter.
Pub/Sub automatically acknowledges the messages that don't match the filter. You can filter messages
by their attributes. The maximum length of a filter is 256 bytes. After creating the subscription,
Expand Down

0 comments on commit 5fb0188

Please sign in to comment.