Last active
August 13, 2019 18:38
-
-
Save steinbrueckri/f519f39078bec0a306c983dd8e13821b to your computer and use it in GitHub Desktop.
Deploy π SSH π via Terraform #terraform #ssh #deploy
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ssh key via variable | |
resource "google_compute_instance" "via-variable" { | |
name = "via-variable" | |
machine_type = "n1-standard-1" | |
zone = "europe-west4-a" | |
boot_disk { | |
initialize_params { | |
image = "debian-cloud/debian-9" | |
} | |
} | |
// Local SSD disk | |
scratch_disk { | |
} | |
network_interface { | |
network = "default" | |
access_config { | |
// Ephemeral IP | |
} | |
} | |
metadata = { | |
sshKeys = "${var.ssh_key_pub}" | |
enable-oslogin = "FALSE" # to be sure OS Login is disabled for this instance | |
} | |
} | |
# ssh key via file | |
resource "google_compute_instance" "via-file" { | |
name = "via-file" | |
machine_type = "n1-standard-1" | |
zone = "europe-west4-a" | |
boot_disk { | |
initialize_params { | |
image = "debian-cloud/debian-9" | |
} | |
} | |
// Local SSD disk | |
scratch_disk { | |
} | |
network_interface { | |
network = "default" | |
access_config { | |
// Ephemeral IP | |
} | |
} | |
metadata = { | |
sshKeys = "ansible:${file("./files/ssh_key.pub")}" | |
enable-oslogin = "FALSE" # to be sure OS Login is disabled for this instance | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment