I have recently started using Google Cloud Plattform with Terraform, for a minor project my company is doing.

A smallish issue is bugging me, but I don't seem to find any relevant documentation about it.

When I create instances with terraform, only one username is created, and it has my name. I haven't found a way to control this behaviour and this will be an issue when more users will start to work on this project

  • It shouldn't be a problem if you are going to use project-wide ssh keys – ALex_hha Apr 4 '18 at 16:00
  • It isn't a blocker, but having system user "bruno" everywhere looks tacky and I can see why my employer doesn't like it. I can access and give access to anyone I need to, I just don't want my first name to be the only OS user of a VM – Bruno9779 Apr 4 '18 at 16:04

When you create an instance, GCP will create a single user as part of the root or admin group. This user is created based on the user account that created the instance. This can't be changed.

However, you can add a startup script to your instances to change, remove or add users to your instance. So in your current case, you can create a script that will remove "bruno" and add a more generic "user". As previously mentioned, for Linux OS, each GCP user will connect with their own account via SSH using the managed SSH keys.

  • I forgot to comment after finding the solution to this. The solution was in understanding the internals of project metadata ssh keys. I don't like the startup script idea and I don't agree that only one sudo enabled user is created. I have multiple ssh keys in project metadata and an user named after the e-mail of the ssh keyis created for each – Bruno9779 Apr 10 '18 at 14:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.