Skip to content

Commit

Permalink
Add project field to iam pubsub topic resources (#1154)
Browse files Browse the repository at this point in the history
* Add project field to iam pubsub topic resources

* Update documentation
  • Loading branch information
rosbo authored Mar 5, 2018
1 parent 5f0808a commit 35c2cb2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
6 changes: 6 additions & 0 deletions google/iam_pubsub_topic.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ var IamPubsubTopicSchema = map[string]*schema.Schema{
ForceNew: true,
DiffSuppressFunc: compareSelfLinkOrResourceName,
},
"project": &schema.Schema{
Type: schema.TypeString,
Optional: true,
Computed: true,
ForceNew: true,
},
}

type PubsubTopicIamUpdater struct {
Expand Down
3 changes: 2 additions & 1 deletion google/resource_pubsub_topic_iam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,13 +139,14 @@ resource "google_service_account" "test-account-1" {
}
resource "google_pubsub_topic_iam_binding" "foo" {
project = "%s"
topic = "${google_pubsub_topic.topic.name}"
role = "roles/pubsub.publisher"
members = [
"serviceAccount:${google_service_account.test-account-1.email}",
]
}
`, topic, account)
`, topic, account, getTestProjectFromEnv())
}

func testAccPubsubTopicIamBinding_update(topic, account string) string {
Expand Down
3 changes: 3 additions & 0 deletions website/docs/r/pubsub_topic_iam.html.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ The following arguments are supported:

* `topic` - (Required) The topic name or id to bind to attach IAM policy to.

* `project` - (Optional) The project in which the resource belongs. If it
is not provided, the provider project is used.

* `member/members` - (Required) Identities that will be granted the privilege in `role`.
Each entry can have one of the following values:
* **allUsers**: A special identifier that represents anyone who is on the internet; with or without a Google account.
Expand Down

0 comments on commit 35c2cb2

Please sign in to comment.