Use this example to add OS Login admin role to the Compute Engine service account.

## Code sample

### Terraform


To learn how to apply or remove a Terraform configuration, see
[Basic Terraform commands](https://docs.cloud.google.com/docs/terraform/basic-commands).


For more information, see the
[Terraform provider reference documentation](https://registry.terraform.io/providers/hashicorp/google/latest/docs).

    data "google_project" "project" {
    }
    resource "google_project_iam_member" "os_login_admin_users" {
      project = data.google_project.project.project_id
      role    = "roles/compute.osAdminLogin"
      member  = "serviceAccount:service-${data.google_project.project.number}@compute-system.iam.gserviceaccount.com"
    }

## What's next


To search and filter code samples for other Google Cloud products, see the
[Google Cloud sample browser](https://docs.cloud.google.com/docs/samples?product=computeengine).