In this lecture you mention several times the add-iam-policy-binding command line, however, it doesn’t seem to be correct.
The slides show this cmd:
gcloud compute add-iam-policy-binding myvm1 …..
The correct command (for compute) seem to be:
gcloud alpha compute instances add-iam-policy-binding INSTANCE_NAME –member=MEMBER –role=ROLE [–zone=ZONE] [GCLOUD_WIDE_FLAG …]
as per the doc: https://cloud.google.com/sdk/gcloud/reference/alpha/compute/instances/add-iam-policy-binding
You are absolutely right that the example command I gave was wrong. 😢 I had tried to change my example from a project-level one to an instance-level one–because I thought it would do a better job of showing off policies–but I mangled it in the process and neglected to test it. So thank you for pointing it out!
As far as I could tell, the error was restricted to the one example–as the generic pattern will work fine in normal gcloud (i.e. non-alpha, non-beta) for some resources (like projects)–but if there are any more errors, please let me know!
I have now fixed (and tested!) the example command and updated the lecture.
Tnx – I would link to the gcloud documentation as its very useful and easy to follow.
Good suggestion! Thank you! I’ve now done this–but since there are so many different resources that support add-iam-policy-binding, I had to link to them with a google search. 🙂