-
Notifications
You must be signed in to change notification settings - Fork 9.6k
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
Google bucket should allow update of predefined_acl #2289
Comments
Summoning: @phinze @mtekel @dhilton Ok so I had a go at this but there are number of potentially insurmountable challenges:
So what to do about this? Here are some policy assumptions I'm making, feel free to tell me they're wrong:
Here is a plan:
Read() will not attempt to update predefined_acl If a bucket is created with predefined_acl, the acls can only be changed by recreating the bucket (losing the contents). We should make it clear in the docs that you are digging your own grave by using predefined_acl. If a bucket is created with acl = [ ... ] then you can change the acls all you like, but you can't switch to predefined acls (because that will recreate the bucket). The actual specification of acls is somewhat verbose (see below) but I think we can convert it into a nicer string representation (and convert it back in Read()), e.g. make it look like this: ["OWNER:project-owners", "OWNER:project-editors", "READER:project-viewers"] these project-owners strings are usually suffixed by the project id -123123123 but we can strip it if it's the project given in the provider. This is important because nobody knows the id number anyway, people use the more readable string representation. But we can let people specify it if they want, or if they're referring to a different project. Google will not let you clear out all the acls, the project-owners always keep the ownership of the bucket. Essentially this means Google implicitly adds the OWNER:project-owners to your ACLs whenever you try to change them. So we'll need to strip that off when we Read() and also in a StateFunc I think (so the diff will work). Likewise, we need the service account used by Terraform to keep ownership permission on the Bucket. So I think Terraform should also add that permission, which will look like "OWNER:user-$PROJECT_ID-$SOME_CODE@developer.gserviceaccount.com". This will behave the same as the implicit acl given by Google. Note that we don't need to add that extra acl if predefined_acl was used, because we don't need OWNER permission if we're not going to update the predefined_acl (it's ForceNew). The only other option I can think of is to get rid of predefined_acl, on the grounds that it's a pain. I think that covers everything. Here's the mapping table I promised: $PROJECT_ID is the project numeric id, not the more human readable fooing-bar-123 form.
|
So in the majority (I presume, I don't know) of cases where a terraform user will make use of canned acls, if you change to a different acl that will And in the other case, when using finer grained acl's the bucket will be updated to the new state however still retaining the exceptions ( service account access) that you mention above. Am I understanding your approach correctly? |
|
@dhilton yes and you'll need the force_destroy attribute to delete the objects in the bucket for that to work as well I'm proposing automatically adding the service account acl in the case of fine-grained acls, but we could also require the user to add it (same effect, different experience). |
@metel after sleeping on it, yes I think we probably could detect drift, if we
@phinze I think that's how a StateFunc works? Basically Terraform diff only needs to know whether an attribute is different between the two states right? There may be issues with getting a canonical form, i.e. sorting the acls. But we may have to face that anyway. And yeah canned acls are a bit crap tbh. If we could get rid of them now I'd seriously consider it, as long as we can make the acls list user-friendly. "OWNER:project-owners" is implicit so the mapping would be: project-private: ["OWNER:project-editors", "READER:project-viewers"] So it's only a mild win from using them. |
Whew - lots of activity here! I haven't fully grokked the domain concepts yet but I'll help where I can here.
Sounds like you have it right. The
I'd be willing to consider dropping canned ACLs if we're only keeping them around for backwards compatibility, provided we figure out what the story would be for folks using them. We could also consider adding support for a resource-level Feel free to call out anything else you'd like me to weigh in on here. |
@sparkprime - This is now fixed. |
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 have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
This is possible via the GCE API's patch call.
No pressing need for this, but logging the issue so it doesn't get forgotten.
The text was updated successfully, but these errors were encountered: