-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
52 lines (43 loc) · 947 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
49
50
51
52
variable "do_token" {
type = string
}
variable "ssh_keys" {
type = map(string)
}
variable "ssh_provisioner_private_key" {
type = string
}
output "public_ip" {
value = digitalocean_floating_ip.calagator_org.ip_address
}
terraform {
backend "remote" {
hostname = "app.terraform.io"
organization = "calagator"
workspaces {
name = "calagator-org-infrastructure"
}
}
}
provider "digitalocean" {
token = var.do_token
}
resource "digitalocean_ssh_key" "keys" {
for_each = var.ssh_keys
name = each.key
public_key = each.value
}
resource "digitalocean_droplet" "epoch" {
name = "epoch"
region = "sfo2"
size = "s-2vcpu-4gb"
image = "dokku-18-04"
backups = true
monitoring = true
ipv6 = true
ssh_keys = values(digitalocean_ssh_key.keys)[*].id
}
resource "digitalocean_floating_ip" "calagator_org" {
droplet_id = digitalocean_droplet.epoch.id
region = digitalocean_droplet.epoch.region
}