1
0
Fork 0
This repository has been archived on 2025-08-23. You can view files and clone it, but you cannot make any changes to it's state, such as pushing and creating new issues, pull requests or comments.
trz-sentry-demo-legacy/infra/terraform.tf
2023-09-26 21:43:36 +00:00

107 lines
2.1 KiB
HCL

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
}