strip cluster bootstraps
All checks were successful
AI Code Review / ai-review (pull_request) Successful in 59s

This commit is contained in:
2026-04-27 21:34:11 +02:00
parent 0353803d4f
commit 96dde22884
42 changed files with 65 additions and 2338 deletions

View File

@@ -1,20 +1,12 @@
module "cluster" {
source = "../modules/cluster"
prefix = "devhub-dev"
prefix = "clst-dev"
zone = "no-svg1"
node_plan = "DEV-1xCPU-2GB"
node_count = 2
network_cidr = "10.100.0.0/24"
# Data services — smallest plans for dev
pg_plan = "1x1xCPU-2GB-25GB"
pg_version = "16"
valkey_plan = "1x1xCPU-2GB"
objstore_region = "europe-1"
termination_protection = false
tags = {
Environment = "dev"
ManagedBy = "tofu"

View File

@@ -11,57 +11,3 @@ output "cluster_name" {
output "zone" {
value = module.cluster.zone
}
# ─── PostgreSQL ──────────────────────────────────────────────────────
output "pg_host" {
value = module.cluster.pg_host
}
output "pg_port" {
value = module.cluster.pg_port
}
output "pg_keycloak_password" {
value = module.cluster.pg_keycloak_password
sensitive = true
}
output "pg_gitlab_password" {
value = module.cluster.pg_gitlab_password
sensitive = true
}
# ─── Valkey ──────────────────────────────────────────────────────────
output "valkey_host" {
value = module.cluster.valkey_host
}
output "valkey_port" {
value = module.cluster.valkey_port
}
output "valkey_password" {
value = module.cluster.valkey_password
sensitive = true
}
# ─── Object Storage ─────────────────────────────────────────────────
output "s3_endpoint" {
value = module.cluster.s3_endpoint
}
output "s3_region" {
value = module.cluster.s3_region
}
output "s3_access_key" {
value = module.cluster.s3_access_key
}
output "s3_secret_key" {
value = module.cluster.s3_secret_key
sensitive = true
}

View File

@@ -54,152 +54,3 @@ resource "upcloud_kubernetes_node_group" "workers" {
env = lookup(var.tags, "Environment", "dev")
}
}
# ─── Managed PostgreSQL ──────────────────────────────────────────────
resource "upcloud_managed_database_postgresql" "main" {
name = "${var.prefix}-postgresql"
plan = var.pg_plan
title = "${var.prefix} PostgreSQL"
zone = var.zone
termination_protection = var.termination_protection
network {
family = "IPv4"
name = "pg-private"
type = "private"
uuid = upcloud_network.kubernetes.id
}
properties {
public_access = false
version = var.pg_version
}
labels = var.tags
}
resource "upcloud_managed_database_logical_database" "keycloak" {
service = upcloud_managed_database_postgresql.main.id
name = "keycloak"
}
resource "upcloud_managed_database_logical_database" "gitlab" {
service = upcloud_managed_database_postgresql.main.id
name = "gitlabhq_production"
}
resource "upcloud_managed_database_user" "keycloak" {
service = upcloud_managed_database_postgresql.main.id
username = "keycloak"
}
resource "upcloud_managed_database_user" "gitlab" {
service = upcloud_managed_database_postgresql.main.id
username = "gitlab"
}
# ─── Managed Valkey ──────────────────────────────────────────────────
resource "upcloud_managed_database_valkey" "main" {
name = "${var.prefix}-valkey"
plan = var.valkey_plan
title = "${var.prefix} Valkey"
zone = var.zone
termination_protection = var.termination_protection
network {
family = "IPv4"
name = "valkey-private"
type = "private"
uuid = upcloud_network.kubernetes.id
}
properties {
public_access = false
}
labels = var.tags
}
# ─── Managed Object Storage ─────────────────────────────────────────
resource "upcloud_managed_object_storage" "main" {
name = "${var.prefix}-objsto"
region = var.objstore_region
configured_status = "started"
network {
family = "IPv4"
name = "objsto-private"
type = "private"
uuid = upcloud_network.kubernetes.id
}
labels = var.tags
}
resource "upcloud_managed_object_storage_user" "gitlab" {
service_uuid = upcloud_managed_object_storage.main.id
username = "${var.prefix}-gitlab"
}
resource "upcloud_managed_object_storage_user_access_key" "gitlab" {
service_uuid = upcloud_managed_object_storage.main.id
username = upcloud_managed_object_storage_user.gitlab.username
status = "Active"
}
resource "upcloud_managed_object_storage_policy" "gitlab" {
service_uuid = upcloud_managed_object_storage.main.id
name = "gitlab-full-access"
description = "Full S3 access for GitLab"
document = urlencode(jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Action = ["s3:*"]
Resource = "*"
}
]
}))
}
resource "upcloud_managed_object_storage_user_policy" "gitlab" {
service_uuid = upcloud_managed_object_storage.main.id
username = upcloud_managed_object_storage_user.gitlab.username
name = upcloud_managed_object_storage_policy.gitlab.name
}
resource "upcloud_managed_object_storage_bucket" "gitlab_artifacts" {
service_uuid = upcloud_managed_object_storage.main.id
name = "${var.prefix}-gitlab-artifacts"
}
resource "upcloud_managed_object_storage_bucket" "gitlab_uploads" {
service_uuid = upcloud_managed_object_storage.main.id
name = "${var.prefix}-gitlab-uploads"
}
resource "upcloud_managed_object_storage_bucket" "gitlab_packages" {
service_uuid = upcloud_managed_object_storage.main.id
name = "${var.prefix}-gitlab-packages"
}
resource "upcloud_managed_object_storage_bucket" "gitlab_lfs" {
service_uuid = upcloud_managed_object_storage.main.id
name = "${var.prefix}-gitlab-lfs"
}
resource "upcloud_managed_object_storage_bucket" "gitlab_registry" {
service_uuid = upcloud_managed_object_storage.main.id
name = "${var.prefix}-gitlab-registry"
}
resource "upcloud_managed_object_storage_bucket" "gitlab_backups" {
service_uuid = upcloud_managed_object_storage.main.id
name = "${var.prefix}-gitlab-backups"
}

