Google OS Login SSH Public Key
This page shows how to write Terraform for OS Login SSH Public Key and write them securely.
google_os_login_ssh_public_key (Terraform)
The SSH Public Key in OS Login can be configured in Terraform with the resource name google_os_login_ssh_public_key
. The following sections describe 5 examples of how to use the resource and its parameters.
Example Usage from GitHub
resource "google_os_login_ssh_public_key" "cache" {
user = data.google_client_openid_userinfo.me.email
key = file("~/.ssh/id_rsa_orenzp.pub")
project = data.google_project.project.number
lifecycle {
prevent_destroy = true
resource "google_os_login_ssh_public_key" "cache" {
user = data.google_client_openid_userinfo.me.email
key = file("../static/ssh_rsa.pub")
}
resource "google_os_login_ssh_public_key" "cache" {
provider = google.impersonated
user = module.ansible_sa.email
key = file(var.ssh_public_key)
}
resource "google_os_login_ssh_public_key" "cache" {
provider = google.impersonated
user = module.ansible_sa.email
key = file(var.ssh_public_key)
}
resource "google_os_login_ssh_public_key" "cache" {
user = data.google_client_openid_userinfo.me.email
key = file("../static/ssh_rsa.pub")
}
Parameters
-
expiration_time_usec
optional - string
An expiration time in microseconds since epoch.
-
fingerprint
optional computed - string
The SHA-256 fingerprint of the SSH public key.
Public key text in SSH format, defined by RFC4253 section 6.6.
-
project
optional - string
The project ID of the Google Cloud Platform project.
-
user
required - string
The user email.
Explanation in Terraform Registry
The SSH public key information associated with a Google account. To get more information about SSHPublicKey, see:
- API documentation
- How-to Guides
Frequently asked questions
What is Google OS Login SSH Public Key?
Google OS Login SSH Public Key is a resource for OS Login of Google Cloud Platform. Settings can be wrote in Terraform.
Where can I find the example code for the Google OS Login SSH Public Key?
For Terraform, the orenzp/myTerraform, yaroslavopsguru/gcp-tf-resources and klusters/terraform-tools-gce-molecule source code examples are useful. See the Terraform Example section for further details.