Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add project field to iam pubsub topic resources #1154

Merged
merged 2 commits into from
Mar 5, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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