google-compute-engine,gcloud"/>
  • 5
name

A PHP Error was encountered

Severity: Notice

Message: Undefined index: userid

Filename: views/question.php

Line Number: 191

Backtrace:

File: /home/prodcxja/public_html/questions/application/views/question.php
Line: 191
Function: _error_handler

File: /home/prodcxja/public_html/questions/application/controllers/Questions.php
Line: 433
Function: view

File: /home/prodcxja/public_html/questions/index.php
Line: 315
Function: require_once

I'm trying to enable os login for an instance. I've already set the Metadata os-login: TRUE and added my public key to my account with the gcloud compute os-login ssh-keys add command. Now, I'm trying to add my role to the instance, as described here: https://cloud.google.com/compute/docs/instances/managing-instance-access#configure_users

I'm running into an issue with the command however and the error message doesn't make it clear to me what's going wrong. Here's my command and the output:

$ gcloud beta compute instances add-iam-policy-binding tim-test --project='my-project' --zone='europe-west4-a' --member='user:tim@domain.tld' --role=roles/compute.osAdminLogin
ERROR: (gcloud.beta.compute.instances.add-iam-policy-binding) HTTPError 400: Invalid value 'projects/packer-automation/zones/europe-west4-a/instances/tim-test'. Values must match the following regular expression: '[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?|[1-9][0-9]{0,19}'

What am I doing wrong?

If you already did the OS login setup correctly, there is no need to add the compute instance information in the command:
gcloud beta compute instances ....

Maybe that information you are checking is not that detailed, try using a command like this:
gcloud projects add-iam-policy-binding example-project-id-1 \ --member='user:test-user@gmail.com' --role='roles/editor'

Here you can find more details or you can also use beta commands

  • 1
Reply Report

Warm tip !!!

This article is reproduced from Stack Exchange / Stack Overflow, please click

Trending Tags