google_service_account

Get the service account from a project. For more information see the official API documentation.

Example Usage

data "google_service_account" "object_viewer" {
  account_id = "object-viewer"
}

Example Usage, save key in Kubernetes secret

data "google_service_account" "myaccount" {
  account_id = "myaccount-id"
}

resource "google_service_account_key" "mykey" {
  service_account_id = data.google_service_account.myaccount.name
}

resource "kubernetes_secret" "google-application-credentials" {
  metadata {
    name = "google-application-credentials"
  }
  data = {
    credentials.json = base64decode(google_service_account_key.mykey.private_key)
  }
}

Argument Reference

The following arguments are supported:

Attributes Reference

In addition to the arguments listed above, the following computed attributes are exported: