-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.tf
68 lines (57 loc) · 1.22 KB
/
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
terraform {
required_providers {
hcloud = {
source = "hetznercloud/hcloud"
version = "1.23.0"
}
nomad = {
source = "hashicorp/nomad"
version = "1.4.11"
}
consul = {
source = "hashicorp/consul"
version = "2.10.1"
}
}
backend "remote" {
hostname = "app.terraform.io"
organization = "PR1SM"
workspaces {
name = "terraform-config"
}
}
}
data "template_file" "user_data" {
template = file("./cloud_init.yaml")
}
variable "hcloud_token" {}
variable "ssh_key" {}
variable "nomad_address" {}
provider "hcloud" {
token = var.hcloud_token
}
provider "consul" {
datacenter = "dc1"
}
resource "hcloud_server" "pr1sm-hub" {
name = "pr1sm-hub"
image = "ubuntu-20.04"
server_type = "cpx31"
backups = true
location = "nbg1"
user_data = data.template_file.user_data.rendered
}
resource "hcloud_ssh_key" "default" {
name = "devenv jonas schultheiss"
public_key = var.ssh_key
}
provider "nomad" {
address = var.nomad_address
region = "global"
}
resource "nomad_job" "kratos" {
jobspec = file("./nomad/kratos.nomad")
}
resource "nomad_job" "kratos-psql" {
jobspec = file("./nomad/kratos-psql.nomad")
}