-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathpuppeteer.tf
46 lines (39 loc) · 1.08 KB
/
puppeteer.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
resource "google_compute_instance" "puppeteer" {
count = var.puppeteer == true ? 1 : 0
name = "${var.site_name}-puppeteer"
machine_type = "c3-standard-4"
depends_on = [fastly_service_vcl.demo_service, terraform_data.magento_setup]
allow_stopping_for_update = true
boot_disk {
initialize_params {
image = "ubuntu-os-cloud/ubuntu-2310-amd64"
}
}
network_interface {
network = "default"
access_config {}
}
metadata = {
ssh-keys = "ubuntu:${file("${var.ssh_pub_key}")}"
}
connection {
type = "ssh"
user = "ubuntu"
private_key = file("${var.ssh_priv_key}")
host = self.network_interface.0.access_config.0.nat_ip
}
provisioner "file" {
source = "puppets/"
destination = "/home/ubuntu"
}
provisioner "file" {
source = "puppeteer.sh"
destination = "puppeteer.sh"
}
provisioner "remote-exec" {
inline = [
"chmod +x puppeteer.sh",
"url=${var.site_name}.freetls.fastly.net ./puppeteer.sh"
]
}
}