Initial commit
This commit is contained in:
commit
7724a7614e
24 changed files with 1653 additions and 0 deletions
107
infra/terraform.tf
Normal file
107
infra/terraform.tf
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
locals {
|
||||
zone_id = "" // Your Cloudflare Zone ID
|
||||
}
|
||||
|
||||
resource "digitalocean_kubernetes_cluster" "k8s" {
|
||||
name = "sentry-demo"
|
||||
region = "fra1"
|
||||
|
||||
version = "1.20.7-do.0"
|
||||
|
||||
node_pool {
|
||||
name = "sentry-demo"
|
||||
size = "s-2vcpu-4gb"
|
||||
node_count = 3
|
||||
}
|
||||
}
|
||||
|
||||
resource "digitalocean_loadbalancer" "lb" {
|
||||
name = "sentry-demo"
|
||||
region = "fra1" // Change to your nearest DigitalOcean region
|
||||
|
||||
droplet_tag = "k8s:${digitalocean_kubernetes_cluster.k8s.id}"
|
||||
|
||||
healthcheck {
|
||||
port = 30001
|
||||
protocol = "tcp"
|
||||
}
|
||||
|
||||
forwarding_rule {
|
||||
entry_port = 80
|
||||
target_port = 30001
|
||||
entry_protocol = "tcp"
|
||||
target_protocol = "tcp"
|
||||
}
|
||||
|
||||
forwarding_rule {
|
||||
entry_port = 80
|
||||
target_port = 30001
|
||||
entry_protocol = "tcp"
|
||||
target_protocol = "tcp"
|
||||
}
|
||||
|
||||
forwarding_rule {
|
||||
entry_port = 443
|
||||
target_port = 30002
|
||||
entry_protocol = "tcp"
|
||||
target_protocol = "tcp"
|
||||
}
|
||||
|
||||
forwarding_rule {
|
||||
entry_port = 8080
|
||||
target_port = 30003
|
||||
entry_protocol = "tcp"
|
||||
target_protocol = "tcp"
|
||||
}
|
||||
|
||||
forwarding_rule {
|
||||
entry_port = 25
|
||||
target_port = 30025
|
||||
entry_protocol = "tcp"
|
||||
target_protocol = "tcp"
|
||||
}
|
||||
|
||||
forwarding_rule {
|
||||
entry_port = 4036
|
||||
target_port = 30002
|
||||
entry_protocol = "tcp"
|
||||
target_protocol = "tcp"
|
||||
}
|
||||
}
|
||||
|
||||
resource "cloudflare_record" "k8s" {
|
||||
zone_id = local.zone_id
|
||||
name = "trz"
|
||||
value = digitalocean_loadbalancer.lb.ip
|
||||
type = "A"
|
||||
proxied = false
|
||||
}
|
||||
|
||||
resource "cloudflare_record" "k8s_wildcard" {
|
||||
zone_id = local.zone_id
|
||||
name = "*.${cloudflare_record.k8s.name}"
|
||||
value = cloudflare_record.k8s.hostname
|
||||
type = "CNAME"
|
||||
proxied = false
|
||||
}
|
||||
|
||||
resource "cloudflare_record" "sentry" {
|
||||
zone_id = local.zone_id
|
||||
name = "sentry"
|
||||
value = cloudflare_record.k8s.hostname
|
||||
type = "CNAME"
|
||||
proxied = false
|
||||
}
|
||||
|
||||
output "ip" {
|
||||
value = digitalocean_loadbalancer.lb.ip
|
||||
}
|
||||
|
||||
output "kubeconfig" {
|
||||
value = digitalocean_kubernetes_cluster.k8s.kube_config.0.raw_config
|
||||
sensitive = true
|
||||
}
|
||||
|
||||
output "sentry_hostname" {
|
||||
value = cloudflare_record.sentry.hostname
|
||||
}
|
||||
Reference in a new issue