/
dojo.tf
65 lines (52 loc) · 1.32 KB
/
dojo.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
resource "google_compute_disk" "dojo-vm-image" {
name = "dojo-vm-disk-image"
type = "pd-ssd"
zone = "europe-west1-b"
size = 200
image = "iog-hydra-1637229888"
labels = {
environment = "dev"
}
}
resource "google_compute_instance" "dojo-vm" {
name = "dojo-vm-1"
# For faster CPUs
# see https://cloud.google.com/compute/docs/compute-optimized-machines
machine_type = "c2-standard-4"
allow_stopping_for_update = true
tags = [ "dev-machine" ]
metadata = {
sshKeys = file("ssh_keys")
}
boot_disk {
source = google_compute_disk.dojo-vm-image.self_link
}
network_interface {
network = "default"
access_config {
// Ephemeral IP
}
}
connection {
type = "ssh"
user = "curry"
private_key = file(var.private_key_file)
host = google_compute_instance.dojo-vm.network_interface.0.access_config.0.nat_ip
}
provisioner "file" {
source = "scripts/configure.sh"
destination = "/home/curry/configure.sh"
}
provisioner "remote-exec" {
inline = [
"chmod +x /home/curry/configure.sh",
"/home/curry/configure.sh"
]
}
}
output "dojo_id" {
value = google_compute_instance.dojo-vm.self_link
}
output "dojo_ip" {
value = google_compute_instance.dojo-vm.network_interface.0.access_config.0.nat_ip
}