-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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 IAM support for pubsub topic #875
Conversation
--- PASS: TestAccPubsubTopicIamPolicy (4.25s)
--- PASS: TestAccPubsubTopicIamMember (5.49s)
--- PASS: TestAccPubsubTopicIamBinding (7.41s) |
c76adbf
to
b16837a
Compare
google/iam_pubsub_topic.go
Outdated
} | ||
|
||
func (u *PubsubTopicIamUpdater) GetMutexKey() string { | ||
return fmt.Sprintf("iam-folder-%s", u.topic) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this needs to be updated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I keep forgetting this one... Done
google/iam_pubsub_topic.go
Outdated
} | ||
|
||
func (u *PubsubTopicIamUpdater) DescribeResource() string { | ||
return fmt.Sprintf("folder %q", u.topic) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
google/iam_pubsub_topic.go
Outdated
} | ||
|
||
// v1 and v2beta policy are identical | ||
func resourceManagerToPubsubPolicy(in *cloudresourcemanager.Policy) (*pubsub.Policy, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this func follows a different format than the one in iam_storage_bucket.go, consider using a consistent style between the two
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They use the same format:
- resourceManagerToStoragePolicy resourceManagerToPubsubPolicy
- storageToResourceManagerPolicy vs pubsubToResourceManagerPolicy
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah sorry I meant in using named return variables:
func resourceManagerToStoragePolicy(p *cloudresourcemanager.Policy) (policy *storage.Policy, err error) {
policy = &storage.Policy{}
err = Convert(p, policy)
return
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I kept the new way of doing it and changed iam storage bucket. The error message is more descriptive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll also want to do it for iam_service_account.go and iam_kms_key_ring.go
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Providers: testAccProviders, | ||
Steps: []resource.TestStep{ | ||
{ | ||
// Test Iam Member creation (no update for member, no need to test) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment is misplaced.
Also, should we have an update test for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Just been looking for a way to permission pubsub topics! Do you have an idea when this feature might be released? |
* Add IAM support for pubsub topic * Fix resource name * Add update test for iam_policy resource * Standardize policy conversion function * Standardize policy conversion function all resources
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
Fixes #83
cc @ndmckinley (Can't assign you until you re-accept the contributor invite).