Create a Compute Engine instance with OS Login

Create a Compute Engine instance with OS Login enabled

Explore further

For detailed documentation that includes this code sample, see the following:

Code sample

Terraform

To learn how to apply or remove a Terraform configuration, see Basic Terraform commands . For more information, see the Terraform provider reference documentation .

  resource 
  
 "google_compute_instance" 
  
 "oslogin_instance" 
  
 { 
  
 name 
  
 = 
  
 "oslogin-instance-name" 
  
 machine_type 
  
 = 
  
 "f1-micro" 
  
 zone 
  
 = 
  
 "us-central1-c" 
  
 metadata 
  
 = 
  
 { 
  
 enable-oslogin 
  
 : 
  
 "TRUE" 
  
 } 
  
 boot_disk 
  
 { 
  
 initialize_params 
  
 { 
  
 image 
  
 = 
  
 "debian-cloud/debian-11" 
  
 } 
  
 } 
  
 network_interface 
  
 { 
 # A default network is created for all GCP projects 
  
 network 
  
 = 
  
 "default" 
  
 access_config 
  
 { 
  
 } 
  
 } 
 } 
 

What's next

To search and filter code samples for other Google Cloud products, see the Google Cloud sample browser .

Design a Mobile Site
View Site in Mobile | Classic
Share by: