-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
main.tf
82 lines (71 loc) · 1.44 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
terraform {
required_version = ">= 1.0.0"
required_providers {
digitalocean = {
source = "digitalocean/digitalocean"
version = ">= 2.0.0"
}
}
}
provider "digitalocean" {}
resource "digitalocean_app" "server-api" {
spec {
name = "server-api"
region = "sfo3"
domain {
name = "api.asyncapi.com"
type = "PRIMARY"
}
ingress {
rule {
component {
name = "asyncapi-server-api"
}
match {
path {
prefix = "/"
}
}
cors {
allow_origins {
exact = "*"
}
allow_methods = ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
allow_headers = ["*"]
}
}
}
service {
name = "asyncapi-server-api"
http_port = 80
health_check {
http_path = "/v1/help/validate"
port = 80
}
env {
key = "PORT"
value = "80"
}
image {
registry_type = "DOCKER_HUB"
registry = "asyncapi"
repository = "server-api"
tag = "latest"
}
instance_count = 1
instance_size_slug = "basic-xs" // $10/month
alert {
rule = "CPU_UTILIZATION"
value = 80
operator = "GREATER_THAN"
window = "TEN_MINUTES"
}
}
alert {
rule = "DEPLOYMENT_FAILED"
}
}
}
output "live_url" {
value = digitalocean_app.server-api.default_ingress
}