View File

@@ -29,71 +29,3 @@ output "zone" {
description = "The zone where the cluster is deployed"
value = var.zone
}
# ─── PostgreSQL ──────────────────────────────────────────────────────
output "pg_host" {
description = "PostgreSQL private hostname"
value = upcloud_managed_database_postgresql.main.service_host
}
output "pg_port" {
description = "PostgreSQL port"
value = upcloud_managed_database_postgresql.main.service_port
}
output "pg_keycloak_password" {
description = "PostgreSQL password for keycloak user"
value = upcloud_managed_database_user.keycloak.password
sensitive = true
}
output "pg_gitlab_password" {
description = "PostgreSQL password for gitlab user"
value = upcloud_managed_database_user.gitlab.password
sensitive = true
}
# ─── Valkey ──────────────────────────────────────────────────────────
output "valkey_host" {
description = "Valkey private hostname"
value = upcloud_managed_database_valkey.main.service_host
}
output "valkey_port" {
description = "Valkey port"
value = upcloud_managed_database_valkey.main.service_port
}
output "valkey_password" {
description = "Valkey default user password"
value = upcloud_managed_database_valkey.main.service_password
sensitive = true
}
# ─── Object Storage ─────────────────────────────────────────────────
output "s3_endpoint" {
description = "S3-compatible public endpoint"
value = [
for ep in upcloud_managed_object_storage.main.endpoint :
"https://${ep.domain_name}" if ep.type == "public"
][0]
}
output "s3_region" {
description = "Object storage region"
value = var.objstore_region
}
output "s3_access_key" {
description = "S3 access key ID"
value = upcloud_managed_object_storage_user_access_key.gitlab.access_key_id
}
output "s3_secret_key" {
description = "S3 secret access key"
value = upcloud_managed_object_storage_user_access_key.gitlab.secret_access_key
sensitive = true
}

View File

@@ -38,36 +38,7 @@ variable "control_plane_ip_filter" {
default = ["0.0.0.0/0"]
}
variable "termination_protection" {
description = "Protect managed databases from accidental deletion"
type = bool
default = false
}
variable "tags" {
description = "Labels to apply to resources"
type = map(string)
}
# ─── Managed Data Services ───────────────────────────────────────────
variable "pg_plan" {
description = "UpCloud Managed PostgreSQL plan"
type = string
}
variable "pg_version" {
description = "PostgreSQL major version"
type = string
default = "16"
}
variable "valkey_plan" {
description = "UpCloud Managed Valkey plan"
type = string
}
variable "objstore_region" {
description = "UpCloud Managed Object Storage region"
type = string
}

View File

@@ -1,20 +1,12 @@
module "cluster" {
source = "../modules/cluster"
prefix = "devhub"
prefix = "clst"
zone = "de-fra1"
node_plan = "4xCPU-8GB"
node_count = 3
network_cidr = "10.100.0.0/24"
# Data services — production-grade plans
pg_plan = "2x2xCPU-4GB-100GB"
pg_version = "16"
valkey_plan = "1x1xCPU-2GB"
objstore_region = "europe-1"
termination_protection = true
control_plane_ip_filter = ["0.0.0.0/0"] # TODO: restrict to known CIDRs
tags = {

View File

@@ -11,57 +11,3 @@ output "cluster_name" {
output "zone" {
value = module.cluster.zone
}
# ─── PostgreSQL ──────────────────────────────────────────────────────
output "pg_host" {
value = module.cluster.pg_host
}
output "pg_port" {
value = module.cluster.pg_port
}
output "pg_keycloak_password" {
value = module.cluster.pg_keycloak_password
sensitive = true
}
output "pg_gitlab_password" {
value = module.cluster.pg_gitlab_password
sensitive = true
}
# ─── Valkey ──────────────────────────────────────────────────────────
output "valkey_host" {
value = module.cluster.valkey_host
}
output "valkey_port" {
value = module.cluster.valkey_port
}
output "valkey_password" {
value = module.cluster.valkey_password
sensitive = true
}
# ─── Object Storage ─────────────────────────────────────────────────
output "s3_endpoint" {
value = module.cluster.s3_endpoint
}
output "s3_region" {
value = module.cluster.s3_region
}
output "s3_access_key" {
value = module.cluster.s3_access_key
}
output "s3_secret_key" {
value = module.cluster.s3_secret_key
sensitive = true
}

View File

@@ -17,7 +17,7 @@
variable "prefix" {
description = "Prefix for resource names"
type = string
default = "devhub-workload"
default = "clst-workload"
}
variable "zone" {