-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmagento.tf
37 lines (32 loc) · 1.16 KB
/
magento.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
#######################################################################
## setup magento
#######################################################################
resource "terraform_data" "magento_setup" {
connection {
type = "ssh"
user = "ubuntu"
private_key = file("${var.ssh_priv_key}")
host = google_compute_instance.demo_origin_instance.network_interface.0.access_config.0.nat_ip
}
provisioner "file" {
source = "magento.sh"
destination = "magento.sh"
}
provisioner "file" {
source = "fastly-magento-module.sh"
destination = "fastly-magento-module.sh"
}
provisioner "remote-exec" {
inline = [
"until grep -q 'startup-script exit status 0' /var/log/syslog; do sleep 10; done",
"sudo usermod -a -G www-data ubuntu"
]
}
provisioner "remote-exec" {
inline = [
"chmod +x magento.sh fastly-magento-module.sh",
"repo_user=${var.magento_pub_key} repo_pass=${var.magento_priv_key} base_url='${var.site_name}.freetls.fastly.net' ./magento.sh",
"service_id=${fastly_service_vcl.demo_service.id} api_key=${var.fastly_api_key} ./fastly-magento-module.sh"
]
}
}