forked from fly-apps/go-example
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.tf
61 lines (56 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
terraform {
required_providers {
fly = {
source = "fly-apps/fly"
version = "0.0.23"
}
random = {
source = "hashicorp/random"
version = "3.5.1"
}
}
}
resource "random_integer" "exampleAppSuffix" {
min = 1000
max = 9999
}
resource "fly_app" "exampleApp" {
name = "dry-fire-${random_integer.exampleAppSuffix.result}"
org = "personal"
}
resource "fly_ip" "exampleIp" {
app = fly_app.exampleApp.name
type = "v4"
depends_on = [fly_app.exampleApp]
}
resource "fly_ip" "exampleIpv6" {
app = fly_app.exampleApp.name
type = "v6"
depends_on = [fly_app.exampleApp]
}
resource "fly_machine" "exampleMachine" {
for_each = toset(["dfw", "ewr", "lax"])
app = fly_app.exampleApp.name
region = each.value
name = "pythoninthegrass-fly-iac-${each.value}"
image = "ghcr.io/pythoninthegrass/go-example:latest"
services = [
{
ports = [
{
port = 443
handlers = ["tls", "http"]
},
{
port = 80
handlers = ["http"]
}
]
"protocol" : "tcp",
"internal_port" : 8080
}
]
cpus = 1
memorymb = 256
depends_on = [fly_app.exampleApp]
}