aboutsummaryrefslogtreecommitdiff
path: root/vps.tf
blob: e5f088433a05fa4a3f955e0918ce5e46a3530d17 (plain) (blame)
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
variable "do_token" {}
variable "ssh_fingerprint" {}

provider "digitalocean" {
  token = "${var.do_token}"
  version = "~> 1.1"
}

resource "digitalocean_droplet" "vps" {
  image = "ubuntu-18-04-x64"
  name = "sovereignty"
  region = "nyc3"
  size = "512mb"
  backups = true
  ipv6 = true
  monitoring = true
  ssh_keys = [
    "${var.ssh_fingerprint}"
  ]

  connection {
    user = "root"
    type = "ssh"
    private_key = "${file("${path.module}/secrets/id_rsa")}"
    timeout = "2m"
  }

  # FIXME
  provisioner "remote-exec" {
    inline = [
      "export PATH=$PATH:/usr/bin",
      # install nginx
      "sudo apt-get update",
      "sudo apt-get -y install nginx"
    ]
  }
}