-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
48 lines (40 loc) · 880 Bytes
/
main.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
variable "do_token" {
default = ""
}
variable "ssh_key_fingerprint" {
default = ""
}
provider "digitalocean" {
token = var.do_token
}
resource "digitalocean_droplet" "did"{
image = "ubuntu-18-04-x64"
name = "node1"
region = "ams3"
size = "s-4vcpu-8gb"
ssh_keys = [var.ssh_key_fingerprint]
provisioner "file" {
connection {
host = digitalocean_droplet.did.ipv4_address
type = "ssh"
user = "root"
private_key = file("~/.ssh/id_rsa")
}
source = "./frontend/build"
destination = "/root"
}
provisioner "remote-exec" {
connection {
host = digitalocean_droplet.did.ipv4_address
type = "ssh"
user = "root"
private_key = file("~/.ssh/id_rsa")
}
inline = [
"snap install serve",
]
}
}
output "didaddr"{
value = digitalocean_droplet.did.ipv4_address
}