Skip to content

Commit

Permalink
Add new field filter to pubsub. (#3759) (#494)
Browse files Browse the repository at this point in the history
* Add new field filter to pubsub.

Fixes: hashicorp/terraform-provider-google#6727

* Fixed filter name, it was improperly set.

* add filter key to pubsub subscription unit test

* spaces not tabs!

* hardcode filter value in test

* revert remove escaped quotes

Co-authored-by: Tim O'Connell <[email protected]>
Signed-off-by: Modular Magician <[email protected]>

Co-authored-by: Tim O'Connell <[email protected]>
  • Loading branch information
modular-magician and tim-codes authored Aug 11, 2020
1 parent 4124d7f commit 4583621
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions google/pubsub_subscription.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ func GetPubsubSubscriptionApiObject(d TerraformResourceData, config *Config) (ma
} else if v, ok := d.GetOkExists("expiration_policy"); ok || !reflect.DeepEqual(v, expirationPolicyProp) {
obj["expirationPolicy"] = expirationPolicyProp
}
filterProp, err := expandPubsubSubscriptionFilter(d.Get("filter"), d, config)
if err != nil {
return nil, err
} else if v, ok := d.GetOkExists("filter"); !isEmptyValue(reflect.ValueOf(filterProp)) && (ok || !reflect.DeepEqual(v, filterProp)) {
obj["filter"] = filterProp
}
deadLetterPolicyProp, err := expandPubsubSubscriptionDeadLetterPolicy(d.Get("dead_letter_policy"), d, config)
if err != nil {
return nil, err
Expand Down Expand Up @@ -278,6 +284,10 @@ func expandPubsubSubscriptionExpirationPolicyTtl(v interface{}, d TerraformResou
return v, nil
}

func expandPubsubSubscriptionFilter(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
return v, nil
}

func expandPubsubSubscriptionDeadLetterPolicy(v interface{}, d TerraformResourceData, config *Config) (interface{}, error) {
l := v.([]interface{})
if len(l) == 0 || l[0] == nil {
Expand Down

0 comments on commit 4583621

Please sign in to comment.