Skip to content

Commit

Permalink
Add example in docs for creating a subscription with a topic in anoth…
Browse files Browse the repository at this point in the history
…er project
  • Loading branch information
rosbo committed Oct 30, 2017
1 parent d6cbabc commit 223eb7a
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions website/docs/r/pubsub_subscription.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,13 @@ Creates a subscription in Google's pubsub queueing system. For more information
## Example Usage

```hcl
resource "google_pubsub_topic" "default-topic" {
name = "default-topic"
}
resource "google_pubsub_subscription" "default" {
name = "default-subscription"
topic = "default-topic"
topic = "${google_pubsub_topic.default-topic.name}"
ack_deadline_seconds = 20
Expand All @@ -32,14 +36,28 @@ resource "google_pubsub_subscription" "default" {
}
```

If the subscription has a topic in a different project:

```hcl
resource "google_pubsub_topic" "topic-different-project" {
project = "another-project"
name = "topic-different-project"
}
resource "google_pubsub_subscription" "default" {
name = "default-subscription"
topic = "${google_pubsub_topic.topic-different-project.id}"
}
```

## Argument Reference

The following arguments are supported:

* `name` - (Required) A unique name for the resource, required by pubsub.
Changing this forces a new resource to be created.

* `topic` - (Required) A topic to bind this subscription to, required by pubsub.
* `topic` - (Required) The topic name or id to bind this subscription to, required by pubsub.
Changing this forces a new resource to be created.

- - -
Expand Down

0 comments on commit 223eb7a

Please sign in to comment.