Subscriptions are defined with the `subscriptions` variable, allowing optional configuration of per-subscription defaults. Push subscriptions need extra configuration, shown in the following example.
```hcl
module "pubsub" {
source = "./modules/pubsub"
project_id = "my-project
name = "my-topic"
subscriptions = {
test-pull = null
test-pull-override = {
labels = { test = "override" }
options = {
ack_deadline_seconds = null
message_retention_duration = null
retain_acked_messages = true
expiration_policy_ttl = null
}
}
}
}
```
### Push subscriptions
Push subscriptions need extra configuration in the `push_configs` variable.
| *iam_members* | IAM members for each topic role. | <codetitle="map(list(string))">map(list(string))</code> | | <codetitle="">{}</code> |
| *iam_roles* | IAM roles for topic. | <codetitle="list(string)">list(string)</code> | | <codetitle="">[]</code> |
| *regions* | List of regions used to set persistence policy. | <codetitle="list(string)">list(string)</code> | | <codetitle="">[]</code> |
| *subscription_iam_members* | IAM members for each subscription and role. | <codetitle="map(map(list(string)))">map(map(list(string)))</code> | | <codetitle="">{}</code> |
| *subscription_iam_roles* | IAM roles for each subscription. | <codetitle="map(list(string))">map(list(string))</code> | | <codetitle="">{}</code> |
| *subscriptions* | Topic subscriptions. Also define push configs for push subscriptions. If options is set to null subscription defaults will be used. Labels default to topic labels if set to null. | <codetitle="map(object({ labels = map(string) options = object({ ack_deadline_seconds = number message_retention_duration = number retain_acked_messages = bool expiration_policy_ttl = string }) }))">map(object({...}))</code> | | <codetitle="">{}</code> |